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:
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):
2. Rebuild it
POST /scenario wipes the entities and rebuilds the world from the document:
What round-trips, and what to watch
Entity position, scale, health, and team, and the typed rules, round-trip faithfully.
- 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.
velocityandphysics_bodyare not exported (they serialize asnull). 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.