# Rooms

room.json holds a room's settings, its rules, and every thing standing in it.

Each room is a folder under `rooms/`, named like the room, with a `room.json`
and its script files.

## room.json

```json
{
  "id": "room:tpi_room_…",
  "name": "Skybound",
  "root": true,
  "width": 48, "height": 48,
  "view": "iso", "view_height": 1, "camera": "fit",
  "chat": "line", "watch": "off", "capacity": 8,
  "rules": [
    { "kind": "rounds", "seconds": 90, "min": 2, "countdown": 5, "results": 8 },
    { "kind": "winner", "by": "points" }
  ],
  "things": [
    { "id": "placed_…", "thing": "Guardian", "x": 24, "y": 20 },
    { "thing": "Skybound Sign", "x": 20, "y": 26, "bricks": [{ "kind": "sign", "text": "Strike the guardian." }] },
    { "thing": "Spawn Pad", "x": 24, "y": 30, "rotation": 90, "bricks": [{ "kind": "spawn", "team": "red" }] },
    { "door": "Belt Island", "x": 40, "y": 10 }
  ]
}
```

## Settings

| field | values | meaning |
| --- | --- | --- |
| `root` | `true` on one room | the game's own room, where its door leads |
| `width`, `height` | 12 to 48 | the room in tiles |
| `view` | `iso`, `top` | the world's own view, or a board from above |
| `view_height` | 0, 1, 2 | seen from above: a plan, three-quarter, tall fronts |
| `camera` | `fit`, `follow` | the whole board, or the player |
| `chat` | `line`, `open`, `off` | Enter opens one line; the bar stays open; no chat |
| `watch` | `off`, `quiet`, `open` | whether a copy can be watched, and whether watchers talk |
| `capacity` | 1 to 1000 | people per copy |

A room folder with no matching room on the server is **created** on push.
A room on the server with no folder is left as it is, and the push says so.

## Rules

`rules` is the list of bricks on the game for this room: `rounds`, `winner`,
`teams`, `lives`, `score`, `welcome`. No `rounds` makes a hangout. Every
brick and its fields: [Bricks](/studio/bricks).

## Things

Each entry in `things` is one placed thing:

| field | meaning |
| --- | --- |
| `thing` | the name of a thing in the game's stock |
| `door` | instead of `thing`: another room of the game; the door stands here |
| `x`, `y` | the tile |
| `id` | written by a pull; a thing that keeps its id and its tile stays as it is, everything else is placed anew |
| `bricks` | bricks on this one placed thing, on top of the thing's own |
| `rotation` | 0, 90, 180, 270 |
| `height` | its lift, in voxels |
| `look` | a filter name, as the placement panel offers |
| `hidden` | `true` for a thing a script shows later |

Things are placed in the order listed; a tile another thing already covers
refuses, and the push names the entry.

## Script files

`rooms/<Room>/<file>.lua` are the room's files, each compiled as its own
block, in name order (name them `1-main.lua`, `2-shop.lua` if it matters).
Globals are shared between files and with the scripts on things. Up to 8
files of 16 KB each. A room with no `.lua` file has no script.

