Skip to main content
Because the world is data and the engine is deterministic, a run is reproducible: capture the starting world as a scenario, and re-applying it plus the same seed and inputs reproduces the run.
Start a local server first — see the Quickstart. All commands target http://localhost:3917; every POST sends Content-Type: application/json.

1. Export the world

GET /scenario serializes the current world — entities, rules, templates, and assertions — into one declarative document:
curl -s http://localhost:3917/scenario > world.json
A world.json for a two-entity world with one rule looks like this (the export also emits an explicit null for every unset spawn field — velocity, collider, mesh, … — trimmed here for readability; only the set fields matter on re-apply):
{
  "version": 2,
  "entities": [
    { "position": [-3, 1, 0], "health": 100, "team": 1 },
    { "position": [3, 1, 0], "health": 60, "team": 2 }
  ],
  "rules": [
    {
      "when": { "kind": "death" },
      "filter": "any",
      "actions": [ { "action": "heal", "target": "this", "amount": 10 } ]
    }
  ]
}

2. Rebuild it

POST /scenario wipes the entities and rebuilds the world from the document:
curl -s -X POST http://localhost:3917/scenario \
  -H 'Content-Type: application/json' --data @world.json
# { "ok": true, "entities_spawned": 2, "rules": 1, "templates": 0, "assertions": 0 }

curl -s -X POST http://localhost:3917/step -H 'Content-Type: application/json' -d '{"ticks":1}'
curl -s -X POST http://localhost:3917/observe
# → the two entities (position, health, team) and the rule are reproduced
From here, stepping the rebuilt world with the same inputs reproduces the original run — that is the determinism guarantee, verified by the engine’s content digest.

What round-trips, and what to watch

Entity position, scale, health, and team, and the typed rules, round-trip faithfully.
For an exact replay, rebuild into a fresh process and mind three things:
  • Rebuild on a fresh server. Rules are sticky — re-applying a scenario onto a world that already has rules appends them, doubling the rule set. A clean round-trip starts from a freshly started server.
  • velocity and physics_body are not exported (they serialize as null). Re-add them after rebuilding if your scene relies on them.
  • Entity ids and generations are reassigned on rebuild — thread the new ids from the rebuilt world rather than assuming the originals.