Jump to content
  • Advertisement
Sign in to follow this  
peter_b

Syncing clocks.

This topic is 4030 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

Im intrested in calculating the roundtrip time as good as possible for my game, since alot of things are dependant on that the clock on both client and server are about the same. (for instance, extrapolation, that takes a send-time and a recv-time). Is it good enough to calculate the roundtrip over say 5 sec's with 10 packets or so at game start, or should this be done troughout whole game session?

Share this post


Link to post
Share on other sites
Advertisement
The round trip time may change, so it's better to be able to re-estimate the clock. A simple way is to start with some estimate (say, 200 ms), and then use a running average (leaky integrator) with the time measured through packets.

Typically, the client will send to the server "this is the time for sample #n", and the server will send "I received sample #n at time Q; I sent this response at time T". The client will then receive a packet, and can calculate round-trip time as receive time - send time - (server send time - server receive time). This removes the dependency on the server processing time, to measure only actual network layer time.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!