A trailer from real footage and a score written in numpy
150 in-engine clips shot at 1080p60 over CDP screencast, cut in Remotion on a 90 BPM grid, scored in numpy, with the narrator auditioned by machine.

Contents
- The shape of the pipeline
- Shooting 150 clips without touching anyone's screen
- A camera that isn't in the game
- Recording
- A private browser and server
- The edit is TypeScript
- The review loop
- A score with no samples
- The narrator was picked by machine and chosen by ear
- Auditions
- The script
- The mix
- What's still wrong with it
- Timeline
- Related posts
A 3:04 trailer and a 30-second teaser, each with and without narration, from real in-engine footage against a real Colyseus server. One agent owned it from shot list to final encode while a dozen others kept changing the game. The music is ~1,250 lines of Python that write a WAV.
The shape of the pipeline
trailer/src/timeline.json is the clock: 90 BPM, a bar of 8/3 s (exactly 128,000 samples at 48 kHz), every section with its mood and the second each hit lands. The edit, the score and the VO mix all read it, so cuts and drum hits can't drift.
{
"bpm": 90,
"bar": 2.6666667,
"total": 184.0,
"hardCutToBlack": 182.0,
"sections": [
{ "id": "hook", "from": 21.3333, "to": 32.0,
"mood": "tension: ticking clock pulse on 8ths, muted low strings; three stabs at 24.0, 26.6667,
29.3333 (Type a name / Pick a class / You're in); hard stop + hit at 32.0" },
{ "id": "endgame", "from": 136.0, "to": 157.3333,
"mood": "the hammer: re-entry at 136.0 with a massive braam; one slam (braam + taiko + crash)
on every downbeat …" }
]
}The arc: a lantern cold open, wordmark on the first braam, the hook (the real landing flow: "Type a name / Pick a class / You're in"), three classes, six acts at eight seconds each, a montage, a cozy breath (pets and housing), the endgame hammer with a slam every downbeat, the Unmaker, the title.
Shooting 150 clips without touching anyone's screen
A camera that isn't in the game
The game camera is fixed (yaw 45°, pitch 55°, 26 m back): right for play, flat for a trailer. cine.ts is dev-only and never imported by the game:
// DEV-ONLY trailer capture helper. Never imported by the game: the trailer harness loads it into a
// running /play page through the Vite dev server (`await import('/src/game/dev/trailer/cine.ts')`)
// and drives it from Playwright. It adds a cinematic camera (orbit / crane / dolly / push-in poses
// around a point, the hero or any entity), a HUD toggle, and a few read-only world queries.
// Everything hooks public engine members from the outside, so no game file changes.- Orbit, crane, dolly and push-in around a point, the hero, any entity, or the hero–boss midpoint
- An A* travel helper, scripted fights, pets, a party
- Co-op shots use three scripted companions from
capture/companions.tsover real websockets
Recording
CDP screencast, not a screen recorder. Timestamped JPEGs go to disk, then the concat demuxer gives each its real duration for a constant 60 fps:
cdp.on('Page.screencastFrame', (ev) => {
const meta = frameMeta.parse(ev.metadata)
const t = meta.timestamp ?? performance.now() / 1000
const file = join(dir, `${String(n++).padStart(6, '0')}.jpg`)
writeFileSync(file, Buffer.from(ev.data, 'base64'))
frames.push({ file, t })
void cdp.send('Page.screencastFrameAck', { sessionId: ev.sessionId }).catch(() => undefined)
})
await cdp.send('Page.startScreencast', { format: 'jpeg', quality: opts.quality ?? 92, maxWidth: W, maxHeight: H, everyNthFrame: 1 })
/** Variable-timestamp JPEG frames → constant-rate H.264 via the concat demuxer. */
// … list.push(`file '${f.file}'`, `duration ${d.toFixed(5)}`) … then
// ffmpeg -f concat -i list.txt -vf fps=60,scale=1920:1080:flags=lanczos,format=yuv420p -crf 15Encodes run after each session so ffmpeg never competes with the game.
A private browser and server
Headless Chromium in a temp profile, forced to the discrete GPU (ANGLE on D3D11), against a private dev server on port 4483. Other agents saved files constantly and Vite HMR would reload /play mid-shot, so only the first document load is allowed:
/**
* Other agents save files constantly and Vite's HMR would full-reload /play mid-shot. Only the
* first document load of /play is allowed; later reloads are dropped (ERR_ABORTED leaves the live
* page untouched). Plain HTTP routing on our own isolated browser context: no socket interception.
*/
export async function pinDocument(page: Page): Promise<void> {
let loaded = false
await page.route(/\/play\?/, async (route) => {
if (route.request().isNavigationRequest() && route.request().frame() === page.mainFrame()) {
if (loaded) {
console.log(' (dropped a dev-server reload)')
await route.abort('aborted')
return
}
loaded = true
}
await route.continue()
})
}capture/sessions.ts (623 lines) names sessions <section>_<what> (a1_boneking_reveal, warden_gale, a5_aurora, coop_queen_kill…). Each makes fresh guests via tRPC, maxes them with dev cheats where needed, walks to a spawn and films. Final count: 150 clips, 7.4 GB.

The edit is TypeScript
An EDL of clips, cards and SFX cues on the bar grid:
// The trailer cut. 90 BPM: bar = 8/3 s, beat = 2/3 s. Cuts land on the grid in timeline.json.
const BAR = 8 / 3
const BEAT = 2 / 3
clips.push(
clip('realm_crowd_low', 32.0, BAR, { from: 1.0, grade: 'night', bright: 1.15 }),
clip('warden_gale', 34.667, BAR, { from: 2.0, grade: 'night', bright: 1.2, flash: 'gold', shake: [0.05] }),
clip('warden_skyfall', 37.333, BAR, { from: 1.4, grade: 'night', bright: 1.2, shake: [0.9] }),
clip('stalker_rain', 40.0, BAR, { from: 2.0, grade: 'warm', flash: 'gold', shake: [0.05] }),
// …
clip('a4_coast_fight', 50.667, BEAT, { from: 1.4, grade: 'cold', flash: 'white' }),
clip('a6_garden_fight', 51.333, BEAT, { from: 2.0, grade: 'void' }),
)
cards.push(card('class', 'The Warden', 34.767, 2.45, { sub: 'Steel and wrath', scrim: 0.45 }))Film.tsx(240 lines, Remotion 4): named grades (night,warm,cold,void,ember…) as CSS filter plus soft-light tint, push-ins, pans, decaying shake after hits, flash frames, letterbox, grain, vignette- Cards in Cinzel and Alegreya italic, gold on stone per
ui.md; no eyebrows, no trailing periods tools/check-edl.tschecks every clip exists andfrom + dur × ratefits its capture, catching an overrunning slow-mo before a full render

The review loop
The agent can't watch video but can read images. tools/review.py pulls a frame every two seconds, labels it and tiles 24 per sheet. Notes like "16.4 s crushed to black" or "the Leviathan hidden behind the arena wall" became EDL fixes or reshoots. Ten render logs in trailer/out.

A score with no samples
No licensed music, no sample library, no generative audio. score.py synthesizes everything in numpy and scipy: supersaw braams through a swept resonant low-pass, pitched-sine taiko, noise snares and crashes, a formant-filtered saw choir, FM bells, a music box, Shepard risers, reverse swells. The braam:
def braam(root: int, dur: float = 2.0, intensity: float = 1.0, seed: int = 1, tail: float = 1.2,
voices: int = 8) -> np.ndarray:
n = S(dur + tail)
t = tarr(n)
notes = [(root, 0.55), (root + 12, 1.0), (root + 19, 0.85), (root + 24, 0.6), (root + 31, 0.3)]
x = np.zeros((2, n))
scoop = 2 ** (-45 * np.exp(-t / 0.07) / 1200) # a 45-cent pitch scoop into the note
for i, (m, lv) in enumerate(notes):
x += lv * supersaw(mtof(m) * scoop, n, voices=voices, detune=20, width=0.95, seed=seed * 37 + i, drift=4)
open_t = 0.3
peak = 250 + 2500 * intensity
fc = 70 * (peak / 70) ** np.clip(t / open_t, 0, 1) ** 0.8 # the filter opens over 300 ms …
# … then closes exponentially; tanh drive, plus a sine sub under the root- Bus: synthetic convolution hall (3 s RT60), high-passed returns, mono lows, compressor, lookahead limiter
- Master: −16 LUFS integrated, peaks −1.9 dBFS; deterministic seeds, ~2 minutes to render
- Self-check: a spectral-flux onset detector around every timeline hit; all land within ±1.3 ms

The narrator was picked by machine and chosen by ear
The first cut had no voice. Once an ElevenLabs key was available, the voiced cuts were built on top without touching the picture.
Auditions
Five library voices on Eleven v3 read one line:
[ominous] Four hundred years... the door held. [pause] Now the lanterns are going out. [whispers] And the dusk is coming... for all of us.
Each was measured for median F0, low-end energy share, and a speech-to-text round trip. All five transcribed exactly, so weight and timbre decided.
"Don, Movie Trailer Narrator" won on low-end weight and natural delivery: numbers made the shortlist, a listen made the pick.
The script
Two seeded takes per line; each is re-transcribed and scored on word mismatch, duration as tiebreaker:
LINES = {
'door': '[slow, ominous] For four hundred years... the door held.',
'lanterns': '[low, grave] Now the lanterns are going out.',
'dusk': '[whispers] And the dusk... is coming for all of us.',
'fallen': '[gravelly, ominous] Six lands have fallen to the Gloam.',
'heart': '[low] And at the end of the world... the last lantern burns.',
'alone': '[rising, determined] But you will not stand alone.',
'hearth': '[warmly, softer] And when the storm breaks... there is a hearth to come home to.',
'unmaker': '[slow, menacing] The Unmaker... waits.',
'duskbound': '[commanding, epic] You are... Duskbound.',
}
for take in range(2):
tts(VOICE, text, p, stability=0.5, seed=1000 + take)
heard = transcribe(p)
miss = len(set(words(text)) ^ set(words(heard))) # words dropped or invented
# … trimmed duration as the tiebreaker
best = min(takes, key=lambda t: (t['miss'], t['dur']))Bracketed Eleven v3 audio tags steer delivery. The key is read from the gitignored .env and never printed.
The mix
mix_vo.py: 70 Hz high-pass, presence lift at 2.5–5 kHz, 3:1 RMS compression, a dark filtered-noise room, −15 LUFS- Score ducked 6–9 dB under each line (250 ms attack, 700 ms release); every line sits at least 5.5 LU above its bed
- Voiced cuts reuse the EDL, dropping cards that repeat a spoken line:
const spoken = new Set(['Four hundred years the door held', 'The lanterns are going out',
'And the dusk is coming for all of us', 'The Unmaker waits', 'The dusk is coming'])
// (trimmed: the real recard also turns "Rest between the storms" into its sub-line only)
const recard = (c: CardCut): CardCut[] => (spoken.has(c.text) ? [] : [c])
export const TRAILER_VO: Edl = { ...TRAILER, cards: TRAILER.cards.flatMap(recard), music: 'audio/gen/score_vo.wav' }tools/finish.py: two-pass loudnorm to −16 LUFS / −1.5 dBTP with video copied, plus two-pass share encodes (~26 MB for the full trailer).

What's still wrong with it
From the plan's known-gaps list:
- No Leviathan. The arena hid it from every angle; Act IV closes on the Drowned Choir.
- "Runewords" rides over rift footage. An anvil capture exists (17:57) but isn't cut in.
- The ladder shot shows test heroes (SMOKETEST, PROBETEST). Needs seeded names and a reshoot.
- "Forty heroes to a realm" was first a smaller bot crowd; it's now the real forty-hero march (forty players).
Timeline
| First surviving capture | 15:51 |
| Last reshoot | 17:57 |
| Non-voiced trailer rendered | 18:25 |
| Voiced cuts and share encodes | 18:47 |
Empty folder to finished trailer in under four hours.
Related posts
- Forty players, one room: the showcase footage and the netcode behind it
- The landing page and the intro: the same engine as a stage, with no server
- The renderer: everything the camera is pointed at