The real world doesn’t have lag. If you shoot a moving target with accurate aim at a firing range, the bullet hits the mark. If you miss, it’s either your fault, or something wrong with the gun/environment. You can’t cheat physics. While trying to replicate this scenario on a game server, you want to make the simulation as real as possible. First Person Shooter (FPS) games are particularly crucial since they demand accuracy and quick reflexes. There’s only one problem – the virtual world is not lag free. Which means whatever you see is slightly delayed. That guy on your screen is actually a few steps ahead of where he appears to be. If this was all there was to it, online FPSs would be doomed. And this is where lag compensation comes in.

What is Lag Compensation?

Lag as measured in milliseconds, can vary greatly. If you play on a server located in your own country, it can be really low – around 40 ms for example. This is not just a function of the distance, but also the capacity of the servers, your Internet connection etc. The holy grail is of course playing on LAN, where the latency is negligible.

But if your server is located in another country, it can get really long. Hundreds of milliseconds are not uncommon. Needless to say, this can be disastrous for FPS games, and the goal is to keep it as low as technically possible. But even with low latencies, FPS games would be terrible if it wasn’t for the fact that game servers compensate for lag.

The Game is Different for You and the Server

It all boils down to the fact that what you see and what the server sees is different. The entire game world is “shifted” slightly by a factor that depends on your latency. So for example, here is a recent famous picture of a Counter-Strike: Global Offensive game, where the position of the enemy is different depending on who is viewing it:

How can the server compensate for lag?

In this case, the server sees red, and the player sees blue. This was taken from the recording of a player called “tarik”, as revealed in a recent reddit thread. Obviously this is incredibly frustrating and unfair – especially in an FPS game with no automatic targeting. If you can’t rely on your skill, then what can you rely on?

How can the Server Compensate for Lag?

The obvious answer is that the server measures the average latency of the client, and “rewinds” time backwards to see whether or not the person was aiming correctly at where the image would have been visible for them. This involves a lot of variables including the server tickrate, which measures the speed at which the game server updates per second. This particular server in the image above was operating at a tickrate of 128 times per second. That’s pretty high!

As for what happens between those intervals, the server uses a method called interpolation – basically using an algorithm to calculate the state of the world between the times when information is available to it. The above screenshot was used as the starting point for a debate on whether or not the interpolation of the server was broken. According to one redditor, the “miss” can be explained by weapon inaccuracy, since the actual point of impact depends on a spread around where the crosshairs are targeting.

It Works Most of the Time

Human reflexes being what they are, 128 (or even 64) refreshes per second is pretty good most for the overwhelming majority of cases. The above is an example of an “edge” scenario where it’s not clear why the miss took place. Was it due to the lag fluctuation of an individual packet? The weapon inaccuracy spread? A bug in interpolation at the server end? Or perhaps the interpolation algorithm wasn’t good enough to accurately track the actual trajectory.

We probably won’t know. But the fact that this single instance is getting so much attention is proof of how rare an even it actually is. For the most part, servers do a magnificent job of delivering accurate results to us gamers.

tracking pixel

Is your website slow?

Enter its URL below to find out now:

About the Author

Bhagwad Park

Leave a Reply

Your email address will not be published. Required fields are marked *