Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

The client can do several actions per frame, for instance, requesting a movement, shooting etc. Should i send a packet to the server for each action the client performed during the frame, or should i stack them in an unique packet and send it at the end of the frame?

EDIT: i'm using Jmonkeyengine and the provided network API SpiderMonkey.

share|improve this question
    
What technology do you use? –  Markus von Broady Sep 28 '12 at 12:37
    
@MarkusvonBroady edited the question. I though it was not technology related and wanted to know how frequently the client state change have to be sent to the server. –  nathan Sep 28 '12 at 12:40
    
I just wanted to make sure we're not talking about http requests. –  Markus von Broady Sep 28 '12 at 13:00
add comment

1 Answer 1

up vote 4 down vote accepted

It shouldn't be a problem to send many packets in one frame. Every packet has some overhead, but you won't feel the difference.

However, if you decide to send a packet every frame, even if there was no user action (or the action is holding a key), while your client will work just fine, and your local testing server will do the job as well, real server will be easily flooded if multiply clients send multiply packets, multiply times (30, 60 or even more) a second. This is same if you want to update mouse cursor position on server every time a user moves the mouse.

share|improve this answer
    
So in conclusion, it does not matter? –  nathan Sep 28 '12 at 13:26
    
In conclusion, it probably could matter in some extreme situations, but they don't fit your description. –  Markus von Broady Sep 28 '12 at 13:45
    
I actually don't care of extreme situations at the moment :-) and my client/server architecture will never have to support crazy amount of connections so i ll consider you answered my question. –  nathan Sep 28 '12 at 13:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.