Documentation Index
Fetch the complete documentation index at: https://openturn.io/docs/llms.txt
Use this file to discover all available pages before exploring further.
createLocalSession(game, options) is the lowest-level way to run an openturn match. It is a reducer wrapped in a subscribable handle. Everything else (React bindings, hosted server, replay materialization) sits on top of it.
Create
matchis required.match.playersis the seated subset for this session — a non-empty subset of the game’s player pool (game.playerIDs). For variable-player games (e.g.maxPlayers: 4, minPlayers: 2), seat fewer players by passingplayers: ["0", "1"]etc.seed(optional) is a string used by@openturn/core’s RNG. Omit it and the session generates one. Fix it for reproducible tests.now(optional) is the initial time in milliseconds, used when transitions readcontext.now. Defaults to0.
Read state
snapshot is the same shape every part of openturn uses. See concepts: authoritative state and snapshots.
Apply events
placeMark above), because gamekit emits one core event per move.
Read player views
views.player with that player ID. If you only defined views.public, getPlayerView returns the public shape.
Snapshot the replay data
replayData contains everything needed to reconstruct the match elsewhere: the match roster, the seed, the initial time, and the full action log. Hand it to @openturn/replay’s createSavedReplayFromSession to produce a portable envelope.
Subscribe to changes
createOpenturnBindings) uses the same subscription under the hood.
Use in tests
seed makes the test deterministic across machines.
Related
- Reference: core for the
LocalGameSessionAPI. - How-to: bind a game to React for the React wrapper.
- How-to: capture replays for exporting the action log.