How does lag compensation really work?

by Petro Koval   Last Updated January 13, 2018 09:13 AM

I am curious about the details of lag compensation in games. I have read a lot of articles about it, for example:

1: (https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking#Lag_compensation)

2: (http://www.gabrielgambetta.com/lag-compensation.html)

3: (https://www.cakesolutions.net/teamblogs/how-does-multiplayer-game-sync-their-state-part-2)

And i have some questions:

1) Okay, so the player A sends the command to move at 10.5 time, it arrives at server at 10.6, so now the server needs to rewind time, set the players to their positions at 10.5 and then process the input from the player A. BUT the player will always move, shoot, jump and this means that the server always needs to rewind EVERY TIME it receives the input from the player. Isn't it wasteful? It will cost a lot of resources, right? Or am i thinking wrong?

2) At the 1 link the guys from valve give me that formula to compute the time when the command should be executed: Command Execution Time = Current Server Time - Packet Latency - Client View Interpolation. But on the 3rd site the author says that the client sends the Command Execution Time and the server does not need to use that complicated formula to calculate something that the client can give the server for free. I mean, the player will always send the correct info about Command Execution Time, so server can believe him.

3) Give me other resources or examples with lag compensation, please.



Related Questions


Networked projectiles in an authoritative server

Updated June 23, 2016 08:05 AM