Engine & tech
State space
Also: state graph, state-space search
A game's state space is the set of all states reachable from a starting state through legal moves, linked by the transitions between them. Searching it exhaustively lets you prove that an ending stays reachable from every state.
Background
The term comes from classic AI research, where problems are framed as a search through a graph of states and operators. Board game programs, planners and model checkers all build on this view.
In an adventure game a state is mostly the combination of the current location, the flags that are set and the inventory. Even a handful of independent optional actions multiplies the number of states, because every order creates new combinations. The real craft is deciding which differences actually matter.
Common mistakes are including purely cosmetic values such as the character's position, which makes the space explode, or leaving out something that does affect play, so the search misses dead ends.
How we do it
The Wurzelwerk engine's playthrough test explores the whole state space: every dialogue, prompt rule, item and combination. Two states count as equal when they share the scene, the flags and the inventory; position and variables marked cosmetic are ignored. For Spätlese 404 that comes to 11,598 states and 78,550 transitions with zero dead ends; Persona non grata has 173,495 states.
The state space even shapes the design. From puzzle R15 onward there are no more biscuits in Persona non grata, because otherwise the search would have to cover more than 300,000 states.
Related terms
- Automated playtestingEngine & techAn automated playtest has a program play through the game and report errors, dead ends and broken solution paths.
- Dead endAdventure designA dead end is a game state from which no ending can be reached any more, even though the game keeps running.
- Puzzle dependency chartAdventure designA puzzle dependency chart maps which puzzles in an adventure unlock which others, from the opening problem to the ending.
- Finite state machine (FSM)Game AI & real-time strategyA finite state machine models behaviour as a fixed set of states with transitions between them, exactly one of which is active at any time.
- Data-driven designEngine & techData-driven design separates game content from code: scenes, rules and text live in data files that the engine simply executes.