game-loop
Installation
SKILL.md
Fixed Timestep Game Loop
Frame-rate independent game loop with physics interpolation and time manipulation.
When to Use This Skill
- Building browser-based games or interactive simulations
- Need consistent physics regardless of monitor refresh rate
- Want smooth rendering with deterministic game logic
- Implementing hitstop, slow-mo, or time manipulation effects
Core Concepts
The key insight is separating physics (fixed timestep) from rendering (variable). An accumulator tracks time debt, running physics at a consistent rate while interpolating between states for smooth visuals.
Frame → Accumulator += delta → While(accumulator >= fixedStep) { physics() } → Render(interpolation)