Obviously timing is critical to a client displaying the correct state.
I have though up some simple and not so simple and high bandwidth methods of ensuring this works.
What method do you guys use?
In general is it better to use tcp so you don''t have to implement your own form of ensuring that critical packets are recieved?
Should I use TCP for game state messages and UPD for non critical updates like messaging, scores, blah?
I was thinking that ever tenth packet might be where the client sends off its current location and the nine packets in between would be containing things like ''player 4, FORWARD, JUMP''. The tenth packet would be to ensure that if something screwed up in the command delta''s to be played in the world then it would be corrected not to far in to the future. I''d also make this packet based rather than time based so that a player not moving(camping, chatting, healing,taking aim) would not be using and bandwidth. Is that a reasonable assumption
Is there anything I''m missing in the things I''ve been talking about over few days?
Hee Hee I asked this same question some time ago too 8^) Well there are proven protocols which can synchronize timmers across a network. Do a search for Network Time Protocol (NTP), that will point you in the right direction. Basicly sending a large sample of timming packets to and from the client and then perform some statsctical analysis on it to extrapalate the delta time between the client and server, and from this you can get the servers and clients times to a degree of accuracy. Would only need to be done once so overhead is negiligable.
With that solved you already won 1/15 of the battle! 8^)
If you are doing a client-server game, only the server needs to know *exactly* what time it is. The clients make do with what the server has told them about the state of the world up to the current instant in time. Maybe the client software does a bit of predicting on things, but it remains at the mercy of the server, and the only state it will ever be able to display is what it knows. If latency causes a client to fall behind, that''s just what happens. There is precious little you''re going to do to stop that from occurring.
Don''t worry about being incredibly precise. Figure out how to be "precise enough" and let it go at that.
If you worry too much about the (fractions of a) second that the clients might be off from the server and each other, you''ll just end up going quite mad and wasting huge heaps of time. Really.
With networked games, it easy to make things more complicated than they have to be. Resist that urge...