There's a couple of questions here.
Imagine I have client A who's going to send the following message to Server: "START MOVEMENT FORWARD".
The server will not receive this message instantly, as there is a delay because of latency.
Question 1: ping (or better: round trip time) is the amount of time it takes for the client to send a message to the server and receive a response back. Does this mean the following if you can ignore the time it takes for the server to notice that it has received a message and start sending a response (this should be very short)?
- time it takes for client to send someting to server = round-trip-time / 2
- time it takes for server to send something to client = round-trip-time / 2
So, when client A sends that message, the server will supposedly receive that message round-trip-time / 2 milliseconds after the client has send the message. This leads me to the next question.
Question 2: should the client first send the package, and then wait round-trip-time / 2 milliseconds before actually executing that command client-side (in this case: move forward) to compensate with the latency/lag?
Now, the server will send the following message to all nearby players: "CLIENT A IS NOW MOVING FORWARD". These clients will then make sure that the character of client a starts moving, this leads me to the next question.
Question 3: should the client receiving the message that an other client has moved take into account that this message was send by the server round-trip-time / 2 milliseconds ago? So that the current time used for movement calculations timestamps should be reduced by round-trip-time / 2?
All these methods would in my mind make sure that synchronisation improves between clients, as latency is taken into account. Is this the right way of doing things? Do most other good multiplayer games do this? Any comments, suggestions, alternatives or random but related shouts that you'd like to give? Thanks in advance.