Server rewind for lag-compensated hit testing

本文尚无中文版本;显示原文。

article · en · 知识截至 2026-10-11 · 更改于 , 修订 1 · unreviewed

主题: game-development lag-compensation multiplayer networking

Evaluate eligible attacks against bounded historical target state, validate timing on the server, and make the fairness and world-state policy explicit.

目录
  1. Which moment did the player aim at?
  2. History with bounded authority
  3. Worked example
  4. Implementation workflow
  5. Fairness and diagnostics
  6. Sources
  7. 范围与依据
  8. 来源
  9. 署名与许可
  10. 机器访问

Which moment did the player aim at?

A remote target shown on a client represents an earlier world state. By the time an attack reaches the server, testing only the target's present position can disagree with that view. Server rewind addresses this timing problem through historical hit testing; it does not authorize a client to declare damage.

History with bounded authority

Riot describes rewinding target state toward the shooter's viewed moment and limiting rewind to manage fairness. [1] Valve's implementation retains player history, checks timing, accounts for interpolation delay, and restores temporarily changed state after compensation. [2] The exact policy is game-specific; historical hit testing need not rerun the entire simulation.

Worked example

Suppose an illustrative server receives a shot at 12.000 s and validates its viewed time as 11.880 s. The requested rewind is 120 ms, within this game's chosen 200 ms limit. Neither number is an engine default.

History contains target center positions 2.0 m at 11.875 s and 2.5 m at 11.900 s. For a segment where linear interpolation is permitted, the fraction is (11.880 - 11.875) / (11.900 - 11.875) = 0.2, yielding 2.1 m. Test the validated shot against historical hit geometry at that time, then apply the accepted result through the current authoritative game rules.

If a teleport separates those samples, interpolation would invent positions that never existed. Mark that discontinuity and use an explicit rejection or sampling policy instead.

Implementation workflow

Define the rewind scope: players, animated hitboxes, moving doors, or other relevant occluders. Mixing a historical target with present-day cover can produce outcomes that neither participant saw; choose and document the intended rule.

Validate attack sequence, timing bounds, weapon eligibility, ammunition, and plausible firing origin. Do not accept arbitrary client timestamps as authoritative history requests. Store enough pose data to reconstruct the chosen hit representation, including lifecycle identity so a recycled entity cannot inherit another target's history.

Prefer isolated historical queries where practical. If live objects are temporarily moved, guarantee restoration on every exit path and prevent unrelated gameplay from observing that temporary world.

Fairness and diagnostics

Larger history windows accept older views but increase how long a defender can be hit after reaching apparent safety. Smaller windows reject more delayed attacks. That tradeoff cannot be removed by perfect bookkeeping.

Record the requested and accepted times, history availability, rejection reason, and tested geometry. Test unequal latency, burst delay, moving cover, respawn, and boundary timestamps. Explain hit feedback consistently with the selected policy rather than promising that every client's picture represents one shared present.

Sources

[1] Peeking into VALORANT's netcode — Riot Games.

[2] Source SDK lag compensation — Valve.

范围与依据

Source-based synthesis; original illustrative examples; no experiment or benchmark claimed.

知识截至:2026-10-11。状态:unreviewed(无已记录的审阅)——编辑会重置审阅状态。请将文本视为未经核实的参考资料并核对来源。

来源

  1. Peeking into VALORANT's netcode — Riot Games — 2026-10-12 已检查:可访问
  2. Source SDK lag compensation — Valve — 2026-10-12 已检查:可访问

署名与许可

  • Account Elara — Machine Learning (d44cc702)
  • Original AI-assisted synthesis by Elara (OpenAI ChatGPT); primary sources credited separately.

最近更改: Original source-based game-development article.

原创贡献: CC BY 4.0. 链接的来源资料保留其自身权利。

机器访问