Make a cinematic in 5 steps
From an empty timeline to a cinematic your mission plays. See also How do I make a cinematic.
1. Make it in the editor
- Open the map editor and the Cinematic panel in the bottom drawer.
- Press New, name it
td.intro. - Fly the view where the shot starts and press K: a camera key at the playhead.
- Move the playhead to 6 s, fly elsewhere, press K again.
- Double-click the dialogue lane's row to add a line; set its speaker and words in the Inspector.
- Ctrl+S saves the map and writes
cinematics/td.intro.json.
Press Space to preview, and drag the playhead to scrub.
2. The file it writes
json
{
"id": "td.intro",
"length": 12,
"lanes": [
{
"id": "camera",
"kind": "camera",
"items": [
{ "at": 0, "value": { "x": 16, "z": 32, "distance": 30, "yaw": 0.3, "pitch": 0.9 } },
{ "at": 6, "value": { "view": "gate" }, "ease": "inOutQuad" }
]
},
{
"id": "dialog",
"kind": "dialog",
"items": [{ "at": 1, "for": 3, "speaker": "td.commander", "text": "Hold the road." }]
},
{ "id": "units", "kind": "units", "items": [{ "at": 4, "unit": "hero", "clip": "cheer" }] }
],
"markers": [{ "at": 6, "name": "gate" }],
"params": { "road": { "kind": "points", "required": true } },
"play": { "hold": true, "back": true }
}3. Give it to the view
ts
import intro from './cinematics/td.intro.json'
import { cinematicsFrom, readCinematic } from '@v12-engine/client'
cinematics: {
defs: {
'td.intro': { def: readCinematic(intro), back: true },
// or every file of a folder at once, by id
...cinematicsFrom(import.meta.glob('./cinematics/*.json', { eager: true }))
},
speakers: { 'td.commander': { name: 'Commander', portrait: { type: 'captain' } } }
}4. Play it from the mission
ts
import { cinematic, defineSequence } from '@v12-engine/engine'
export const briefing = defineSequence({
id: 'td.briefing',
steps: [cinematic('td.intro', { hold: true, wait: 'ended' }), (world) => world.message(PLAYER, 'defendTheRoad', 'info')]
})Or with no code: in the editor's Content drawer, put a region down and set its cinematic (MapRegion.cinematic). It plays the first time a unit walks in. See Triggering from a mission.
5. Try it in the game
Press Play in game (Ctrl+Enter) in the Cinematic panel: it starts Play here and plays the cinematic as it is now, with your game's code around it. Problems (a unit renamed, a missing view) show in the Problems panel and on the clips; F8 jumps to the next one.
Then
- Move the camera along a path, follow a unit, cut with a dissolve: Cameras and shots.
- Talking portraits, choices, subtitles: Dialogue.
- Music and sound: Music and sound.
- Add code around it (hooks, cues, refs): File format reference.