Skip to content

Game Loop

engine/GameLoop.ts observes state:updated and diffs the replicated doc.gameLoop state against its cached state. It emits loop, turn, and game lifecycle events, while controls such as start, stop, and turn limits dispatch game:loop* actions.

The loop is an observer and coordinator, not a second state store. Its state is in the Chronicle so peers can observe the same lifecycle facts. A game still needs explicit rules for turn ownership, timing, cancellation, and simultaneous actions; the loop alone does not make those rules fair.