Web game architecture

From MRCalderon3D/everything-game-dev-code · View interactive version

Web game architecture is an AI agent skill from the GitHub repository MRCalderon3D/everything-game-dev-code. Structure the game loop, fixed-timestep simulation, state machines, and decoupled systems for a browser game.

How to use this skill

Skill file

Web Game Architecture

Purpose

Structure the game loop, fixed-timestep simulation, state machines, and decoupled systems for a browser game.

Use When

Inputs

Process

  1. drive rendering with requestAnimationFrame and run simulation on a fixed-timestep accumulator, clamping large frame deltas so a stalled tab cannot trigger a catch-up spiral
  2. keep simulation state separate from rendering; render reads state (interpolated if needed) and never mutates it
  3. model game flow as an explicit state machine with single-owner transitions, instead of scattered boolean flags
  4. decouple systems through events or message queues with named contracts, reserving direct calls for tight owner-child relationships
  5. handle the page lifecycle deliberately: pause simulation and audio on visibility loss, and resume cleanly with a reset delta

Outputs

Quality Bar

Common Failure Modes

Related Agents

Related Commands

Notes

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.