🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Time Synchronization

Started by
1 comment, last by gimp 24 years ago
I''ve just sat down to work out how to get a reasonably accurate time clock across multiple machines on a network. I don''t need terrible accuracy, in order of 0-50 ms error is tolerable. The only way I can come up with is to stamp a packet, send it to the server which appends it own time then forwards it back to the client... this somehow seems dodgy. Would anyone like to voice their opinions on how they did it? thanks gimp PS : As fun as it might be i''m not interested in implementing NTP I wan''t something REALLY easy to implement...
Chris Brodie
Advertisement
What exactly do you need to clock for? It would make a difference on how you implement the clock. However, for clock synchronization your idea isn''t bad, except that it will be off by the ping time. When you stamp the packet to send to the server, record a value and store that value with the current time on the client. When the server sends the time packet, also have it record the value. When the packet arrives the client can examine the packet for the original time it was sent and subtract out half the trip time, for a more accurate synchronization.
Have you checked out http://www.codewhore.com/
He takes you through an implementation of NTP which achives synchonization within 5ms of the server and client. It''s not too difficult to impelement. Once you achive synchonization, you can pass time critical information between the server and client, as they both have nearly identical clocks, used in dead reckoning, or any other predicitive code. Definetly check out his links sections of good article on designing your network architecture as to minimize latency.

Good Luck.

-ddn

This topic is closed to new replies.

Advertisement