GameConfig
Defined in: core/define.ts:251
A game definition.
Type parameters, all inferred by defineGame: S state, O options, PN phase names,
AN top-level action names, A their inputs, PAN phase action names, P their
inputs per phase, V the view.
Type Parameters
Section titled “Type Parameters”S
O
PN extends string
AN extends string
A
PAN extends string
P
V
R = Json
Properties
Section titled “Properties”actions?
Section titled “actions?”
optionalactions?:ActionDefs<S,O,PN,AN,A,R> &InputSchemas<A>
Defined in: core/define.ts:286
Actions available in every phase.
autoStart?
Section titled “autoStart?”
optionalautoStart?:boolean
Defined in: core/define.ts:275
Start automatically once seats.min seats are occupied. Default true.
description?
Section titled “description?”
optionaldescription?:string
Defined in: core/define.ts:265
id:
string
Defined in: core/define.ts:263
Stable id used in the protocol, lobby and store. Lowercase, digits, -, _, ..
optionalname?:string
Defined in: core/define.ts:264
onDisconnect?
Section titled “onDisconnect?”
optionalonDisconnect?:Hook<S,O,PN,R>
Defined in: core/define.ts:299
onEnd?
Section titled “onEnd?”
optionalonEnd?:Hook<S,O,PN,R>
Defined in: core/define.ts:302
onReconnect?
Section titled “onReconnect?”
optionalonReconnect?:Hook<S,O,PN,R>
Defined in: core/define.ts:300
onSit?
Section titled “onSit?”
optionalonSit?:Hook<S,O,PN,R>
Defined in: core/define.ts:297
onStand?
Section titled “onStand?”
optionalonStand?:Hook<S,O,PN,R>
Defined in: core/define.ts:298
onStart?
Section titled “onStart?”
optionalonStart?:Hook<S,O,PN,R>
Defined in: core/define.ts:301
options?
Section titled “options?”
optionaloptions?:StandardSchemaV1<unknown,O>
Defined in: core/define.ts:277
Validates table options (any Standard Schema library).
phases?
Section titled “phases?”
optionalphases?:{ [K in string]: PhaseDef<S, O, PN, PAN, K extends keyof P ? P[K] : undefined, R> }& { [K in string | number | symbol]: { actions?: InputSchemas<P[K]> } }
Defined in: core/define.ts:288
Named phases. The first one declared is the initial phase.
result?
Section titled “result?”
optionalresult?:StandardSchemaV1<unknown,R>
Defined in: core/define.ts:282
Validates the result passed to ctx.end and types it for clients (meta.result).
Without it, any JSON value is accepted.
rounds?
Section titled “rounds?”
optionalrounds?:RoundsConfig<S,O,PN,R>
Defined in: core/define.ts:294
Rounds for games without phases.
seats:
object
Defined in: core/define.ts:268
max:
number
min:
number
perPlayer?
Section titled “perPlayer?”
optionalperPlayer?:number
Seats one player may hold at once. Default 1.
turns?
Section titled “turns?”
optionalturns?:TurnsConfig<S,O>
Defined in: core/define.ts:292
Turns for games without phases.
version?
Section titled “version?”
optionalversion?:number
Defined in: core/define.ts:267
Bump when state shape changes incompatibly (ADR 0009). Default 1.
Methods
Section titled “Methods”setup()
Section titled “setup()”setup(
args):S
Defined in: core/define.ts:284
Builds the initial state. Runs once per table.
Parameters
Section titled “Parameters”options
Section titled “options”O
random
Section titled “random”number
Returns
Section titled “Returns”S
view()?
Section titled “view()?”
optionalview(args):V
Defined in: core/define.ts:296
What each viewer may see. Defaults to the full state for everyone.
Parameters
Section titled “Parameters”ViewArgs<S, O>
Returns
Section titled “Returns”V
