2026-11-24 · 2 min read
Two new games, two state machines
On 2 November we opened two games in Godot 4, Segfault and Ashen Caravan, both at version 5. Different genres, but the same turn built as a state machine.
Two starts on the same day
On 2 November we opened two new projects in Godot 4: Segfault and Ashen Caravan. On 2 November both were at version 5. It's early: there's the skeleton, there's the data, there's the first fight. Nothing more, and we'll say so up front.
Segfault is a card game. Ashen Caravan is a grid tactics game, with mercenaries. Different genres, but the same knot to untie: turn-based combat. And a turn is a sequence of phases that must not overlap.
The choice: the turn is a state machine
In both games the combat is a state machine. Phases with a name, an entry and an exit, one at a time.
In Segfault the CombatManager has five states: INIZIO_TURNO, GIOCATORE, FINE_TURNO, NEMICI, CONTROLLO_FINE. Each turn has its own RAM to spend, cards have a cost, and some stay in play as resident cards.
In Ashen Caravan the BattleManager has four states: INIZIO, TURNO_UNITA, RISOLUZIONE, CONTROLLO_FINE. Turn order follows initiative, worked out from Reflexes plus level.
The name that comes back is CONTROLLO_FINE. It's the state that asks, every time: is the battle over? Keeping it as its own phase, and not as an if scattered through the code, means having a single place to answer that question.
Data before the scene
We started from data, not graphics.
Segfault starts from three resources — CardResource, CardEffect, CardInstance — and a DeckManager, tested on an empty scene. Ashen Caravan starts from ItemResource and MercenaryTemplate, from a Mercenary with a test on damage and morale, from an EventBus and a versioned SaveManager.
Ashen Caravan's save is a JSON file in user://saves/, with a version field and migrations from one version to the next. It saves on its own at camp. It's the same scheme we use in the other games: when the format changes, old saves aren't thrown away, they're migrated.
The same measurements
Both are born on the 1280x720 viewport, like the rest of the games. Segfault is locked in landscape, with the Compatibility renderer and a 24 px safe margin at the edges. Ashen Caravan uses the canvas_items stretch with expand aspect, and three autoloads: EventBus, GameManager, SaveManager.
Ashen Caravan's grid is square, built with TileMapLayer and AStarGrid2D. The GridManager holds the obstacles and the movement costs; units move by spending those costs.
Segfault, instead, is played by touch. A card is played onto its target in two ways: by dragging it, or with two taps — first the card, then the target. The hand fans out up to seven cards.
What we take away
- Two different genres, the same turn skeleton: the state machine, with
CONTROLLO_FINEas the single place to ask whether it's over. - Typed data and versioned saves come before the scene.
- On 2 November both were at version 5. It's a start, not a milestone, and we prefer to write it that way.