Skip to main content
The scaffold is already a complete game. This page shows how its four rule pieces connect.

1. Define state

engine/src/state.ts declares the saved data and the class your rules edit:
Every field in .model() must exist on GameState. Give each field a valid initial value.

2. Define an event and command

Declare events once so their payloads are typed and checked:
Then define what a player can do:
Validation rejects an illegal attempt without changing state. Execution runs only after validation succeeds.

3. Put the command in a stage

A stage decides who may act and what happens next:
The explicit type lets the stage refer back to itself. runtime.players is the authoritative roster the match starts with, in seating order.

4. Assemble the game

Your config exports game to the CLI. Your client imports the type of executor to get typed views and commands.

Preview locally

Run the rules and frontend together.