Hmm from what I read here in this forum section, it is highly discouraged to measure time using seconds/miliseconds, instead use ticks for synchronization. I wonder what does it really mean, since synchronization involves ping time, and it is measured with miliseconds. I recently read the valve network synchronization technique, however I cannot seem to fully grasp it as a whole.
From what I can swallow of those huge wall of texts, I think this is how it was implemented.
1. When the game start, the server sends me the "Tick number" (assume it's 0). The server increase this number every time it do simulation update.
2. I receive it. I, too will increase this number every local simulation update.
3. Assume the server and client update rate is 10 fps, which is 100 ms between each tick. Between those tick I collect user input, and of course I include the current tick number. Of course I do read packets from server, but let's not focus on that. The server is doing almost the same thing on his side (read, simulate, send) every 100 ms.
4. Assume it's 100 ms since last tick. Now it's time to update. Me (client), simulate locally using those buffered input. Then directly I send those buffered input to server.
5. Server receives it, perhaps 200 ms later. It reads the client input. However, it must be too late. The server's tick number will almost always be bigger than the client. In server, the tick number currently could be 12, while the tick number included in client packet was 10.
Now, I got several questions :
1. Well, now that there's unmatching tick number, what should the server do? I got the notion that there should be some kind of "rewind and replay" stuffs. But who does it? the server or the client?
2. Assume that at the client's step no. 3, the client press forward and quickly press left. Since this is UDP, I'm sure the packets could be received by the server not in order. Should the client be using reliable/ordered send for input?
Thanks before, I'm trying to make a multiplayer pong, so it's quite relevant. Pong is kinda twitch based, don't you agree ;)