Skip to content

Game

The live combat state of a Campaign.

A Game is the initiative tracker: it owns the Combatant list, tracks whose turn it is, and counts rounds. Exactly one game belongs to a campaign, and it is pushed to the player display and the web client whenever it changes.

Turn order is not stored on the game itself — each combatant holds one or more Initiative entries whose order positions them in the round. sortInitiative() assigns those orders, and turnedCombatant / turnedInitiative resolve the current turn.

  • SeeAlso: Campaign, Combatant, Initiative

View JSON Schema

Property Type Required Description
started boolean Yes Whether combat is currently running. While stopped, round and turn are not advanced and the player display shows no initiative order.
round integer Yes The current combat round, counting from 1. Incremented each time turn order wraps back to the first combatant.
turn integer Yes The current position within the round, counting from 1. Matches the Initiative/order of the acting entry.
combatantId string No The identifier of the combatant whose turn it is. nil before the first turn is taken. Cleared by validateTurn() if it no longer resolves to a combatant in this game. SeeAlso: turnedCombatant
initiativeId string No The identifier of the initiative entry currently acting. A combatant may hold several initiative entries and act more than once per round, so the acting entry is tracked alongside combatantId. SeeAlso: turnedInitiative
combatants Array<Combatant> Yes Everyone taking part in this combat. Includes combatants that have not rolled initiative yet — those are inactive until they hold an initiative entry with an assigned order. Note: Use addCombatant(_:) and removeCombatant(_:) rather than mutating the list directly; they assign labels and clean up shared combatants and their tokens. SeeAlso: Combatant, activeCombatants