Skip to content

concepts

Rounds as events

The server sends a round as an ordered list of events; the client plays it back.

A round's outcome is decided and stored on the server before the player sees anything. The client receives it as an ordered list of events and plays them back: each event type has a handler in the mechanic, and the presenter turns it into timed steps on the field.

keystone-core engine events (abridged)
export type TEngineEvent<TEvent> =
  | { type: "round:start"; roundId: null }
  | { type: "round:book"; round: IPlaybackRound<TEvent> }
  | { type: "round:step"; index: number; event: TEvent; round: IPlaybackRound<TEvent>; at: number }
  | { type: "round:end"; outcome: IHudRoundOutcome | null }
  | { type: "win:running"; coins: number }
  | { type: "error"; error: unknown }
  // ...

Why events

  • Any round can be replayed by its id, because the events are what was stored.
  • Each event can be played on its own, which makes golden rounds and visual checks possible per event type.
  • Skipping and turbo only change pacing: the same events play, faster or cut short.

Recovery

If a session ends mid-round, the next one restores the board to the last presented step and continues. The game's runtime gets the stored round and the index of that step.