Advertisement Jump to content


This topic is now archived and is closed to further replies.


Timing and Sending Data

This topic is 6844 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Obviously timing is critical to a client displaying the correct state. I have though up some simple and not so simple and high bandwidth methods of ensuring this works. What method do you guys use? In general is it better to use tcp so you don''t have to implement your own form of ensuring that critical packets are recieved? Should I use TCP for game state messages and UPD for non critical updates like messaging, scores, blah? I was thinking that ever tenth packet might be where the client sends off its current location and the nine packets in between would be containing things like ''player 4, FORWARD, JUMP''. The tenth packet would be to ensure that if something screwed up in the command delta''s to be played in the world then it would be corrected not to far in to the future. I''d also make this packet based rather than time based so that a player not moving(camping, chatting, healing,taking aim) would not be using and bandwidth. Is that a reasonable assumption Is there anything I''m missing in the things I''ve been talking about over few days? Thanks gimp

Share this post

Link to post
Share on other sites
Guest Anonymous Poster
Hee Hee I asked this same question some time ago too 8^) Well there are proven protocols which can synchronize timmers across a network. Do a search for Network Time Protocol (NTP), that will point you in the right direction. Basicly sending a large sample of timming packets to and from the client and then perform some statsctical analysis on it to extrapalate the delta time between the client and server, and from this you can get the servers and clients times to a degree of accuracy. Would only need to be done once so overhead is negiligable.

With that solved you already won 1/15 of the battle! 8^)


Share this post

Link to post
Share on other sites
If you are doing a client-server game, only the server needs to know *exactly* what time it is. The clients make do with what the server has told them about the state of the world up to the current instant in time. Maybe the client software does a bit of predicting on things, but it remains at the mercy of the server, and the only state it will ever be able to display is what it knows. If latency causes a client to fall behind, that''s just what happens. There is precious little you''re going to do to stop that from occurring.

Don''t worry about being incredibly precise. Figure out how to be "precise enough" and let it go at that.

If you worry too much about the (fractions of a) second that the clients might be off from the server and each other, you''ll just end up going quite mad and wasting huge heaps of time. Really.

With networked games, it easy to make things more complicated than they have to be. Resist that urge...

Samu Games

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!