Spielerando

Checkpoints

A checkpoint is a marker in the level that remembers how far the player got. Touch one and it becomes the place to come back to after a death. Only a marker further along replaces the old one, and what was picked up since the last marker is lost with the death.

Also called: Respawn point, Save point, Restart marker.

A small dizzy moth with a satchel lies in a pit while a tall lamp beside it glows and a dotted line curves from the lamp to the moth, with dark lamps behind and one more ahead.
Ninefathom Lamplight, an invented lantern-trail adventure. 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 "Checkpoints" to my game.

What it should do: Checkpoints keep a death from costing the whole level. The player risks only the stretch since the last marker, so a hard part can be tried again and again without walking the same easy part each time.

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

```mermaid
stateDiagram-v2
  [*] --> fresh
  fresh: No marker yet
  saved: Marker active
  respawning: Down, waiting
  fresh --> saved: touches a marker
  fresh --> respawning: dies
  saved --> respawning: dies
  respawning --> fresh: back at the start
  respawning --> saved: back at the marker
```

Use these starting values:
- respawnDelay: 1.2 s
- graceTime: 1.5 s

Watch out for these common mistakes:
- An earlier marker sends the player back: Tell your AI: give every marker a number in the order of the level, and only accept a marker with a higher number than the active one.
- The same marker pays out twice: Tell your AI: touching the marker that is already active does nothing.
- Dying and touching on the same moment: Tell your AI: check for death first. If the character dies on a tick, a marker or pickup on that tick does not count.
- Coming back next to the danger: Tell your AI: after coming back, ignore hits for a short time. Keep the fall check on, so a marker at the edge of a pit cannot trap the player.
- Pickups come back after a death: Tell your AI: keep a count of safe pickups at each marker, and put back only the pickups collected after it.
- A slow frame skips the wait: Tell your AI: count the wait in seconds and subtract the real time of each tick.

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

Checkpoints keep a death from costing the whole level. The player risks only the stretch since the last marker, so a hard part can be tried again and again without walking the same easy part each time.

How it runs, as a diagram

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

touches a markerdiesdiesback at the startback at the markerNo marker yetMarker activeDown, waiting
How it runs, as a diagram
  • No marker yet → Marker active: touches a marker
  • No marker yet → Down, waiting: dies
  • Marker active → Down, waiting: dies
  • Down, waiting → No marker yet: back at the start
  • Down, waiting → Marker active: back at the marker

Good starting values

ValueStart withWhat it changes
respawnDelay1.2 sHow long the player waits between dying and coming back. Long enough to see what happened, short enough that trying again feels quick. It is never zero, because a death with no pause looks like a glitch.
graceTime1.5 sHow long hits do nothing after coming back. Without it the character can come back right next to the thing that just killed it and die again before the player can move. Falling out of the world still counts.

What usually goes wrong

An earlier marker sends the player back

The player walks back past an old marker and touches it. If every touch counts, the next death sends them back to a spot they left long ago.

Fix: Tell your AI: give every marker a number in the order of the level, and only accept a marker with a higher number than the active one.

The same marker pays out twice

Touching the active marker again banks the loose pickups a second time, or restores things that were already used, so the player can farm it.

Fix: Tell your AI: touching the marker that is already active does nothing.

Dying and touching on the same moment

The player touches a marker on the very tick the character dies. If the marker counts, the player respawns at a place they never reached alive.

Fix: Tell your AI: check for death first. If the character dies on a tick, a marker or pickup on that tick does not count.

Coming back next to the danger

The marker sits close to a trap or an enemy. The character comes back, is hit before the player can react, and dies again in a loop.

Fix: Tell your AI: after coming back, ignore hits for a short time. Keep the fall check on, so a marker at the edge of a pit cannot trap the player.

Pickups come back after a death

Everything in the level resets on a death, so a coin collected before the marker can be collected again. Or the opposite: the coin counts but also reappears.

Fix: Tell your AI: keep a count of safe pickups at each marker, and put back only the pickups collected after it.

A slow frame skips the wait

A slow moment gives one very long tick. If the wait is counted in ticks, the character comes back far too early or the wait changes with the frame rate.

Fix: Tell your AI: count the wait in seconds and subtract the real time of each tick.

How to check it works

Works well with

Common questions

how do i add checkpoints to my game

Paste this: Add checkpoints. Each marker has a number in the order of the level. Touching one with a higher number than the active one makes it the place to come back to. After a death, wait about a second, then put the character at the active marker, or at the start if there is none.

how far apart should checkpoints be

Place one before every part that is hard to survive and one after it, so the player never has to repeat the hard part and the easy part together. As a start, aim for a marker every 30 to 60 seconds of play.

why do my collected coins come back after i die

The level was reset without remembering what you picked up. Keep a count of safe pickups at each marker, and put back only the ones collected after it.

should the character be safe right after coming back

Yes, for a short time, about a second and a half to start. Ignore hits but not falls, so a marker at the edge of a pit cannot trap the player.

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