Skip to content

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.

S

O

PN extends string

AN extends string

A

PAN extends string

P

V

R = Json

optional actions?: ActionDefs<S, O, PN, AN, A, R> & InputSchemas<A>

Defined in: core/define.ts:286

Actions available in every phase.


optional autoStart?: boolean

Defined in: core/define.ts:275

Start automatically once seats.min seats are occupied. Default true.


optional description?: 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, -, _, ..


optional name?: string

Defined in: core/define.ts:264


optional onDisconnect?: Hook<S, O, PN, R>

Defined in: core/define.ts:299


optional onEnd?: Hook<S, O, PN, R>

Defined in: core/define.ts:302


optional onReconnect?: Hook<S, O, PN, R>

Defined in: core/define.ts:300


optional onSit?: Hook<S, O, PN, R>

Defined in: core/define.ts:297


optional onStand?: Hook<S, O, PN, R>

Defined in: core/define.ts:298


optional onStart?: Hook<S, O, PN, R>

Defined in: core/define.ts:301


optional options?: StandardSchemaV1<unknown, O>

Defined in: core/define.ts:277

Validates table options (any Standard Schema library).


optional phases?: { [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.


optional result?: 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.


optional rounds?: 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

optional perPlayer?: number

Seats one player may hold at once. Default 1.


optional turns?: TurnsConfig<S, O>

Defined in: core/define.ts:292

Turns for games without phases.


optional version?: number

Defined in: core/define.ts:267

Bump when state shape changes incompatibly (ADR 0009). Default 1.

setup(args): S

Defined in: core/define.ts:284

Builds the initial state. Runs once per table.

O

Random

number

S


optional view(args): V

Defined in: core/define.ts:296

What each viewer may see. Defaults to the full state for everyone.

ViewArgs<S, O>

V