Lag compensation

From Team Fortress Wiki
Revision as of 02:44, 2 October 2025 by Fisherboy800 (talk | contribs) (Update history: mc)
Jump to: navigation, search
Stop lagging and start tagging, men!
The Soldier

Team Fortress 2, being a Source Engine game, is generally configured to make use of lag compensation. Lag compensation is most commonly the technical reason behind cases of kills or actions that would otherwise seem infeasible in given circumstances; for example, when players perceive themselves to have been "shot through a wall" by a Sniper, backstabs being performed at the incorrect angle (known as facestabs), or otherwise missing entirely (known as failstabs).

When a high-latency (high-ping) player attacks, the server temporarily "rewinds" its copy of the action in order to compensate for their lag. For example, the enemy Sniper shoots when he sees your head, at that moment you and most other players may believe you successfully ran behind a wall. When the server receives the fire message from the Sniper, it "rewinds", finds out if you had ought to have been hit, and then deals damage, leading to the appearance of being "killed through a wall".

This system is an intentional trade-off designed to maintain the fairness of attacks at the cost of making damage reception feel less immediate. Without lag compensation, attacks that appear to hit but fail to register, especially in the case of melee weapons, would occur more frequently.

Exceptions

Projectile weapons such as rockets, grenades, syringes, and flares are not lag-compensated. The Pyro's compression blast and Flame Thrower are also not lag compensated, despite the effects appearing immediately after firing on a player's screen. This makes Pyro an increasingly difficult class to play at higher latencies.

Spectators do not have lag compensation. If you are spectating someone in first person, you are not seeing exactly what they are seeing, rather you are looking at what the server is seeing. This is especially noticeable with high-latency Snipers, where you should expect to see unusual shots that may appear to miss or jerk about from your perspective.

Update history

December 16, 2011 Patch
  • Fixed an exploit with The Eureka Effect and The Phlogistinator where the effects could activate without taunting in high-lag situations

September 10, 2014 Patch #1

  • Fixed push triggers applying push values twice when lag compensation is being done

August 29, 2016 Patch

  • Fixed the Short Circuit causing lag compensation problems on the server

March 28, 2018 Patch (Blue Moon Pack)

  • Lag compensation system will now reliably restore pose parameters responsible for animation layering
    • This makes server-side hitboxes for lag compensated players better match client-side rendered models

July 7, 2022 Patch

  • Fixed lag compensation when melee-ing teammates

December 6, 2022 Patch

July 18, 2024 Patch #1 (Summer 2024 Update)

  • Fixed Gunslinger punch combo not being lag compensated (community fix from Marxvee)

See also

External links

See the following links for in-depth technical explanation of how lag compensation works in the Source Engine: