Skip to content

core/cinematics/cinematics.ts ​

Generated from the exports of core/cinematics/cinematics.ts · npm run docs:gen

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/<id>/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

Exports ​

Shot type ​

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 const ​

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

SHOT_FX const ​

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

Cutscene interface ​

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 interface ​

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 const ​

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 function ​

Problems of one scene (empty = playable).

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

checkCinematics function ​

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 function ​

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 const ​

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

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

The standard, the SDK and the CLI are Apache-2.0; Alta System OS and Alta World are FSL-1.1-ALv2.