# Cinematics

> The cinematics standard: a world's trailer and scenes, and when they play; every field, rule and version.

A cinematics file holds a world's trailer and its scenes, and says when they play: when a quest starts or ends, after every quest of a type, or when a store item is added. A scene plays its video if it can, else its page, else its shots, and always has a recap for the player who skips it.

| | |
|---|---|
| **Standard** | `alta.cinematics/0.1` |
| **File** | `cinematics.json` (in a universe folder) |
| **Create it** | `alta new cinematics my-scenes` |
| **Check it** | `alta lint my-scenes` |
| **JSON Schema** | [alta.cinematics.schema.json](https://github.com/altasystem-ai/alta/blob/main/docs/standards/schemas/alta.cinematics.schema.json) |

## Minimal example

A trailer of two shots: a title card, then the camera moves to the centre of the map.

```json [cinematics.json]
{
  "schema": "alta.cinematics/0.1",
  "trailer": "trailer",
  "scenes": {
    "trailer": {
      "title": {
        "en": "Your machine, as a world",
        "fr": "Ta machine, comme un monde"
      },
      "recap": [
        {
          "en": "What you see is what really runs on your machine.",
          "fr": "Ce que tu vois est ce qui tourne vraiment sur ta machine."
        }
      ],
      "shots": [
        {
          "kind": "card",
          "dur": 3,
          "title": {
            "en": "Your machine, as a world",
            "fr": "Ta machine, comme un monde"
          }
        },
        {
          "kind": "pan",
          "dur": 2,
          "to": "centre",
          "zoom": 1.4
        }
      ]
    }
  }
}
```

## Fields

### Cinematics

The file itself.

| Field | Type | Required | Description |
|---|---|---|---|
| `schema` | "alta.cinematics/0.1" | yes | The standard: `alta.cinematics/0.1`. |
| `trailer` | string | no | The scene played as the world's trailer, by id. |
| `quests` | map of object | no | Scenes for given quests, by quest uid. |
| `quests.<id>.intro` | string | no | The scene played when the quest starts. |
| `quests.<id>.outro` | string | no | The scene played when it is done. |
| `types` | map of string | no | The outro of every quest of a type, by quest type. |
| `items` | map of string | no | The scene played when a chart is added, by chart id. |
| `scenes` | map of scene | yes | The scenes, by id. |

### Scene

A scene lasts 120 seconds at most. "Skip" always shows its recap, and a scene the player has seen never plays again by itself.

| Field | Type | Required | Description |
|---|---|---|---|
| `title` | text | yes | The scene's title. |
| `recap` | text[] | yes | The scene in a few lines: shown when it is skipped, and when nothing else can play. |
| `video` | string | no | A video: a path served by the game (`/…`) or an `https://` address. |
| `page` | string | no | A page of the game to show in a frame, by path (`/…`). |
| `shots` | shot[] | no | The shots, played in order. |

### Shot

`kind` says what the shot is; each kind has its own fields.

| Field | Type | Required | Description |
|---|---|---|---|
| `kind` | enum | yes | What the shot is; each kind has its own fields. |
| `dur` | number | yes | How long it lasts, in seconds (at most 30). |
| `title` | text | no | A card's title. |
| `text` | text | no | A card's text, or what an agent says (`line`). |
| `to` | string | yes | Where a `pan` goes: an entity id, `centre`, `edge` or `wide`. |
| `zoom` | number | no | The zoom of a pan, from 0.3 to 3. |
| `who` | enum | no | The agent who speaks a `line`, by role. |
| `name` | enum | yes | The effect: `burst`, `flash`, `rings` or `letterbox`. |
| `entity` | string | yes | The entity a `reveal` shows, by id. |

## Rules and errors

Each rule `alta lint` applies to cinematics, with its section on the [errors page](https://docs.altasystem.ai/reference/errors#standard-cinematics).

## Full example

<details class="alta-full-example">
<summary>A trailer, a quest's intro and outro, a type's outro and a store item's scene</summary>

```json [cinematics.json]
{
  "schema": "alta.cinematics/0.1",
  "trailer": "trailer",
  "quests": {
    "core.tidy-downloads": {
      "intro": "tidy-intro",
      "outro": "tidy-outro"
    },
    "focus.quiet-hours": { "outro": "quiet-outro" }
  },
  "types": { "repair": "fixed", "daily": "day-done" },
  "items": { "evening-pack": "pack-arrives" },
  "scenes": {
    "trailer": {
      "title": {
        "en": "Your machine, as a world",
        "fr": "Ta machine, comme un monde"
      },
      "recap": [
        {
          "en": "What you see is what really runs on your machine.",
          "fr": "Ce que tu vois est ce qui tourne vraiment sur ta machine."
        },
        {
          "en": "Quests move the real setup forward.",
          "fr": "Les quêtes font avancer la vraie configuration."
        }
      ],
      "video": "/media/trailer/neutral.mp4"
    },
    "tidy-intro": {
      "title": {
        "en": "Too many downloads",
        "fr": "Trop de téléchargements"
      },
      "recap": [
        {
          "en": "The guardian proposes a rule for old downloads.",
          "fr": "Le gardien propose une règle pour les vieux téléchargements."
        }
      ],
      "shots": [
        {
          "kind": "pan",
          "dur": 2,
          "to": "agent:guardian",
          "zoom": 1.6
        },
        {
          "kind": "line",
          "dur": 4,
          "who": "guardian",
          "text": {
            "en": "Your downloads pile up. Let's choose a rule.",
            "fr": "Tes téléchargements s'entassent. Choisissons une règle."
          }
        }
      ]
    },
    "tidy-outro": {
      "title": {
        "en": "A tidy machine",
        "fr": "Une machine rangée"
      },
      "recap": [
        {
          "en": "Each week, old downloads follow your rule.",
          "fr": "Chaque semaine, les vieux téléchargements suivent ta règle."
        }
      ],
      "page": "/film/neutral/tidy.html"
    },
    "quiet-outro": {
      "title": {
        "en": "Quiet hours",
        "fr": "Heures calmes"
      },
      "recap": [
        {
          "en": "Nothing disturbs you during your quiet hours.",
          "fr": "Rien ne te dérange pendant tes heures calmes."
        }
      ],
      "shots": [
        {
          "kind": "fx",
          "dur": 1,
          "name": "flash"
        },
        {
          "kind": "card",
          "dur": 3,
          "title": {
            "en": "Quiet hours on",
            "fr": "Heures calmes activées"
          },
          "text": {
            "en": "The operator holds the door.",
            "fr": "L'opérateur tient la porte."
          }
        }
      ]
    },
    "fixed": {
      "title": { "en": "Fixed", "fr": "Réparé" },
      "recap": [
        {
          "en": "What had stopped runs again.",
          "fr": "Ce qui s'était arrêté tourne à nouveau."
        }
      ]
    },
    "day-done": {
      "title": {
        "en": "Done for today",
        "fr": "Fait pour aujourd'hui"
      },
      "recap": [
        {
          "en": "This quest comes back tomorrow.",
          "fr": "Cette quête revient demain."
        }
      ]
    },
    "pack-arrives": {
      "title": {
        "en": "A new place appears",
        "fr": "Un nouveau lieu apparaît"
      },
      "recap": [
        {
          "en": "The evening pack adds its own quests.",
          "fr": "Le pack du soir ajoute ses propres quêtes."
        }
      ],
      "shots": [
        {
          "kind": "pan",
          "dur": 2,
          "to": "edge"
        },
        {
          "kind": "reveal",
          "dur": 2,
          "entity": "module:evening-pack"
        },
        {
          "kind": "fx",
          "dur": 1,
          "name": "rings"
        }
      ]
    }
  }
}
```

</details>

## Versions

| Version | What it adds | Read by the game |
|---|---|---|
| `alta.cinematics/0.1` | Trailer, scenes, shots, and when they play | current |

## Guides that use it

- [Create a cinematic](https://docs.altasystem.ai/guides/cinematics/scene)
- [Create a universe](https://docs.altasystem.ai/guides/universes/create)
