[gameprogrammer] Re: timestamp for packets

I wouldn't think that the client or the server would
need to know exact times, just which out of a series
of packets came first.  You could allocate an int for
packet sequence and just compare on the other end, but
eventually your counter would have to roll over.
If your gameplay is really time sensitive you could
have a syncing routine where you trade timestamps and
compensate for latency until the server and client
timestamps match within a margin of error.

At that point it might also be a good idea to
occaisionally pass syncing packets to compensate for
any clock drift.

To sync the client and server you could send a sync
packet which should have space for two timestamps.  As
soon as the client receives it, it should mark its
time and send it back.  At this point the server can
calculate how much time has passed since the packet
was sent and prepare an estimated adjustment to send
to the client.  Your margin of error would be about
half of the ping from client to server, which in most
cases shouldn't be that bad.

This is all speculation mind you, I've only used tcp
in any depth.  I might experiment with it if I get
time, but please keep us posted on what you end up
doing.

Vince~

--- Roger D Vargas <luo_hei@xxxxxxxx> wrote:

> Chatting yesterday with a frend, he told me I must
> implement some way to 
> control the arrival time of packets, like a
> timestamp, to make sure that 
> some packet B sent after packet A, doesnt gets
> processed before packet 
> A. But I havent figured out a way to keep an uniform
> time between the 
> server and the client. Can somebody give me an idea
> about this?
> -- 
> Roger D. Vargas
> http://dsgp.blogspot.com | Linux, programación,
> juegos
> 
>               
> ______________________________________________ 
> Renovamos el Correo Yahoo! 
> Nuevos servicios, más seguridad 
> http://correo.yahoo.es
> 
> 
> ---------------------
> To unsubscribe go to
> http://gameprogrammer.com/mailinglist.html
> 
> 
> 



                
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 


---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: