Skip to main content
The game definition is the complete set of rules that the CLI validates and Tableverse runs.

Builder methods

State and an initial stage are required. Events, setup input, and setup are optional. The player roster arrives as players on createInitialState and reaches .setup() through the context, alongside rng. Use .setupInput() for game configuration a client chooses, such as a variant or option.

Setup without input

If every game starts the same way, omit .setupInput():
The executor signatures reflect this choice. Both start from an init object carrying the deterministic seed and the players roster; a definition with setup input also requires setup:

Declare events

Events tell clients what happened without asking them to infer it from state changes.
Pass typeof events to your command and stage factories. emitEvent then accepts only declared event types and valid payloads.
Export both game and executor. The CLI config uses game; the frontend imports typeof executor for end-to-end types.

Use the executor

Start state, execute commands, and create safe views.