Fixed timestep game loop and integration
Advance physics in constant-size steps from a time accumulator, then interpolate rendered state between the last two steps so simulation stays deterministic while display frame rate varies.
Also known as fix your timestep, semi-fixed timestep, accumulator loop
In the family Simulation & animation, numerical integration
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | None found | |
| Babylon.js 9.38.0 | Built in | physicsEngine.setTimeStep(1 / 60) and physicsEngine.setSubTimeStep(ms) in Physics v2 docs |
| Godot 4.7 | Built in | Node._physics_process(delta); Project Settings > Physics > Common > Physics Ticks Per Second docs Fixed-rate physics tick; physics_jitter_fix controls frame-time smoothing. |
| Unity | Built in | Project Settings > Time > Fixed Timestep; MonoBehaviour.FixedUpdate docs |
| Unreal 5.7 | Built in | Project Settings > Physics > Substepping docs Physics sub-stepping into fixed steps; the frame loop itself is variable-rate. |
| Blender 5.2 | Not applicable | No game loop; rigid body uses substeps per frame. |
| WebGPU W3C | None found | |
| Metal | None found |
How it works
The loop measures wall-clock time per rendered frame, clamps it to a maximum (to avoid the spiral of death where slow frames demand more steps that make the next frame slower), and adds it to an accumulator. While the accumulator holds at least one step dt, the simulation advances by exactly dt and dt is subtracted. Because every step has identical length, results do not depend on frame rate, integrators such as semi-implicit Euler, Verlet or RK4 keep their stability limits, and recorded inputs replay identically. After stepping, the leftover fraction alpha = accumulator / dt describes how far the display time is between the previous and current states. The renderer blends those two stored states with alpha, which removes the temporal stutter that a fixed step otherwise causes when it does not divide the display rate. Variants run several substeps inside each step, or drive the simulation from the audio or network clock.
When to choose it
Reach for it when
- physics behaves differently at different frame rates
- simulation explodes when a frame takes too long
- motion judders even though physics runs at fixed rate
- need deterministic stepping so replays match exactly
Choose it for any physics, particle or gameplay simulation where stability, determinism or networking replay matter. Prefer plain variable-dt stepping only for purely visual effects that tolerate drift, such as small Particle systems updates. It underpins Verlet integration with relaxation constraints, Extended Position-Based Dynamics, Sequential impulses (rigid bodies) and Position Based Dynamics, whose stiffness and iteration counts are tuned for a fixed dt. Use substepping (as in Extended Position-Based Dynamics small-step solvers) instead of a smaller global step when only the solver needs more resolution.
Field marks
- Spiral of death when a step costs more than dt of real time, unless frame time is clamped
- Temporal aliasing and judder if the render state is not interpolated and dt does not divide the display period
- Interpolating between states lags rendering by up to one step, which matters for input latency in competitive games
- Interpolation of rotations or wrapped values needs slerp or angle handling, not component-wise lerp
- Floating-point accumulation in the accumulator drifts if stored as float seconds over long sessions
Presets
60 Hz physics step with frame clamp
{
"dt": 0.016667,
"max_frame_time": 0.25,
"max_steps_per_frame": 5,
"interpolate_render_state": true
}Attribution: written for this index
Crosses
- Quaternion slerp rotation interpolation: Render-state interpolation between the last two fixed steps blends orientations with slerp rather than component-wise lerp.
- Extended Position-Based Dynamics: A fixed dt makes constraint compliance and iteration counts mean the same thing every frame.