---
title: "Design route flags, branches and endings"
description: "Give choices clear consequences, keep story conditions readable, and test the routes that matter without checking every combination."
language: en
canonical: https://bestadultgames.io/en/developers/guides/route-state
---

[Developers](https://bestadultgames.io/en/developers.md) / [Guides](https://bestadultgames.io/en/developers/guides.md) / Narrative

Intermediate · A reading priority

# Design route flags, branches and endings

Give choices clear consequences, keep story conditions readable, and test the routes that matter without checking every combination.

Best Adult Games · 3 min read · Sources checked 5 October 2026 · Based on published documentation

![Three boxes linked by right-pointing arrows: Story → State → Player choice. The Story box is highlighted in orange.](https://bestadultgames.io/images/developer-guides/route-state-intro-1.svg)

*Map the story's conditions and consequences before adding branches. Best Adult Games · original diagram*

Branching stories get into trouble when nobody can explain what a variable means. A romance route should remember the promises the player made, and a route map should show which scenes they can reach, why a choice is available and what each event changes.

Use named flags for specific decisions or events, and counters for rules that genuinely accumulate. Build a small state specification, route map and test matrix alongside the script. The approach applies to Ren'Py, Twine and an integrated narrative system such as Ink.

## Name the facts the story needs

![Three boxes linked by right-pointing arrows: Facts → Variables → State. The Variables box is highlighted in orange.](https://bestadultgames.io/images/developer-guides/route-state-section-1-1.svg)

*A flag names a fact; a counter needs a rule for every change. Best Adult Games · original diagram*

List the decisions and events later scenes need to remember. Name flags after facts: studio_plan_agreed tells you what happened. If you use relationship_score, write down exactly what it measures and what each increase or decrease means. Anyone editing a scene should be able to follow that rule.

Keep trust, attraction, knowledge and route commitment separate when they can change independently. One number carrying all four meanings makes later conditions hard to reason about. Mark values derived from other facts, and calculate them from the stored state rather than saving a second version that can drift out of sync.

## Define transitions and conditions

![Three boxes linked by right-pointing arrows: Condition → Decision → Transition. The Transition box is highlighted in orange.](https://bestadultgames.io/images/developer-guides/route-state-section-2-1.svg)

*Record what allows a scene to start and what each choice changes. Best Adult Games · original diagram*

For every scene, record its entry conditions, choices, state changes and exit destinations. Give each scene a stable identifier so the map, script and tests refer to the same place. Spell out mutually exclusive route conditions and provide a fallback for state you did not expect.

Treat seeing a scene and completing an event as separate operations. Revisiting a passage should not award the same reward again. If rollback or history navigation can reverse a choice, define which state changes reverse with it; otherwise the dialogue and the stored facts can disagree.

## Control the cost of branching

![Three boxes linked by right-pointing arrows: Branch → Shared scene → Outcome. The Branch box is highlighted in orange.](https://bestadultgames.io/images/developer-guides/route-state-section-3-1.svg)

*Branches can rejoin while dialogue and endings preserve their consequences. Best Adult Games · original diagram*

Let short branches acknowledge a choice and rejoin when the story benefits from a shared scene. Carry the consequence into dialogue, available activities or ending conditions. A shared scene can still remember who the player flirted with; a meaningful response does not need its own location.

Budget for unique writing and assets on every branch. Include the extra outfit, expression and localization work wherever variations are needed. Keep independent systems independent where possible: connecting every choice to every scene quickly expands both the production work and the test matrix.

## Make decisions understandable

![Three boxes linked by right-pointing arrows: Player intent → Choice → Feedback. The Choice box is highlighted in orange.](https://bestadultgames.io/images/developer-guides/route-state-section-4-1.svg)

*Clear intent and an immediate response help players understand a choice. Best Adult Games · original diagram*

Write choices so the player understands what they intend to do, even if the long-term result remains uncertain. Follow the choice with a fitting immediate response. A hidden numerical rule should not turn an affectionate line into a rejection when the scene has given the player no reason to read it that way.

Offer content and pacing controls where the design needs them, and explain how they affect progression. Skipping an intimate scene's presentation should still apply its required state changes. Test whether the available controls let a player reach an ending without replaying scenes they wanted to skip.

## Test boundaries and representative paths

![Three boxes linked by right-pointing arrows: Boundary → Route → Test. The Test box is highlighted in orange.](https://bestadultgames.io/images/developer-guides/route-state-section-5-1.svg)

*Test endings and threshold boundaries with a focused set of routes. Best Adult Games · original diagram*

Test every important ending, every exclusive route condition and values just below, at and above each threshold. Include a new game, repeated visits, saves made before and after a choice, and updates from representative older states. These cases probe the points where a route can break even when its usual path works.

Use automated checks to inspect state transitions and unreachable scene identifiers. Have a human review continuity and character voice as well. Cover the rules with a targeted matrix instead of chasing every possible combination, and add a regression case whenever a route defect is fixed.

## Keep state understandable during production

![Three boxes linked by right-pointing arrows: State table → Route map → Review. The State table box is highlighted in orange.](https://bestadultgames.io/images/developer-guides/route-state-section-6-1.svg)

*Keep the state table, route map and script in agreement. Best Adult Games · original diagram*

Provide a developer view of the relevant flags and current scene identifiers without changing the public interface. Use it to reproduce a tester's reported defect. Keep debug shortcuts out of the final distribution unless you deliberately support them.

Update the route map and tests whenever you edit the script. Another contributor should be able to explain how a scene becomes available and why the stored state produces its consequence. If only you can explain it, the route needs clearer documentation.

## Key decisions

- Define one precise narrative meaning for each variable.
- Record event completion separately from scene display.
- Test endings, threshold boundaries, repeat visits and rollback.
- Update the route map and tests with the script.

## Guide files

[Route map](https://bestadultgames.io/developers/templates/route-map.csv) [Route test matrix](https://bestadultgames.io/developers/templates/test-matrix.csv)

External model communities and publishing sites may contain explicit material. Source links open in a new tab; this guide does not load their previews.

### Sources & further reading

- [Ren'Py menus](https://www.renpy.org/doc/html/menus.html)
- [Ren'Py conditional statements](https://www.renpy.org/doc/html/conditional.html)
- [Ink writing and integration](https://www.inklestudios.com/ink/)

Last checked 5 October 2026.

## In this guide

1. [Name the facts the story needs](https://bestadultgames.io/en/developers/guides/route-state#section-1)
2. [Define transitions and conditions](https://bestadultgames.io/en/developers/guides/route-state#section-2)
3. [Control the cost of branching](https://bestadultgames.io/en/developers/guides/route-state#section-3)
4. [Make decisions understandable](https://bestadultgames.io/en/developers/guides/route-state#section-4)
5. [Test boundaries and representative paths](https://bestadultgames.io/en/developers/guides/route-state#section-5)
6. [Keep state understandable during production](https://bestadultgames.io/en/developers/guides/route-state#section-6)

## Related tools and models

- [Ren'Py](https://bestadultgames.io/en/developers/tools?q=Ren'Py)
- [Twine](https://bestadultgames.io/en/developers/tools?q=Twine)
- [Ink and Inky](https://bestadultgames.io/en/developers/tools?q=Ink%20and%20Inky)

[Production templates](https://bestadultgames.io/en/developers/templates.md)

## Related guides

Narrative · Intermediate · 3 min read

### [Localize a narrative game without breaking its interface](https://bestadultgames.io/en/developers/guides/localization.md)

Keep character voice, text identifiers, terminology and interface testing aligned across release languages.

Read the guide → A reading priority
