Spielerando

Multiple Endings

Multiple endings let one story finish in different ways, decided by what the player did. Keep a few scores and marks, check a list of endings in fixed order and take the first that fits, end the list with one that always matches, and lock the ending early at a point of no return.

Also called: Alternate endings, Branching endings, Ending tracker, Ending by score.

A small otter with a red scarf and a lantern stands in a round hall of five arched doors; four are shut and glow in blue, gold, violet and orange, while the middle one swings open onto a sunrise over a green valley.
Vesperlark, an invented vector-style story game. Invented game, image generated with AI.

Paste this to your AI

Copy it into Claude, Cursor or ChatGPT. It already has good values and the usual mistakes in it.

Add "Multiple Endings" to my game.

What it should do: Different endings make a story worth playing twice. The player must feel that their deeds led to the end they got, and must never reach a finish that looks like a mistake: no ending, the wrong one because of a hidden rule, or one that changes after it was shown.

Build it exactly as this state machine. First check that it fits my game, then build it like this:

```mermaid
stateDiagram-v2
  [*] --> playing
  playing: Story goes on
  locked: Ending locked in
  ended: Story over
  playing --> locked: point of no return
  playing --> ended: finishes or hero dies
  locked --> ended: finishes or hero dies
  ended --> [*]
```

Use these starting values:
- tallyCap: 10 points
- highAt: 6 points

Watch out for these common mistakes:
- Two endings fit at once: Tell your AI: check the endings in a fixed order, rarest first, take the first that fits, and decide what a tie does. Here a tie goes to mercy.
- No ending fits: Tell your AI: end the list with an ending that always matches.
- The rare ending hides behind a common one: Tell your AI: put the most demanding ending at the top of the list, and test that its conditions really reach it.
- A threshold above the maximum: Tell your AI: count a threshold above the cap as the cap.
- Deeds after the point of no return: Tell your AI: decide the ending when the point of no return passes, save it, and ignore later scores and marks.
- Dying after the ending was chosen: Tell your AI: a death always ends the story at once with its own ending, even after the ending was locked in.
- A restart that forgets the endings: Tell your AI: keep the seen endings apart from the story state and carry them over on a restart.

Do not change anything else in the game. Do not claim anything without proof: model what it takes, and show me what your solution rests on and how I can see that it works. If you cannot show something, say you do not know. When you are done, tell me in plain words how to try it.

Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP

What it does

Different endings make a story worth playing twice. The player must feel that their deeds led to the end they got, and must never reach a finish that looks like a mistake: no ending, the wrong one because of a hidden rule, or one that changes after it was shown.

How it runs, as a diagram

Everything it can be in, and what moves it on. Your AI builds from exactly this.

point of no returnfinishes or hero diesfinishes or hero diesStory goes onEnding locked inStory over
How it runs, as a diagram
  • Story goes on → Ending locked in: point of no return
  • Story goes on → Story over: finishes or hero dies
  • Ending locked in → Story over: finishes or hero dies

Good starting values

ValueStart withWhat it changes
tallyCap10 pointsThe most a score can hold. Ten is a size a player can reason about, and it stops a long game from making one score so large that nothing else matters.
highAt6 pointsThe score at which a trait counts as strong. Six of ten means the player has to rely on a trait for most of the story, not just now and then. A value above the cap counts as the cap, or an ending could never be reached.

What usually goes wrong

Two endings fit at once

A player with high scores in both traits matches several endings. If the order is not written down, the result depends on how the code happens to be arranged, and the player cannot tell why they got it.

Fix: Tell your AI: check the endings in a fixed order, rarest first, take the first that fits, and decide what a tie does. Here a tie goes to mercy.

No ending fits

A player who did a little of everything matches nothing, and the story ends with a blank screen or an error.

Fix: Tell your AI: end the list with an ending that always matches.

The rare ending hides behind a common one

If the common ending is checked first, a player who meets the rare one's conditions still gets the common one, and the rare ending can never be reached.

Fix: Tell your AI: put the most demanding ending at the top of the list, and test that its conditions really reach it.

A threshold above the maximum

If the score needed for an ending is higher than the score can ever be, that ending is locked forever, and nobody notices until a player asks.

Fix: Tell your AI: count a threshold above the cap as the cap.

Deeds after the point of no return

A player who locked in their fate in the final battle can still change scores in the epilogue, and the ending shown at the start of the last scene turns out different at the end.

Fix: Tell your AI: decide the ending when the point of no return passes, save it, and ignore later scores and marks.

Dying after the ending was chosen

If a death is treated like any other deed, a player who dies in the final scene gets a victory ending.

Fix: Tell your AI: a death always ends the story at once with its own ending, even after the ending was locked in.

A restart that forgets the endings

A new game that clears everything also clears the list of endings seen, so the player cannot see how many are left.

Fix: Tell your AI: keep the seen endings apart from the story state and carry them over on a restart.

How to check it works

Works well with

Common questions

how do i add multiple endings to my game

Paste this: Add multiple endings. Keep two scores from 0 to 10, mercy and boldness, and a mark for a found secret. At the end check the endings in this order and take the first that fits: secret (mark and both scores 6 or more), kind (mercy 6 or more and at least boldness), bold (boldness 6 or more), then a quiet ending that always fits. A death always gives its own ending. Remember which endings the player has seen across restarts.

how many endings should a game have

Three to five is a good start for a small game. Each one must be reachable on purpose, and each should feel earned. Many endings that differ by one line feel cheap.

should the ending be decided at the end or earlier

Both can work. Deciding at the end rewards the whole story. Locking it in at a point of no return makes one big choice count and lets the epilogue be written for that ending. Pick one for each story and save the result.

what if the player earns two endings at once

Write down which comes first and test it. The rarest or most demanding ending goes at the top, and a tie between two traits needs its own rule, or the result looks random.

Where it comes from

We could not find a reliable origin for this one yet.

Where this mechanic comes from has not been researched yet.

Games are named only as references. Names and marks belong to their owners, and nothing here is endorsed by them.

What was checked

This is what separates the blueprint from a catalogue entry: the values on this page come from code that runs.

Your AI gets the code

Tested example code comes through the Spielerando connection, so your AI can use it right away. How to connect it