[MUD-Dev] Synchronizing Client and Server...

Dan MacDonald danmac at windows.microsoft.com
Thu Mar 7 14:15:57 CET 2002


Here's the problem, essentially I want my Client and Server machines
to be in sync as they are participating in a real time simulation.
The clients need to be able to render the state of the simulation
based on predicting (loosely) what the next steps will be until the
server sends it the next update. In order to do this, the client and
sever need to have synchronized times or agreed on a time.
 
For example, if a ball is moving across the clients screen, the
server send a packet with Xpos,Ypox,Xvelocity,Yvelocity, atTime
T. If the server sends the packet at time 1 and the client receives
it at time 2, in order for the client to correctly place the ball on
the screen, it must extrapolate the amount the ball would have moved
between time 1 and time 2 and render it correctly on the screen. If
the client and server have different values for time 1 then things
get messed up fast.
 
My current implementation uses UDP, and I'm looking for a way to
determine the difference between the server time and the clients
time.  So that the client can have a variable that says, "Add x to
the current client time when comparing with times from the server" I
want to be able to determine what x is. SNTP does this pretty well,
but i dont want to be dependant on other tecnologies, i'd like to
build this functionality into my networking layer. I was wondering
if anyone had any hacked down versions that could be used to synch
time up to about 3-5ms accuracy? Or any suggestions as to how this
might be achieved?  (besides sending X amount of upd packets and
averaging the round trip times to predict the offset)
 
thanks
    Dan
_______________________________________________
MUD-Dev mailing list
MUD-Dev at kanga.nu
https://www.kanga.nu/lists/listinfo/mud-dev



More information about the mud-dev-archive mailing list