[gameprogrammer] Re: timestamp for packets
- From: Roger D Vargas <luo_hei@xxxxxxxx>
- To: gameprogrammer@xxxxxxxxxxxxx
- Date: Sat, 27 Aug 2005 16:57:21 -0400
I think your first solution is better, I will try a sequence first.
Thanks for the help.
Vince wrote:
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
--
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
- References:
- [gameprogrammer] Re: timestamp for packets
- From: Vince
Other related posts:
- » [gameprogrammer] timestamp for packets
- » [gameprogrammer] Re: timestamp for packets
- » [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
-- Roger D. Vargas http://dsgp.blogspot.com | Linux, programación, juegos
--------------------- To unsubscribe go to http://gameprogrammer.com/mailinglist.html
- [gameprogrammer] Re: timestamp for packets
- From: Vince