Why do fast bullets sometimes go through walls in video games?

Games don't move things smoothly. They jump them forward once per frame, by the speed divided by the frame rate. A bullet at 3,300 pixels per second in a 60 fps game jumps 55 pixels each frame. If the wall is only 16 pixels thick, the bullet can land in front of it one frame and past it the next.

80 px per frame at 30 fps (one frame every 33.3 ms)each square is where the bullet is on one frame · the game only checks those spotswall, 24 px thick0123456Always hits below 720 px/s (wall thickness × frame rate).Fix: 4 smaller steps per frame, or check the whole path.
Jump per frame
80 px
Fastest speed that always hits
720 px/s
Substeps per frame to fix it
4

Challenge: Make a bullet tunnel through even at 120 fps or higher.

px/s
More settings
px

Play

Press "Run it, frame by frame" on the fast bullet and watch it hop over the wall. Then try 240 fps.

Challenge: Make a bullet tunnel through even at 120 fps or higher. The box under the picture turns green when you get it.

Stuck? Pick one of the examples from the “Try an example” menu, or press “New example.”

Understand

step=speedframe rate\text{step} = \frac{\text{speed}}{\text{frame rate}}

A game draws the world many times a second. Between frames, everything jumps forward by its speed divided by the frame rate:

step=speedframes per second\text{step} = \frac{\text{speed}}{\text{frames per second}}

That's a ratio, and it's the whole problem. The game only checks for a hit at the spots where the bullet lands. When the step is bigger than the wall, one frame can be in front of the wall and the next one behind it, so the hit is never seen. Press "Run it, frame by frame" to watch the bullet hop.

Use

Every input has a unit menu, so you can type values in the units you already have. Results follow your units.

Show the work

  1. Each frame, the game moves the bullet by its speed divided by the frame rate\text{step} = \frac{2400}{30} = 80\ \text{px}
  2. It only checks for walls at those spots: 0, step, 2 × step, …0,\ 80,\ 160,\ 240,\ \ldots
  3. Any speed up to wall thickness × frame rate can never skip it24 \times 30 = 720\ \text{px/s}
  4. Substeps needed to make every step shorter than the wall\left\lceil \frac{80}{24} \right\rceil = 4

Export

Export PDF

Set the bullet's speed and the frame rate. "More settings" changes the wall's thickness.

  • This treats the bullet as a point. A real bullet's own size helps a little, like making the wall thicker.

For learning and estimation. Verify with applicable codes, standards, and a qualified professional before using in design, construction, or safety-critical work.

Cheat card

step=speedfps\text{step} = \frac{\text{speed}}{\text{fps}}
always hits if speed≤thickness×fps\text{always hits if speed} \le \text{thickness} \times \text{fps}
substeps=⌈stepthickness⌉\text{substeps} = \left\lceil \frac{\text{step}}{\text{thickness}} \right\rceil
SymbolMeaningUnit
speedspeedhow fast the bullet movespx/s
fpsfpsframes per second
  • Doubling the frame rate halves the jump per frame, so higher fps makes tunneling rarer.
  • Thin walls and fast objects are the danger. That's why games often make walls thicker than they look.
  • The fix is to check the whole path between frames, not just the landing spot.

Print this card

Where it’s used

  • Computer Science
    Game engines like Unity and Unreal have a "continuous collision" setting just for fast objects.
  • Physics
    Science simulations face the same problem and shrink the time step for fast-moving particles.
  • Hobbies & Crafts
    Speedrunners use tunneling glitches to clip through walls on purpose.

Questions people ask

What is tunneling in a game?

When a fast object passes through something solid because no frame ever catches it inside. It jumps from one side to the other between checks.

Does a higher frame rate fix it?

It helps, because each jump gets shorter. But a fast enough bullet can still tunnel, so games also check along the path.

How do games stop it?

They split each frame into smaller steps, or trace a line from where the object was to where it is now and check that line for walls.

Updated : First published.

See everything that’s new on Maps for Math