Fixed timestep
Run physics in equal slices, whatever the frame rate.
Physics with a variable step gives different results on different machines: jump heights change, fast objects tunnel, and replays desync. Running physics in fixed slices (say 1/60 s) using an accumulator, and drawing an interpolated position between slices, keeps simulation identical and motion smooth.
Try this: Pick 20 fps and jump: the variable-step ball jumps to a different height each time. The fixed-step ball always peaks at the line.
variable stepfixed 1/60 s step
Jump at different frame rates.
Prompt bit
Works for 2D or 3D in any engine (Unity, Unreal, Godot, web). Paste the short one for a quick fix, or the detailed one when you want it done properly.
Run physics on a fixed timestep: accumulate frame delta time, step the simulation in slices of 1/60 s while the accumulator allows, render by interpolating between the last two physics states, and cap catch-up at 5 steps per frame so a slow frame cannot spiral.
Move gameplay physics to a fixed timestep (2D or 3D, any engine; Unity FixedUpdate, Godot _physics_process and Unreal substepping are this). Keep an accumulator: each frame add the clamped frame delta (max 0.25 s); while accumulator >= fixedDt (default 1/60 s), save the previous state, run one physics step with fixedDt and subtract. Cap the steps per frame (default 5) and drop the remainder if hit, so a slow frame cannot cause a spiral of death. Render with alpha = accumulator / fixedDt, drawing lerp(previous, current, alpha) so motion is smooth on 144 Hz screens. Put movement, forces, collisions and anything that must be deterministic in the fixed step; read input every frame and apply it in the next fixed step without losing presses. Camera follow uses the interpolated position. Never multiply fixed-step code by the frame delta. For networking or replays, also use a fixed-seed random number generator.
Where it's used
- Platformers: identical jump arcs on every machine
- Physics games: stable stacking and joints
- Multiplayer and replays: deterministic simulation
- Racing and sports: consistent handling
- Fighting games: frame-exact timing
Common mistakes
Moving physics objects in the render update (stutter and tunneling), no interpolation so motion judders at high refresh rates, uncapped catch-up steps that freeze the game after a hitch, and losing button presses that happen between fixed steps.
Writing this with an AI assistant? See our best AI coding assistants for game developers.
Missing a concept? Request one.



