beats
The demo's beat registry and its slice bootstrap. A beat is a SWITCH the film throws at a moment; everything continuous is a component's `update(dt)`.
beats
The demo's beat registry and its slice bootstrap. A beat is a SWITCH the film
throws at a moment; everything continuous is a component's update(dt).
The vocabulary
Fourteen fixed names, one per shot, fired at that shot's start:
b01_gate b02_facade b03_hall_push b04_musicbox b05_mirrors b06_ballroom
b07_floor b08_dressing b09_stage b10_masks b11_chandelier_fall b12_aftermath
b13_reform b14_face_closes
Several slices may register the same beat; every handler runs, in slice order: hall, props, air, look, stagecraft. A handler that raises is logged and the rest still run, so one broken slice does not take the film with it.
A cue that lives inside a shot is declared with extra(name, t) and named
bNN_<something>, so its shot is readable from its name. Those are fired by the
FilmClock component off the film clock, and re-armed when the clock is seeked
backwards. Every declared extra should have a handler: one that does not warns on
every take and describes something the film does not do.
Exports
| Name | What it does |
|---|---|
SLICES | The five build slices, in the order their handlers run. |
BEATS | The fourteen shot beats. |
on(name, fn) | Register a handler. |
extra(name, t) | Declare a cue inside a shot. |
extras() | Every declared extra, sorted by time. |
fire(name, t) | Run every handler for a beat, returning how many ran. An unregistered beat warns and continues. |
registered() | Which beats currently have handlers, and how many each. |
slices() | Every slice module that loads. A missing slice is skipped, not fatal. |
build(root) | Run every slice's content(root). Called from the scene build. |
bind() | Clear every registration and re-run each slice's register(). Idempotent; call it before any take so a hot-reloaded slice is bound again. |
reset() | Run every slice's reset(). Returns every slice to its shot-1 state. |
Why bind() is called before every take
A slice's handlers live in this module's own state, and a write to any file in
the demo's require graph re-evaluates it and empties the registry. On a world
several people are authoring into at once that happens constantly. play.luau
binds before every take for that reason, and FilmClock binds again if the
registry empties under a running film.
Scoped to this part · feeds back into the world's score.