Lag (video games)

In computers, lag is delay (latency) between the action of the user (input) and the reaction of the server supporting the task, which has to be sent back to the client.

The lowest ping physically possible for a connection between opposite points on Earth crossing half of the planet is 133 ms. Other causes of lag result commonly in a lag below a playable 20 ms (50 hz or fps), or in the loss, corruption or jitter of the game.

For instance, if someone is in India, playing on a server located in the United States, the distance between the two is greater than it would be for players located within the US, and therefore it takes longer for data to be transmitted, resulting at 20,000 km (half way around the Earth) in a ping of 133 ms.[5] However, the amount of packet-switching and network hardware in between the two computers is often more significant.

As all clients experience some delay, implementing these methods to minimize the effect on players is important for smooth gameplay.

Lag causes numerous problems for issues such as accurate rendering of the game state and hit detection.

If synchronization is not possible by the game itself, the clients may be able to choose to play on servers in geographical proximity to themselves in order to reduce latencies, or the servers may simply opt to drop clients with high latencies in order to avoid having to deal with the resulting problems.

There is nothing that prevents a player from modifying the data they send, directly at the client or indirectly via a proxy, in order to ensure they will always hit their targets.

In online games, the risk of cheating may make this solution unfeasible, and clients will be limited to sending relative states (i.e. which vector it moved on or shot in).

While the server may ultimately keep track of ammunition, health, position, etc., the client may be allowed to predict the new server-side game state based on the player's actions, such as allowing a player to start moving before the server has responded to the command.

Problems will arise only in the case of high delays or losses, when the client's predictions are very noticeably undone by the server.

Sometimes, in the case of minor differences, the server may even allow "incorrect" changes to the state based on updates from the client.

The main purpose of server-side lag compensation is instead to provide accurate effects of client actions.

[11] A very explicit example of this is hit detection for weapons fired in first-person shooters, where margins are small and can potentially cause significant problems if not properly handled.

Another way to address the issue is to store past game states for a certain length of time, then rewind player locations when processing a command.

In the worst case, a player will be so far behind that the server runs out of historical data and they have to start leading their targets.

Cutting compensation off immediately prevents victims from posthumously attacking their killers, which meets expectations, but preserves the natural advantage of moving players who round a corner, acquire a target and kill them in less time than a round trip to the stationary victim's client.

This method is avoided if at all possible due to its susceptibility to cheating: it is a simple matter to route network data through a second computer which inserts fabricated hit messages or modifies existing ones, a technique which cannot be detected by anti-cheat tools.

[13] This produces incorrect results unless remote players maintain a constant velocity, granting an advantage to those who dodge back and forth or simply start/stop moving.

On the other side of this problem, clients have to give remote players who just started moving an extra burst of speed in order to push them into a theoretically accurate predicted location.

Techniques include playing client-side animations as if the action took place immediately, reducing/removing built-in timers on the host machine, and using camera transitions to hide warping.

Depending on the skill and experience of the player, this can cause disorientation and confusion similar to Delayed Auditory Feedback and hampers navigation and aiming in the game world.

When rapidly inputting a long combination move, the on-screen character will not be synchronized with the button presses.

Many western players, professionals and amateurs alike, often type "kale" instead of "lag" in in-game chat and Twitch.

A simplified game architecture