Why Your Bullets Don't Hit: The Invisible Science of Gaming Netcode

Why Your Bullets Don't Hit: The Invisible Science of Gaming Netcode


Every online gamer knows the feeling. You’re perfectly aimed at your opponent, you fire, and… nothing. On your screen, it was a direct hit. On their screen, you were a second too late. You didn’t lose to a better player; you lost to the laws of physics. You lost to the netcode.

Netcode is one of the most critical and least understood aspects of game development. It’s an invisible framework of prediction, reconciliation, and compromise that dictates your entire online experience. And it’s a fascinating blend of computer science and design philosophy.

The Core Problem: The Speed of Light is Too Slow

When you play an online game, you’re battling players across the city or across the world. The distance between you and the game server introduces a delay called latency, or “ping.” If you have a 100ms ping, it takes one-tenth of a second for your action to reach the server and another tenth for the result to get back to you.

In a fast-paced game, 200ms is an eternity. If the game simply waited for the server to confirm everything, it would feel like playing in mud. This is where the two main philosophies of netcode come in.

Philosophy 1: Delay-Based Netcode (The Old Way)

The traditional approach is “delay-based” netcode. To keep all players in sync, the game deliberately delays everyone’s input to match the player with the highest ping.

  • How it feels: Everyone shares the pain. If one person is laggy, everyone feels sluggish. It’s “fair,” but it feels terrible for everyone. It’s the reason you’d get kicked from a match for having a high ping—your connection was literally ruining the game for others.

Philosophy 2: Rollback Netcode (The Revolution)

The modern solution, especially for fighting games and shooters, is “rollback” netcode. It’s a philosophy built on a simple, powerful idea: “Trust the player, but verify.”

  • How it works: Your game doesn’t wait for the server. The moment you press a button, your action happens instantly on your screen. Your game predicts what your opponent will do (usually, that they’ll keep doing whatever they were doing).
  • The “Rollback”: Your input is sent to your opponent. When their game receives it, it might be a few frames “late.” Their game then “rolls back” time to the moment you acted, inserts your correct input, and re-simulates the game forward to the present in milliseconds.
  • How it feels: Magical. Your own actions are always crisp and responsive. When a rollback happens, you might see an opponent “teleport” slightly as the game corrects its prediction, but your own experience remains fluid. It prioritizes individual feel over perfect, shared synchronization.

Games like Street Fighter 6 and Valorant are praised for their incredible online feel, and it’s almost entirely thanks to their masterful implementation of rollback netcode.

The Unsung Heroes: Interpolation and Extrapolation

To smooth over the constant corrections of rollback, netcode uses clever tricks.

  • Interpolation (Lerp): If a character was at point A and is now at point C, the game doesn’t just teleport them. It smoothly animates their movement between the two known points to hide the correction from the player.
  • Extrapolation: This is riskier. The game guesses where a player is going to be based on their current velocity. It’s what leads to the classic “I shot where he was, not where he was going!” problem. Good netcode minimizes extrapolation.

Why Isn’t All Netcode Perfect?

If rollback is so good, why doesn’t every game use it?

  1. Complexity: It’s incredibly difficult to implement correctly. A bad rollback implementation can feel worse than a stable delay-based one.
  2. Player Count: Rollback is ideal for 1v1 games. In a 100-player battle royale, rolling back and re-simulating the entire game state for every player’s input is computationally impossible. These games use a hybrid “server-side authority” model, which is why you still experience moments where what you see isn’t what the server registered.

The next time you miss a shot you were sure you made, don’t blame your skills. Take a moment to appreciate the invisible, complex, and fascinating science of netcode that’s trying, against the odds, to bend the rules of spacetime for your entertainment.