fixed_timestep_game_loop

Implement a fixed timestep game loop with accumulator-based ticking and spiral-of-death protection.

2|Updated Jul 2, 2026
One-click install
npx skills add https://github.com/Xyrces/godot-ecs-gamedev-playbook --skill fixed-timestep-game-loop
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fixed_timestep_game_loop
Source: https://github.com/Xyrces/godot-ecs-gamedev-playbook/tree/main/skills/fixed_timestep_game_loop
Command: npx skills add https://github.com/Xyrces/godot-ecs-gamedev-playbook --skill fixed-timestep-game-loop

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill prevents frame-rate-dependent simulation bugs by separating game logic updates from rendering and advancing the world in fixed time steps. It helps avoid unstable physics, missed input, tunneling, and replay or networking desync caused by variable delta time.

Core Features & Use Cases

  • Accumulator-Based Looping: Collects elapsed time and consumes it in fixed-size simulation ticks for consistent updates.
  • Spiral-of-Death Protection: Clamps frame time and limits ticks per frame so the game recovers gracefully under load.
  • Deterministic Simulation Support: Covers fixed-point math, ordered collections, seeded randomness, and state hashing for replay or lockstep networking.
  • Input and Time Domain Handling: Buffers input once per frame and supports pause, slow motion, and separate UI versus simulation timing.
  • ECS Scheduler Integration: Fits fixed tick execution into a system scheduler alongside per-frame rendering and presentation work.

Quick Start

Use this skill to design a fixed timestep loop for my game that keeps simulation deterministic, buffers input correctly, and prevents spiral-of-death behavior.

Frequently Asked Questions about fixed_timestep_game_loop

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement a fixed timestep game loop to prevent frame-rate-dependent physics bugs?

A fixed timestep game loop decouples simulation from rendering by accumulating elapsed time and consuming it in fixed-size ticks. This prevents unstable physics, tunneling, and input loss caused by variable delta time updates.

What is the spiral-of-death in game loops and how do I prevent it?

The spiral-of-death occurs when simulation takes longer than the elapsed frame time, causing an ever-growing backlog of ticks. It is prevented by clamping frame time and limiting the maximum number of ticks processed per frame to recover gracefully under load.

How does a fixed timestep game loop support deterministic replay and rollback networking?

Deterministic replay and rollback networking require identical simulation results across machines. A fixed timestep loop achieves this through fixed-point math, ordered collections, seeded randomness, and state hashing to validate and synchronize game logic updates.

Can I use an accumulator-based game loop with an ECS scheduler?

Yes, an accumulator-based game loop integrates with an ECS scheduler by fitting fixed tick simulation execution alongside per-frame rendering and presentation work. This maintains stable physics while allowing flexible entity-component system management.

How do I handle input buffering and multiple time domains like slow motion in a fixed timestep simulation?

Input buffering collects inputs once per frame before processing them in fixed simulation ticks. Multiple time domains are handled by supporting separate UI versus simulation timing, allowing pause and slow motion without breaking deterministic updates.