Game Delta Time and Fixed Timestep Lab

Compare variable and fixed timestep game loops with repeatable frame spikes, simulated motion, catch up steps, and visible time drift.

Build the frame pattern

Rendered frames per second

Extra time added to spike frames

Equal simulation step size

The proving ground

Two clocks, one moving object

Bars expose the hitches, lines trace both positions, and the lower trace isolates the drift that the final values can hide.

Experiment updated

The motion ledger

Position over elapsed wall time. A dashed line marks equal fixed steps.

Variable delta pathFixed timestep pathFrame spike

The variable model applies velocity once with the current frame duration. The fixed model accumulates full wall time and advances in equal steps. Neither path is a performance measurement.

Your values are saved only in this browser so the experiment is ready when you return. No game data or telemetry is sent anywhere.

Zoom 100%
Utilities Studio

Want this utility on your website?

Customize colors and dark mode for WordPress, Notion or your own site.

Frequently Asked Questions

What does this fixed timestep lab demonstrate?

It runs the same moving object through a variable delta time loop and a fixed timestep accumulator. Frame spikes make the difference visible so you can inspect simulated time, position drift, and catch up steps without running a game engine.

What is the difference between variable and fixed delta time?

The variable model advances once per rendered frame using that frame duration. The fixed model advances in equal simulation steps and uses an accumulator to process as many steps as the elapsed wall time requires. Fixed steps make simulation behavior less dependent on render rate, while a long frame may require catch up work.

What does the frame spike input represent?

It adds extra milliseconds to every selected spike frame. The cadence field controls how often a spike appears, which lets you create a repeatable hitch pattern instead of relying on a random performance trace.

What does delta clamping change?

Clamping limits the delta used by the variable model when a frame is longer than the chosen ceiling. This can prevent a single hitch from moving the object too far, but it also makes simulated time fall behind wall time. The fixed accumulator continues to account for the full elapsed frame.

Is this a profiler or a replacement for playtesting?

No. It is a deterministic teaching and design lab using declared numbers. It does not measure your device, diagnose an engine, model rendering cost, or prove that one loop is correct for every game.

# Understand the clock inside a game loop

Every rendered frame gives the game a new elapsed time. In a variable delta loop, motion is commonly updated as position += velocity × frameTime. That keeps average speed close to the intended value when frames are steady, but it also makes one simulation update as large as the frame that produced it. A hitch is therefore not just a visual pause: it changes the amount of game time consumed by that update.

# Compare variable integration with a fixed accumulator

A fixed timestep loop adds each frame duration to an accumulator, then repeatedly consumes a chosen step such as 16.667 ms. The simulation sees equal-sized updates, while the renderer can still present frames at a different rhythm. The leftover fraction stays in the accumulator for the next frame. When a long frame arrives, the fixed loop performs several small updates to account for elapsed time, which preserves the step size but can create a catch up burst.
Situation Variable delta path Fixed timestep path Decision to consider
Steady renderingOne update uses each regular frame durationOne or more equal steps consume the accumulated timeBoth should follow the same motion closely.
Long frameOne large update can move an object too farSeveral fixed updates catch up to elapsed timeInspect drift and the catch up count together.
Different render rateThe update size changes with the frame rateThe simulation step stays the sameFixed steps reduce render-rate dependence.
Delta ceilingThe variable update ignores time above the capThe accumulator still receives the full frame durationUse a clamp only when losing time is acceptable.

# See what a frame spike actually does

At 60 frames per second, a regular frame is about 16.667 ms. With an extra 80 ms spike, one frame becomes about 96.667 ms. The variable model consumes that whole duration in one update. The fixed model consumes roughly six 16.667 ms steps instead. The total elapsed time can match, while the path taken through the simulation is different.

# Read position drift and catch up together

Position difference is the variable path minus the fixed path. It tells you how far the two integration policies have separated, not which one is automatically correct. The catch up count tells you how much fixed work was required in a single rendered frame. A large difference points to visible motion divergence; a large catch up count points to a possible CPU budget problem. These are related, but they are not the same diagnosis.

# Treat delta clamping as a policy

A clamp can stop a paused tab, breakpoint, or severe hitch from teleporting a character or sending a physics body through geometry. The tradeoff is that the variable clock then falls behind real elapsed time. If the game must preserve timing, use a fixed accumulator or another recovery policy. If the game must remain bounded and responsive, a clamp may be acceptable, but the lost time should be intentional.

# Choose the loop for the job it protects

Game-loop job Useful default Reason
Physics, collisions, or deterministic gameplayFixed timestepEqual steps make the simulation less sensitive to render cadence.
Simple visual motion with no accumulated stateVariable deltaThe update is small and usually does not need a catch up queue.
Gameplay simulation plus smooth renderingFixed update with interpolationThe simulation keeps its step while presentation hides fractional progress.
Recovery after a severe stallA bounded catch up policyAvoid turning one bad frame into unbounded simulation work.

# Use a repeatable tuning workflow

Begin with no spikes and confirm that both paths agree. Add one repeatable hitch, then change its cadence to see whether the visible error accumulates or settles. Adjust the fixed step and inspect the catch up count before changing velocity. Finally enable the clamp and compare variable simulated time with wall time. This sequence separates the cause of a divergence from the policy used to contain it.
What this experiment cannot prove
The lab uses declared frame durations and a constant velocity, so it explains timing behavior rather than measuring a device or validating an engine. Real physics, input sampling, networking, interpolation, and a frame budget can change the best design. Use the result to form a hypothesis, then verify that hypothesis in the actual game.