> ## Documentation Index
> Fetch the complete documentation index at: https://docs.eucaengine.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Build a scene

> Assemble a world by spawning entities with typed components, step it so transforms settle, and read the assembled scene back.

A scene in Euca is just a set of [entities with components](/concepts/world-as-table) — there
is no scene file format to learn first. You build a scene by spawning entities, and you read
it back with `observe`.

<Note>
  Start a local server first — see the [Quickstart](/quickstart). All commands target
  `http://localhost:3917`; every `POST` sends `Content-Type: application/json`.
</Note>

## 1. Spawn the entities

Each `/spawn` adds a row to the world table. Give it a position and whatever components the
entity needs — physics, health, team, a collider, and so on.

```bash theme={null}
# A Kinematic mover on team 1, drifting along +x.
curl -s -X POST http://localhost:3917/spawn \
  -H 'Content-Type: application/json' \
  -d '{"position":[0,1,0],"velocity":{"linear":[1,0,0]},"physics_body":"Kinematic","health":100,"team":1}'

# A static target on team 2.
curl -s -X POST http://localhost:3917/spawn \
  -H 'Content-Type: application/json' \
  -d '{"position":[5,1,0],"physics_body":"Static","health":60,"team":2}'
```

The full set of spawnable components — colliders, AI, roles, inventory, and more — is in the
[`POST /spawn` reference](/api-reference/world/create-entity-with-optional-components).

<Warning>
  **Step before you read.** A spawn sets an entity's local transform, but world-space
  positions only propagate when the simulation advances. Always `POST /step {"ticks":1}`
  before `observe` or `scene/save`, or every position reads back as the origin `[0,0,0]`.
</Warning>

## 2. Read the assembled scene

```bash theme={null}
curl -s -X POST http://localhost:3917/step \
  -H 'Content-Type: application/json' -d '{"ticks":1}'

curl -s -X POST http://localhost:3917/observe
```

`observe` returns the whole scene as a [flat table](/concepts/world-as-table) — one row per
entity, with its components.

## 3. Point a camera (render / editor hosts)

A render- or editor-hosted server owns a camera you can drive:

```bash theme={null}
# Place the camera.
curl -s -X POST http://localhost:3917/camera \
  -H 'Content-Type: application/json' -d '{"eye":[10,10,10],"target":[0,0,0]}'

# Or snap to a preset view: top, front, back, right, left, perspective.
curl -s -X POST http://localhost:3917/camera/view \
  -H 'Content-Type: application/json' -d '{"view":"top"}'

# Or frame a specific entity.
curl -s -X POST http://localhost:3917/camera/focus \
  -H 'Content-Type: application/json' -d '{"entity_id":1}'
```

<Info>
  The camera **pose** is CPU state, so these endpoints work on a headless host too — `GET /camera`
  returns the pose and the writes move it. What's host-only is the *rendered output*: nothing is
  drawn and `/screenshot` returns 503 without a render host. Build and inspect scene *data* headless;
  use a render or editor host to view it.
</Info>

## 4. Persist the scene

The durable, rebuildable form of a scene is a **scenario** — a declarative document of the
whole world that you export and re-apply:

```bash theme={null}
curl -s http://localhost:3917/scenario > scene.json
```

See [Deterministic replay](/guides/deterministic-replay) for the round-trip. There is also a
quick `POST /scene/save {"path":"scene.json"}` that dumps the world to a JSON file, but note
its loader is **lossy** — `scene/load` restores position, scale, and physics body only, and
drops health, team, velocity, and rotation. For a faithful rebuild, prefer the scenario.
