Log inGet started
World

EMBERLINE

Branchmain
Branchesmain
Commite3b1d97d67

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.

idtitlethe lightwhat moves
platformSODDEN PLATFORMsodium lamps in smograin, a full crowd, steam off a vent, a train on the viaduct
lanternLANTERN ROWpaper lanterns and shop windowslanterns swinging on their wires, steam off the pots, a close crowd
coaldeckTHE COAL DECKfurnace doors and the floor itselfdoors breathing, ash falling, two cranes tracking their road
endoflineEND OF LINEone working lamp and the last trainthree 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.

keyzparallaxsheet
sky-40.00.04416 x 240
farBack-16.00.18456 x 240
midBack-7.00.42532 x 240
nearBack-2.50.72628 x 240
apron+0.921.00712 x 34, hanging below the fight plane
foreground+4.01.25792 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.