Jump to content

  • Log In with Google      Sign In   
  • Create Account

Number of Packets & Fairness


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 teremy   Members   -  Reputation: 128

Like
0Likes
Like

Posted 15 February 2014 - 06:31 AM

Hello. I currently work myself into network programming and therefore read a lot of articles about it. One article was about how to implement your own flow control ( since using UDP as a protocol, one has to implement this on his own ). So depending on some variables, one either sends 10 packets per second or 30 ( if the connection is in a "good" state ). Now the article didn't really answer the questions I had in mind. Since 10 is a third of 30, how can the game still be fair then, if you only send 10 move commands instead of 30? And also the server has to keep track of the number of packets sent by each client, right? Otherwise with a hacked client or some other tools ( like wireshark ) one could send more than 30 packets and if those contain move commands, then you would walk faster than normal. But the time it takes to send a packet always is slightly different, so I guess it could happen that only 29 packets arrive per second ( or less ) or more than 30. And since my game is running at 60fps, that could mean 60 move commands per seconds. I read on an article about networking programming by Valve, that they send about 20-30 each second, so one packet contains more than only one move command. Are they stored whenever I move and when I got 2 they are send in a packet ( which would conclude the 30 packets per seconds )? Hopefully my questions are clear and even more hopefully you may have answers for me. Thanks for your time! Jan

Sponsor:

#2 hplus0603   Moderators   -  Reputation: 5711

Like
1Likes
Like

Posted 15 February 2014 - 01:23 PM

The game is not "fair" if someone has a better experience than someone else.
This goes for network connections, GPU speed, mouse responsiveness, player skill, ...

That being said, I think "choking" the connection is the wrong answer. If the connection can't keep up, then it can't keep up, and you'd better tell the player what the problem is and then drop the connection.
enum Bool { True, False, FileNotFound };

#3 teremy   Members   -  Reputation: 128

Like
0Likes
Like

Posted 16 February 2014 - 02:04 AM

But I still have to keep track of the number of packets a client sends each second, right? So that noone sends more than he should. Of course the client will try to send only 30 packets per second ( when using my client ), but you can never trust them. And a problem with that is, that it's hard to say he is allowed exactly 30 packets per second, because the slight time differences in sending packets may lead to sending 29 ( or even less ) or 31 ( or even more ) packets per second. Is this the right understanding?

Thank you for your answer, really appreciated!



#4 hplus0603   Moderators   -  Reputation: 5711

Like
0Likes
Like

Posted 16 February 2014 - 01:13 PM

Why does it matter how many packets the client sends?

I presume that your packets contain time-stamped input commands. If the client sends more packets, it will just replace whatever the previous commands were for the given time-step.
enum Bool { True, False, FileNotFound };

#5 frob   Moderators   -  Reputation: 22731

Like
0Likes
Like

Posted 16 February 2014 - 03:32 PM

Not exactly related to fairness, but that situation could also be an indication of something else.

If someone is sending packets at a slightly higher rate than others, I don't see it as a big deal. Some people are on min-spec machines on dialup, other people have high-spec machines with Google Fiber. A well-written game will have fairly consistent communication patterns.

But let's imagine for some game a typical player sends around 10-20 updates per second. This is the same rate for everyone, and it is pretty steady across a large number of games. Suddenly you note one network client is sending 80 or 100 updates per second. I might not do anything differently, but if I did, I would consider it potentially a cheater or an indirect attack on the server.

Check out my book, Game Development with Unity, aimed at beginners who want to build fun games fast.

Also check out my personal website at bryanwagstaff.com, where I write about assorted stuff.


#6 hplus0603   Moderators   -  Reputation: 5711

Like
0Likes
Like

Posted 16 February 2014 - 07:21 PM

I would consider it potentially a cheater or an indirect attack on the server.


Or, perhaps even more likely, a bug in your clock/timing implementation that only manifests on certain laptops with certain CPUs and chipsets.
Not that I would know anything about any specifics... (cough)
enum Bool { True, False, FileNotFound };

#7 frob   Moderators   -  Reputation: 22731

Like
0Likes
Like

Posted 17 February 2014 - 12:34 AM

Haha. In that case, definitely something you should note.

But in any event, minor variations in traffic are probably nothing. Major variations can be flagged and investigated if someone has the time and inclination.

Check out my book, Game Development with Unity, aimed at beginners who want to build fun games fast.

Also check out my personal website at bryanwagstaff.com, where I write about assorted stuff.


#8 wodinoneeye   Members   -  Reputation: 877

Like
0Likes
Like

Posted 21 February 2014 - 06:59 AM

The server should validate the commands the players send.  If they move a distance farther than what they are allow to, then the cheat detection alarm goes off.  A lower spec machine/connection might send fewer packets and command count, but those commands should reflect the full movement the player is seeing on their client (and pressing the buttons for) ---- one guy sends  single move steps in more packets, and the slow machine guy perhaps sends 2 steps per packet and half as many packets within the same time interval.   The players both then update with effectively the same world map speed..


--------------------------------------------Ratings are Opinion, not Fact




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS