# `core/cinematics/cinematics.ts`

<p class="generated-note">Generated from the exports of <a href="https://github.com/altasystem-ai/alta/blob/main/core/cinematics/cinematics.ts"><code>core/cinematics/cinematics.ts</code></a> · <code>npm run docs:gen</code></p>

The cinematics standard (alta.cinematics/0.1, PLAN-V2 §2.3): trailers of a world, quest intros and outros, a scene by quest type, a scene by store item. One file per world (universes/&lt;id&gt;/cinematics.json) and a neutral fallback (content/cinematics.json). A scene plays, in this order: its video when it can be read, else its page (same origin, in a frame), else its shots (played by the game's engine), else its recap as a narrated card. "Skip" always shows the recap, then "Continue". A scene already seen (Save.seen) never plays again by itself; it stays in the menu.

**Standards that cite this file**: [alta.cinematics/0.1: trailers and scenes](https://docs.altasystem.ai/reference/advanced/specs/alta-cinematics-0.1)

## Exports

### `Shot` 
```ts
type Shot =
  | { kind: "card"; dur: number; title?: Text; text?: Text }                  // title card
  | { kind: "pan"; dur: number; to: string; zoom?: number }                   // camera to an entity id, "centre", "edge" or "wide"
  | { kind: "line"; dur: number; who?: AgentRole; text: Text }                // a line, with the agent's portrait
  | { kind: "fx"; dur: number; name: "burst" | "flash" | "rings" | "letterbox" }
  | { kind: "reveal"; dur: number; entity: string };
```

### `SHOT_KINDS` 
```ts
const SHOT_KINDS = ["card", "pan", "line", "fx", "reveal"] as const
```

### `SHOT_FX` 
```ts
const SHOT_FX = ["burst", "flash", "rings", "letterbox"] as const
```

### `Cutscene` 
```ts
interface Cutscene {
  title: Text;
  /** Required: what is read when the scene is skipped. */
  recap: Text[];
  /** A served path, or https. */
  video?: string;
  /** A same-origin path played in a frame. */
  page?: string;
  /** Played by the game's engine while there is no video. */
  shots?: Shot[];
}
```

### `Cinematics` 
```ts
interface Cinematics {
  schema: "alta.cinematics/0.1";
  /** Scene id of the world's trailer (first entry, and the "Replay" menu). */
  trailer?: string;
  quests?: Record<string, { intro?: string; outro?: string }>;
  types?: Partial<Record<QuestType, string>>;
  items?: Record<string, string>;
  scenes: Record<string, Cutscene>;
}
```

### `MAX_SCENE_S` 
Longest scene the engine plays (seconds): a trailer is 30 to 60 s, a scene a few seconds.

```ts
const MAX_SCENE_S = 120
```

### `checkScene` 
Problems of one scene (empty = playable).

```ts
function checkScene(id: string, c: Cutscene, entityIds?: Set<string>): string[]
```

### `checkCinematics` 
Problems of a cinematics file (empty = playable): every reference names a scene, quest references name known
quests, types are quest types, `entityKinds` is accepted for future checks of reveals (any id is allowed today,
since store items bring their own).

```ts
function checkCinematics(c: unknown, questUids: Set<string>, entityKinds: readonly string[] = [], entityIds?: Set<string>): string[]
```

### `outroOf` 
The scene that ends a quest: cinematics outro, else the 0.1 onboarding cutscene, else the scene of its type.

```ts
function outroOf(uid: string, type: QuestType, cin?: Cinematics, legacy?: Record<string, Cutscene>): Cutscene | undefined
```

### `playMode` 
How a scene plays: video, page, shots, or the narrated recap.

```ts
const playMode = (c: Cutscene): "video" | "page" | "shots" | "recap" => …
```
