Say there are two clients connected to an authoritative game server, using input + state synchronization strategy. Client 1’s has a round-trip latency of 100ms and client 2 with 400ms latency. For now just imagine each player controls a ball that can collide and bounch off each other.
- Client 1 executes command at t = 100 ms, proceeds with prediction for next 100ms (however many steps depending on timestep and framerate)
- Client 2 also executes command at t = 100ms, proceeds with prediction for the next 400ms (or capped at some max prediction timestep)
- Server receives client 1’s commands for the next t = 100ms + dt, simulates up to t = 100ms + dt
Say server’s simulation is now at t = 500ms, and client 2’s command for t = 100ms just arrived. In this case I can think of two things to do:
a. Rewind simulation back t = 100ms and re-simulate back to t = 500ms, if client 1 was affected by client 2’s command (such as collision) send correction to client 1. The results are that:
To client 2, everything looks fine
To client 1, his movement constantly rewinds bottlenecked by client 2 as long as client 2 is affecting client 1
b. Simulate client 2’s command as if it was executed at t = 500
- To client 1, everything looks fine
- To client 2, his motion is constantly corrected (either jerky or the interpolation creates strange movements)
With this method you can really only have smooth gameplay for one person. Are there better methods for smoothing out the gameplay for all players? I understand that for FPS you can easily compensate for the the bullet latency because you don't actually see the bullet. But in the case where physics collision can occur between players this becomes troublesome.
Another idea that I have is spawning of a lava pit that is instant death for players. Lava pit spawning done using client side predication can instant kill the player and sync the state later, resulting in smooth gameplay for the client. But if the other player is lagging it will appear as if he is still standing in the pit (or with full prediction will kill him but he’s not actually dead). How do games handle cases like this?