Why do some games run in slow motion when they lag?

Some games move characters a fixed number of pixels every frame. At 60 frames a second that looks right, but at 30 the character covers half the ground, and at 144 it zooms. The fix is delta time: move by speed times the time the frame took. Fast or slow, every computer then moves at the same speed.

90 fps: one frame every 11.1 msTwo runners, 2 seconds. The step was tuned for 60 fps.where it should be after 2 sadds 5 px every frame450 px/s: 1.5× too fastadds speed × frame time (3.33 px at 90 fps)300 px/s on every computer
Time per frame
11.1 ms
Frame-based speed
450 px/s
Delta-time speed (any fps)
300 px/s
Frame-based ÷ intended
×1.5

Challenge: Find the frame rate that makes the frame-based runner exactly 2.4 times too fast.

More settings
px
Tuned so it looks right at 60 fps.

Play

Pick "Lagging at 30 fps" and press "Run it: race for 2 seconds." Then try the 144 Hz monitor.

Challenge: Find the frame rate that makes the frame-based runner exactly 2.4 times too fast. 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

move per frame=speed×Δt,Δt=1fps\text{move per frame} = \text{speed} \times \Delta t,\quad \Delta t = \frac{1}{\text{fps}}

A frame at ff frames per second lasts Δt=1/f\Delta t = 1/f seconds. If a game adds the same step every frame, the speed is step × fps: right at 60 fps, half at 30, and 2.4× at 144. That's a ratio, and it's tied to the computer, not the game.

The fix multiplies by the frame time:

move per frame=speed×Δt\text{move per frame} = \text{speed} \times \Delta t

Fewer frames mean bigger steps, more frames mean smaller ones, and the total per second is the same. Press "Run it" to race the two runners. The tick marks show where each frame lands.

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. Time per frame\Delta t = \frac{1}{90}\ \text{s} = 11.11\ \text{ms}
  2. Frame-based: the same step every frame, so speed rises and falls with the frame rate5 \times 90 = 450\ \text{px/s}
  3. Delta time: the intended speed times the time this frame took300 \times \frac{1}{90} = 3.333\ \text{px per frame}
  4. That always adds up to the intended speed3.333 \times 90 = 300\ \text{px/s}

Export

Export PDF

Pick the frame rate the computer actually gets. "More settings" changes the frame-based runner's step.

  • Physics engines often run at a fixed rate behind the scenes for stability, which is a different fix to the same problem.

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

Cheat card

Δt=1fps\Delta t = \frac{1}{\text{fps}}
frame-based speed=step×fps\text{frame-based speed} = \text{step} \times \text{fps}
move per frame=speed×Δt\text{move per frame} = \text{speed} \times \Delta t
SymbolMeaningUnit
Δt\Delta ttime one frame takess
fpsfpsframes per second
  • 60 fps is about 16.7 ms a frame; 144 fps is about 6.9 ms.
  • Speed × time = distance, so multiplying by the frame time turns a speed into the right step for each frame.
  • Delta time keeps speed right, but a higher frame rate still looks smoother. There are more, smaller steps.

Print this card

Where it’s used

  • Computer Science
    Game engines hand every update a "delta time" so movement, timers, and animations stay frame-rate independent.
  • Computer Science
    Video players and animations use the same idea to stay in sync whatever the device.
  • Hobbies & Crafts
    Some older console games ran faster in one country than another because TVs there refreshed at a different rate.

Questions people ask

What is delta time?

The time since the last frame. Multiplying speeds by it makes movement depend on real time instead of on how many frames the computer can draw.

Why does a laggy game sometimes slow down instead of skipping?

If it moves things a fixed amount per frame, fewer frames per second means less movement per second, so everything looks like slow motion.

Does a higher frame rate make me faster?

Not in a game that uses delta time. It just makes motion smoother. In a game that doesn't, it really can speed things up.

Updated : First published.

See everything that’s new on Maps for Math