Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Optimizing Networking  (Read 5711 times)

0 Members and 1 Guest are viewing this topic.

alext94

  • Newbie
  • *
  • Posts: 16
    • View Profile
Optimizing Networking
« on: April 03, 2015, 07:22:52 pm »
Hey!

So i have made a game with networking. It has gotten to the point where i need to start optimizing my networking code, but i don't really know how! Does any one have any good sources of information for optimizing ?

Thanks.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Optimizing Networking
« Reply #1 on: April 03, 2015, 07:42:47 pm »
You have come to that conclusion how? Did someone call you or did a star fall heave which turned out to be an angel?

If you have no idea where to start you probably also have nothing to optimize, or rather if you had a performance issue of any kind you'd know where and could start working on that.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

alext94

  • Newbie
  • *
  • Posts: 16
    • View Profile
Re: Optimizing Networking
« Reply #2 on: April 03, 2015, 07:48:55 pm »
The connection is laggy on the client side, when a certain amount of NPCS spawn due to the traffic building up i'm assuming. I should probably start with only sending data about my entities a set number of times, and i also need to find a way of only updating the NPC to the most recent packet that contains information about that NPC. I just don't know how and i'm sure their is some clever ways of doing this. All i want is a name of a book or relevant resources that i can read to help me with the problems.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Optimizing Networking
« Reply #3 on: April 03, 2015, 08:18:18 pm »
due to the traffic building up i'm assuming.
Programming is a science in most cases. Stuff doesn't magically happen and there no huge blur line on what might or might not be cause something.
Learn to use tools such as a profiler, Wireshark, etc.
If it comes down to performance guessing without actually verifying the the worst thing you can do.

All i want is a name of a book or relevant resources that i can read to help me with the problems.
Get any kind of networking book if you don't really understand whats going on. You also might want to ask at other places (e.g. gamedev.net) since they probably have more people with experience in that sector.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

MakaiKing0

  • Newbie
  • *
  • Posts: 9
    • View Profile
Re: Optimizing Networking
« Reply #4 on: May 28, 2015, 02:02:25 pm »
@eXpl0it3r wow.... no wonder people say that people on this forum aren't friendly.... you don't need to be a mouth-piece about it, it was a perfectly legitimate question.....

@alext94  As the mouth-piece above stated best bet is to try gamedev.net, there are a ton of articles on networking and mmo development.  There really isn't a specific source that has a "best way" or anything.  Most information on the subject of MMOs is pretty scattered, and anyone that says their way is the "right" way, is simply flaunting their ego...  There are ways that are more "efficient" than others, but it's probably best to just read a lot of articles and try to discern which peices of information are more helpful than others.... I had to.....

Oh and ignore the idiots that say it's impossible or you need a massive team....  they clearly don't have any self-confidence... took me all of 2 days to build a client->server model that could host 100+ people in XNA & C#, and I did it going from 0 knowledge of how networking in C# operated....  If I can do it so can you!!!  :)

kitteh-warrior

  • Guest
Re: Optimizing Networking
« Reply #5 on: May 28, 2015, 02:13:46 pm »
wow.... no wonder people say that people on this forum aren't friendly.... you don't need to be a mouth-piece about it, it was a perfectly legitimate question.....

This made me laugh. Why would people see forums as places to meet friends or even friendly people? People come to forums to seek answers or to give answers. I think eXpl0it3r was being rather nice, seeing as this OP's optimisation question has nothing to do with SFML's networking components, rather their own code.

cepro

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • Email
Re: Optimizing Networking
« Reply #6 on: May 28, 2015, 04:50:43 pm »
To be honest this forum is crowded with condescendant people! What a shame for an open-source community!

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Optimizing Networking
« Reply #7 on: May 28, 2015, 05:07:38 pm »
I wouldn't say the forum is full of condescending people. But rather that that there are a number of experienced developers who are a bit fed up with very basic C++ questions that have little to nothing to do with SFML. And sometimes the frustration leaks through in replies.
But most people do still try to actually help IMHO.

Tank

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1486
    • View Profile
    • Blog
    • Email
Re: Optimizing Networking
« Reply #8 on: May 28, 2015, 05:58:20 pm »
Guys, calm down. :) I'm sure eXpl0it3r did not mean to offend anyone, yet I agree that his posts were everything but nice. There will always be posts that won't 100% meet the netiquette, and sometimes people just have bad days or just replied to 5 posts in the style of "How do I do <some very general topic>, please help?", making them feeling annoyed.

So I'd like to apologize in the name of everybody who agrees.

alext94, I suggest you give more details about how you're doing your networking. It was a very general "question", and answering such is not easy, if not impossible, because you are literally asking us to write you a book on good networking practices. ;-)

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: Optimizing Networking
« Reply #9 on: May 28, 2015, 06:04:33 pm »
All i want is a name of a book or relevant resources that i can read to help me with the problems.
If you want a book recommendation, then I'd say go for UNIX Network Programming. It's my "go-to" book on most things network related.

Turbine

  • Full Member
  • ***
  • Posts: 100
    • View Profile
Re: Optimizing Networking
« Reply #10 on: June 09, 2015, 12:28:52 pm »
Alex, there's actually a reason people aren't being forth coming with answers.

The reason is you provided little to no information, you are receiving equally informative answers. What you may not be aware is, there is no magic remedy. Just code it in a sparingly way. After awhile you may come up with these kinds of optimizations on your own, suited to your specific game.

Perhaps you should start with creating a tick system, for instance, instead of running everything once every ms, (or more without a sleep) - consider executing it once every period of time. Many games use a tick of 33-99 times a second. Then you can start on only processing & sending the data relevant to particular clients.