[EN_0102] HowTo - Lags, Low FPS, Lag Compensation
Posted by Henry S. on 22/02/17 11:02
HowTo - Lags, Low FPS, Lag Compensation
Many players refer to any performance problem in an online game as “lag.” But if your computer’s frame rate is low, that isn’t the same thing as lag – lag and low FPS are different problems with different causes.
Low FPS is a Computer Problem
Low frames per second (FPS) appear as your entire game behaving slowly. If your frame rate is low enough, playing the game may feel like watching a slideshow as only a few different frames appear on your screen per second. In less extreme cases, the game will feel jerky and slow – just the opposite of smooth.
Frame rate issues aren’t caused by network problems. If you have a low frame rate, that’s not the game experiencing lag – that’s your computer failing to keep up with the game. You may need a faster graphics card, more RAM, or a better CPU. Your hard drive may be too slow, causing the game to slow down as it’s forced to read data from your hard drive. You may have too much junk software running in the background, competing for resources.
In other words, low FPS is a problem with the game’s performance on your computer. It doesn’t have anything to do with your network connection.
Lag is a Network Problem
Lag isn’t a result of a problem with your computer; it’s a result of a problem with your network. It may be a result of the game’s servers experiencing problems, but it’s also likely that a network problem is occurring somewhere between your computer and the servers. If you’re far away from the game’s servers – perhaps you’re in Europe playing a game on North American servers – your latency (often referred to as your “ping” time) may be high. (Learn more about latency here.)
Low FPS and Lag are Sometimes Linked
Low FPS and lag sometimes show up at the same time, complicating things. For example, if you’re playing a massively multiplayer online RPG (MMORPG) and your character is standing in a major city with hundreds of other characters running around on your screen, you may experience both low FPS and lag. The lag occurs because the server is struggling to keep up and slowing down with so much happening in one place at once, while the low FPS is a result of your computer struggling to draw all those characters on your screen at once.
In this case, low FPS and lag have the same cause – more people than the game can handle in one place at the same time – which may confuse some gamers into thinking they’re the same thing. But they’re not – the large number of players is causing both performance problems on your computer (low FPS) and network issues (lag).
Why You Should Care
If you understand the difference between lag and low FPS, you can identify problems and have a better shot at fixing them.
If you’re experiencing low FPS, your computer’s hardware just can’t keep up (or you have too much junk software running in the background) and you can fix it by upgrading your computer’s hardware (or reducing the game’s graphical settings).
If you’re experiencing lag, that’s a network problem. You may need to wait for the situation to improve, switch to a closer server, or fix problems on your local network.
Lag compensation is a function on the server which attempts to reduce the perception of client delay.
Without lag compensation (or with poor lag compensation), you would have to lead your target in order to hit them, since your client computer is seeing a delayed version of the game world. Essentially what lag compensation is doing, is interpreting the actions it receives from the client, such as firing a shot, as if the action had occurred in the past.
The difference between the server game state and the client game state or "Client Delay" as we will call it can be summarized as: ClientDelay = (1/2*Latency)+InterpolationDelay
An example of lag compensation in action:
The server then looks into the past (into a memory buffer), of where player B was at the time player A took the shot. In a basic example, the server would go back (Xms+Player A's interpolation delay) to match what Player A was seeing at the time, but other values are possible depending on how the programmer wants the lag compensation to behave.
The server decides whether the shot was a hit. For a shot to be considered a hit, it must align with a hitbox on the player model. In this example, the server considers it a hit. Even though on Player B's screen, it might look like hes already behind the wall, but the time difference between what player B see's and the time at which the server considers the shot to have taken place is equal to: (1/2PlayerALatency + 1/2PlayerBLatency + TimeSinceLastTick)
In the next "Tick" the server updates both clients as to the outcome. Player A sees the hit indicator (X) on their crosshair, Player B sees their life decrease, or they die.