Netcode

On this page 7

Netcode is the networking layer of an online video game: the code that sends player inputs and world state between machines, reconciles different views of the same match and hides the delay of the internet so that play feels immediate. In gaming, the word is also used loosely by players to describe how responsive and consistent an online match feels, which is why netcode sits beside frame rate and input lag as a core factor of gaming performance.

Good netcode cannot remove physical latency, because a signal still needs tens of milliseconds to cross a continent. What it does is predict, interpolate and correct so that the delay is masked, and it decides who has authority when two players disagree about what happened.

How netcode synchronizes an online match

Netcode keeps every participant in a shared, consistent game state by exchanging small messages many times per second. Most competitive games use a client-server model, in which a server runs the authoritative simulation and each client sends its inputs and receives snapshots of the world. Some fighting games and older strategy titles use peer-to-peer connections, in which players exchange inputs directly.

The server advances the simulation in fixed steps called ticks. The tick rate, measured in hertz, defines how often the server processes inputs and sends updates. A shooter running at 64 or 128 Hz updates every 15.6 or 7.8 milliseconds, while large battle royale or MMO servers often run at 20-30 Hz to save bandwidth and CPU time.

The following table lists the parameters that shape how netcode behaves and what each one affects.

ParameterTypical rangeWhat it affects
Tick rate20-128 HzPrecision of hit registration and movement
Round-trip time10-150 msDelay before the server confirms an action
Interpolation delay1-3 snapshot intervalsSmoothness of other players’ movement
Packet loss0-2% on a healthy linkMissing updates, rubber-banding
JitterUnder 5-10 ms preferredUneven arrival of updates, stutter in motion
Core netcode parameters

Techniques that hide latency

Modern netcode relies on a toolkit of latency compensation techniques that let the local player act without waiting for the server. Each technique trades a small amount of accuracy or consistency for responsiveness, and engines usually combine several of them.

  • Client-side prediction: the client applies its own inputs immediately and simulates the result before the server answers.
  • Server reconciliation: when the authoritative state arrives, the client rewinds and replays unacknowledged inputs to correct mispredictions.
  • Entity interpolation: other players are drawn slightly in the past, between two received snapshots, so their motion looks smooth.
  • Lag compensation: the server rewinds hitboxes to the moment the shooter saw the target, which is often called favor the shooter.
  • Rollback: in peer-to-peer games, each side predicts the remote input, and on a wrong guess it rolls the simulation back and resimulates the corrected frames.

The table below compares the main approaches by where they are typically used and what side effect players notice.

ApproachTypical genreVisible side effect
Delay-based netcodeOlder fighting gamesInput feels sluggish as ping rises
Rollback netcodeModern fighting gamesBrief visual snaps on wrong predictions
Lag compensationFirst-person shootersBeing hit after reaching cover
Deterministic lockstepReal-time strategyWhole match slows to the worst connection
Snapshot interpolationMost action gamesOpponents shown slightly behind reality
Latency compensation approaches compared

Netcode versus input lag and frame time

Netcode delay is separate from local input lag, although players feel both as one sensation of sluggishness. Input lag is the time from pressing a button to seeing the result on screen on a single machine, shaped by frame time, the render queue and display processing. Netcode adds the network round trip and server processing on top, but only for actions whose outcome depends on other players.

Because client-side prediction shows local movement instantly, a well-designed game can feel crisp even at 80 ms of ping, while a game with high local input lag feels slow even on a LAN. Tools such as NVIDIA Reflex reduce the local part of the chain and have no effect on network latency.

Delay sourceWhere it occursTypical size
Input and render pipelineLocal PC or console15-60 ms
Display processingMonitor or TV1-30 ms
Network transitInternet path to server5-100 ms one way
Server tick waitGame serverUp to one tick interval
Interpolation bufferReceiving client30-100 ms
Sources of delay in an online action

Common netcode problems and their causes

Most complaints about bad netcode trace back to a small set of recognizable symptoms. Some are caused by the player’s connection, others by server capacity or design choices, and distinguishing the two prevents wasted troubleshooting.

SymptomLikely causeTypical remedy
Rubber-bandingPacket loss or server correctionUse a wired connection, check Wi-Fi
Shot not registeringLow tick rate or mispredictionHigher tick servers, closer region
Killed behind coverLag compensation for a high-ping opponentPing limits in matchmaking
Teleporting playersJitter or lost snapshotsReduce network congestion, use QoS
DesyncNondeterministic simulationDeveloper fix, resynchronization
Symptoms, likely causes and remedies

A frequent misconception is that a higher tick rate always fixes hit registration. It narrows the timing window, but an opponent with 150 ms of ping still creates disagreements that lag compensation must resolve. Another misconception is that netcode can be judged by ping alone, while jitter and packet loss often matter more than the average delay.

How developers design and evaluate netcode

Netcode design is a trade-off between responsiveness, fairness, bandwidth and cheat resistance. An authoritative server prevents clients from inventing results, which is essential for anti-cheat protection, but it costs hosting money. Peer-to-peer and rollback designs are cheaper and give low latency between nearby players, yet expose IP addresses and leave more trust with clients.

Developers test netcode under simulated adverse conditions, adding artificial latency, jitter and loss to verify that prediction and correction stay stable. Reviewers and players evaluate it by measuring round-trip time, update rate and correction frequency, and by comparing how matches feel at different pings. Transport usually runs over UDP, because a late packet is worth less than the next fresh one, and retransmission as in TCP would add delay.

Stripped to the essentials

Netcode is the part of an online game that keeps every player’s screen showing the same match. Messages between players take time to travel, so each screen is always slightly out of date. Netcode guesses what is happening right now, shows that guess, and quietly fixes it when the real information arrives.

Think of two people playing chess by mail who agree to assume the obvious next move to save time, and undo it only when the letter says otherwise. Good netcode makes those corrections rare and invisible, so the game feels as if everyone were in the same room.

Where it is applied

A studio preparing an online fighting game for a cross-regional tournament switches from delay-based netcode to rollback netcode. Under the old design, a match between players 60 ms apart added several frames of input delay, and players complained that combos felt heavy and unreliable. After the change, inputs execute locally on the next frame, and the game predicts the opponent’s action, usually by repeating the last input.

During testing with two frames of rollback and 1% simulated packet loss, mispredictions caused only brief visual corrections that most testers did not notice. Matches between distant players became playable, and the tournament organizers could run online qualifiers across a wider region without forcing players to travel.