EMBERLINE
README.md
emberline.stages — the four painted stages
Kessai, in four places, each one a stack of painted parallax layers that slide against the fight camera at their own rate.
| id | title | the light | what moves |
|---|---|---|---|
platform | SODDEN PLATFORM | sodium lamps in smog | rain, a full crowd, steam off a vent, a train on the viaduct |
lantern | LANTERN ROW | paper lanterns and shop windows | lanterns swinging on their wires, steam off the pots, a close crowd |
coaldeck | THE COAL DECK | furnace doors and the floor itself | doors breathing, ash falling, two cranes tracking their road |
endofline | END OF LINE | one working lamp and the last train | three banks of fog at three speeds, steam bleeding under the carriages |
Using it
local Bus = require("emberline.bus")
Bus.call("stage", "load", "coaldeck") -- the canvases come up over ~4 frames
Bus.call("stage", "info") -- what is up, where every layer sits
The stage follows Bus.state.stage on its own, so setting that is enough; a
stage id it cannot paint falls back to one it can rather than leaving the fight
in a void. Bus.services.stage is load / unload / react / update / info / ready / cheer / pin. pin(id) holds one stage up for authoring and
photography; pin(nil) hands control back to the game.
The crowd answers the fight without being asked: the director listens for
fight.ko, fight.roundStart, fight.roundEnd, fight.superStart,
fight.throwLand and heavy fight.hit, and brings the house up off the
barrier for a few seconds. info().cheerCount counts the reactions answered,
which outlives the reaction itself.
Layers
Rules.LAYERS fixes the depths and the parallax factors. A layer at parallax
p sits at camX * (1 - p) in world space, so it travels across the screen at
p times the rate of the fight plane: p = 1 is nailed to the ground and
p = 0 rides with the camera.
| key | z | parallax | sheet |
|---|---|---|---|
sky | -40.0 | 0.04 | 416 x 240 |
farBack | -16.0 | 0.18 | 456 x 240 |
midBack | -7.0 | 0.42 | 532 x 240 |
nearBack | -2.5 | 0.72 | 628 x 240 |
apron | +0.92 | 1.00 | 712 x 34, hanging below the fight plane |
foreground | +4.0 | 1.25 | 792 x 40-96, hanging from the top of frame |
Every sheet is cut to the same grid: row 0 is world y = -0.55, row 28 is the
ground the fighters stand on, and row 230 is the top of the frame. A shape
drawn at row 28 sits on the floor in all four stages.
Writing another stage
A stage module returns build(), which hands back { layers, props, state }.
emberline.stages.paint is the kit: a plain Luau buffer of palette indices
with rect / poly / ellipse / ring / line / dither / scatter on it, plus the
shared industrial shapes Kessai is made of — skyline, truss, arch,
rivets, lamp, crowd and drawCrowd. Compose the whole layer in the
buffer and hand it over once; that is why a 500 x 240 painting costs four
milliseconds instead of thirty thousand calls.
local P = require("emberline.stages.paint")
local pal = P.palette({ { "sky", "#1b2029" }, { "lamp", "#ffb642" } })
local b = P.new(P.LAYERS.midBack.w, P.LAYOUT.h)
b:rect(0, 0, b.w - 1, 60, pal.i.sky)
return { layers = { P.layer("midBack", b, { palette = pal.entries }) }, props = {} }
A prop is the same descriptor plus a motion(t, prop, state, dt) returning
(dx, dy, rotZ), or a frames array — one canvas per frame, shown and hidden
by the director — with either fps for a loop or clips for named animations
(crowd = true switches between idle and cheer on the fight's events).
sky is the one layer painted edge to edge, so it is the one that may be an
opaque texture canvas; everything else shows what is behind it and is built as
a mesh.