MonoGame: Fixed vs Variable Game-Loop Timestep
Choose MonoGame's IsFixedTimeStep and TargetElapsedTime for deterministic physics or unlocked frame rates, then verify with Update and Draw logging.
05 Aug 2025, 03:24 UTC

The decision and the constraints
MonoGame does not enforce a single simulation cadence. The Game class exposes two properties that control the loop:
IsFixedTimeStep— when true, MonoGame attempts to callUpdateat a fixed interval.TargetElapsedTime— the requested interval between updates, expressed as aTimeSpan.
These settings affect every system that runs in Update, including physics, input processing, and network state. The wrong choice can cause replays to desync, collisions to tunnel through thin objects, or frame-rate-dependent movement that feels faster on a 144 Hz monitor than on a 60 Hz one.
Constraints to decide against
- Deterministic physics or replays: requires a fixed step so the same input sequence produces the same state on every machine.
- Network lockstep: requires all peers to simulate identical frames, which is impractical with a variable step.
- Unlocked frame rates: fits variable step, but only if every simulation value is scaled by delta time.
- Mobile and WebGL: may clamp or ignore
TargetElapsedTimebecause of platform VSync and power management.
Supported options compared
| Mode | IsFixedTimeStep | TargetElapsedTime | Best for | Main risk |
|---|---|---|---|---|
| Fixed | true | 1/60 second | Rhythm games, physics simulations, replays, lockstep networking | Render stutter if drawing cannot keep up with updates |
| Variable | false | Not applicable | Unlocked frame rates, VSync-disabled benchmarks | Collision tunneling and frame-rate-dependent logic |
Trade-offs
Fixed timestep
A fixed step decouples simulation from rendering. Update runs at the requested interval, while Draw runs as often as the backend allows. This makes it easier to record and replay input because the simulation advances in identical increments.
The cost is pacing. If a frame takes longer to draw than the update interval, MonoGame reports GameTime.IsRunningSlowly. The simulation remains steady, but the rendered output can appear to stutter. You should not place state-changing logic in Draw; keep all mutation in Update.
Variable timestep
With IsFixedTimeStep set to false, Update runs once per rendered frame. You must scale movement, timers, and physics by gameTime.ElapsedGameTime so behavior does not depend on frame rate. This smooths visuals on high-refresh displays but makes deterministic replay difficult and increases the chance that fast-moving objects pass through colliders between frames—a failure known as tunneling.
TargetElapsedTime is a request, not a guarantee. SynchronizeWithVerticalRetrace and platform VSync can override the effective frame pacing on any backend.
Implementation: configure and validate the loop
Set the loop mode in the Game constructor. This example targets a fixed 60 Hz update cadence on MonoGame 3.8 or 3.9 desktop backends.
public Game1()
{
_graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
IsMouseVisible = true;
IsFixedTimeStep = true;
TargetElapsedTime = TimeSpan.FromSeconds(1.0 / 60.0);
}
Run simulation in Update. If you need smooth rendering between fixed updates, track the previous and current state and interpolate in Draw using the fraction of the interval elapsed since the last update.
float _accumulator;
const float FixedDt = 1f / 60f;
Vector2 _previousPosition;
Vector2 _currentPosition;
protected override void Update(GameTime gameTime)
{
float dt = (float)gameTime.ElapsedGameTime.TotalSeconds;
_accumulator += dt;
while (_accumulator >= FixedDt)
{
_previousPosition = _currentPosition;
_currentPosition += Velocity * FixedDt;
_accumulator -= FixedDt;
}
}
protected override void Draw(GameTime gameTime)
{
float alpha = _accumulator / FixedDt;
Vector2 renderPosition = Vector2.Lerp(_previousPosition, _currentPosition, alpha);
// Draw sprite at renderPosition
}
Where to run: any desktop MonoGame project, in the main Game class. Permissions: none required. Risks: the interpolation example is a pattern, not a tested measurement; adapt the state types and update logic to your game.
Verification: logging Update and Draw counts
Do not guess which loop mode is active. Add temporary counters to Game1 and log totals over a ten-second window.
int _updates;
int _draws;
double _windowSeconds;
protected override void Update(GameTime gameTime)
{
_updates++;
_windowSeconds += gameTime.ElapsedGameTime.TotalSeconds;
if (_windowSeconds >= 10.0)
{
System.Diagnostics.Debug.WriteLine($"Updates: {_updates}, Draws: {_draws}");
_updates = 0;
_draws = 0;
_windowSeconds = 0;
}
}
protected override void Draw(GameTime gameTime)
{
_draws++;
}
Expected checks:
- Fixed step: update count stays stable near 600 per ten seconds; draw count varies with frame time.
- Variable step: both counts rise and fall together as frame time changes.
To confirm determinism, record the same input sequence, run the game twice under fixed step, and compare final game state. Identical results indicate the loop is behaving deterministically. To observe lag reporting, resize the window or add temporary load and check gameTime.IsRunningSlowly inside Update.
Remove the logging code before shipping; Debug.WriteLine adds overhead and is not a substitute for profiling on target hardware.
Limitations and rollback
TargetElapsedTimeis a request. Desktop VSync, power management, and mobile backends can override it.- Low-power platforms may throttle a fixed 60 Hz update cadence. Test on the actual target device, not only the development desktop.
- Variable step requires delta-time scaling everywhere; missing one timer or force re-introduces frame-rate dependence.
Because this change is source-code configuration only, rollback means restoring the previous IsFixedTimeStep and TargetElapsedTime values and rebuilding. No asset or database migration is involved.
Quick decision checklist
- Do you need deterministic replays or lockstep networking? Use fixed step.
- Do you need unlocked frame rates and can scale every simulation value by delta time? Use variable step.
- Are you targeting mobile or WebGL? Assume
TargetElapsedTimemay be clamped and verify on device. - After changing the setting, log Update and Draw counts for ten seconds and confirm the cadence matches the mode you selected.