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():
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.typeof events to your command and stage factories. emitEvent then accepts only declared event types and valid payloads.
Use the executor
Start state, execute commands, and create safe views.