   Timestamping
  Hi, I am coding a multiplayer game and I will start to implement timestamping soon.But I have a quick question, in which variable types should these timestamps be keeped? Because my packets aren't so long and if I add a variable that costs 8 byte it will "overload" my packets(even a 4 byte will make my packet size grow to its 150%).What is the common way of doing this?Also I am thinking of using a new time type which is (ms/2) so I can at least make my program run twice as much =). And 1 ms isn't a big deal imo.If I somehow reset the time with synchronisation, I think there will be a lot of work to be done with the packets that have been sent AS I reset the general time.Thanks   
Quote:Original post by EralpHi, I am coding a multiplayer game and I will start to implement timestamping soon.But I have a quick question, in which variable types should these timestamps be keeped? Because my packets aren't so long and if I add a variable that costs 8 byte it will "overload" my packets(even a 4 byte will make my packet size grow to its 150%).If your packets are that small, you should probably be packing them together to send in a group, rather than one at a time. UDP has a header size of around 28 bytes (that's the IP header + UDP header) on average (sometimes more) so if your payload is only 16 bytes or whatever, you've got 200% overhead in the UDP headers alone...Also, most of the time, you don't really care about the actual time, you just need something to synchronize on, so a monotonically incrememnting 16-bit value might work as well.   ;  If timestamp is milliseconds, you could first sync up with a 4 byte integer. Once client and server are synchronized, using a 2-byte integer of the lowest 16 bits is plenty, as long as there will not be more than 60 seconds of jitter (and you assume that time can't move backwards). A single byte is too little, though, because 256 milliseconds of jitter would throw you off.If the timestamp is game ticks, and each game tick is larger (say, 20-30 milliseconds), then a single byte for the lowest bits of the timestamp would probably be sufficient for most cases.