DE EN FR ES IT

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.

State space of a small adventureA directed graph: moves lead from the start through several states to the ending. One red state has no path to the ending left; it is a dead end.StartRodCoinFlyerDead endEnding Node = state (scene, flags, inventory) · arrow = move
Diagram with made-up states. The Wurzelwerk engine’s state search checks every reachable state for a remaining path to an ending.

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