How do you optimise UDP packet loss for a high-tickrate competitive shooter?
Analyse approaches to mitigating packet loss in a fast-paced UDP environment, focusing on forward error correction and redundant data.
What the interviewer is scoring
- That they understand the difference between TCP retransmission and UDP forward error correction.
- Whether the candidate can identify scenarios where redundant state is superior to explicit acknowledgements.
- Does the candidate recognise the bandwidth trade-offs of sending duplicate data in high-tickrate games?
- Whether they evaluate the impact of latency spikes on player experience and hit registration.
- Whether the candidate appreciates the necessity of jitter buffers and their sizing in competitive environments.
Answer
Short answer
Analyse approaches to mitigating packet loss in a fast-paced UDP environment, focusing on forward error correction and redundant data.
Operating a competitive tactical shooter at a 128Hz tickrate across hostile residential Wi-Fi networks guarantees 5% to 10% packet loss and vicious jitter. Maintaining pristine hit registration and fluid movement in this environment is a brutal exercise in mitigating unreliable networks. TCP is an immediate non-starter; its head-of-line blocking and retransmission algorithms generate latency spikes that destroy the player experience.
Treat this as a netcode problem before treating it as a generic networking problem. Good netcode decides which packets are state, which are events, and which can be dropped without harming the player experience. Weak netcode tries to make every UDP message reliable and recreates TCP badly. Strong netcode accepts loss, sends fresh state often, and designs correction so the game feels stable even when the network is not.
Why reinventing TCP over UDP fails at 128Hz
The instinct of an inexperienced network engineer is to reinvent TCP over UDP by building complex, bespoke acknowledgement and retransmission protocols. They assume that recovering dropped packets via explicit requests is the only way to maintain synchronized state.
In a 128Hz environment, this is mathematically bankrupt. By the time a dropped packet is detected, acknowledged as missing, and retransmitted across a standard internet route, the game state has advanced by dozens of ticks. The recovered data arrives hopelessly obsolete, forcing the client into aggressive and visually jarring rubber-banding. Real-time simulation cannot pause to wait for history.
Redundancy circumvents retransmission
The correct architecture sacrifices bandwidth to guarantee low-latency state delivery. Data timeliness is infinitely more valuable than data completeness. The system must utilize aggressive redundancy: every UDP datagram contains not just the current tick's inputs, but the unacknowledged data from the previous N ticks.
By tuning N to match the expected round-trip time, a single dropped packet becomes irrelevant. The subsequent packet implicitly delivers the missing state. This approach must be aggressively optimized to respect the standard 1500-byte Ethernet MTU limits. Exceeding this boundary triggers IP fragmentation, which catastrophically magnifies packet loss, as a single dropped fragment invalidates the entire reconstructed datagram.
flowchart TD
A["Client Input Generation"] --> B["Buffer Recent Inputs"]
B --> C["Construct packet transport Packet (Ticks T, T-1, T-2)"]
C --> D{"Network Delivery"}
D --> |"Packet Lost"| E["Packet T Dropped"]
D --> |"Packet Arrives"| F["Packet T+1 Arrives"]
E --> F
F --> G["Extract Missing Data for Tick T"]
G --> H["Apply State Update and Rollback"]Jitter buffers and deterministic rollback
For severe loss events—such as contiguous blocks of dropped packets—Forward Error Correction (FEC) provides a mathematical fallback. Grouping packets and transmitting XOR parity data allows receivers to reconstruct missing states without network round-trips. This FEC block size must be dynamically tuned against real-time connection telemetry to avoid suffocating stable connections with unnecessary overhead.
Additionally, arrival variance dictates the necessity of a dynamic jitter buffer. A larger buffer absorbs network instability at the cost of baseline latency. Exposing this trade-off allows competitive players to choose between visual fluidity and raw input response. When out-of-order or recovered packets finally arrive, the server must seamlessly rewind the simulation, insert the historical input, and deterministically resimulate back to the present tick. Cryptographically secure sequence numbers must be rigidly enforced to prevent malicious clients from exploiting this rollback engine for replay attacks.
The core insight is that in high-frequency realtime simulations, data timeliness supersedes data completeness. You mitigate packet loss not by asking for missing data, but by proactively sending redundant state and error correction codes within MTU limits, accepting slightly higher bandwidth usage in exchange for guaranteed low-latency state reconstruction and deterministic rollback execution.
© 2026 Preptima. Originally published at preptima.com.
Likely follow-ups
- How would you size the FEC block length if packet loss occurs in bursts rather than uniformly at random?
- What changes in your redundancy strategy if players are on asymmetric connections with very different upload and download loss rates?
- How do you prevent a malicious client from exploiting the rollback and resimulation path to desync other players?
Related questions
- How do you design a global skill-based matchmaking system that prevents grandmasters from stomping novices without making them wait in a 20-minute queue?hardAlso on game-server3 min
- How do you optimise Java Virtual Machine (JVM) garbage collection to eliminate tail latency spikes in a game server?hardAlso on game-server3 min
- When would you choose deterministic lockstep over an authoritative server, and what does each model cost you?hardAlso on netcode5 min
- Walk me through what rollback netcode does on a single frame, and what it costs to run it.hardAlso on netcode5 min