CascadeHud
Builds the screen tree. Knows nothing about the simulation's rules and nothing about the engine's input: it is handed a snapshot and draws it.
CascadeHud — the instrument's face
Builds the screen tree. Knows nothing about the simulation's rules and nothing about the engine's input: it is handed a snapshot and draws it.
local Hud = require("CascadeHud")
ui.updateScreen("cascade_instrument", Hud.build(ctx))
Three things worth knowing before editing it
A canvas point is a two-element array. { x, y } means { 10, 20 }, not
{ x = 10, y = 20 }. Getting that wrong is silent: the canvas reports the
command as skipped and draws a blank rectangle. Every point in the charts here
is an array literal.
A canvas's id sits at the top level of the node, beside type — not in
props — which is how gui.bounds and gui.elementCapture address it.
A label that is not hard-wrapped widens its whole column. An unwrapped line
is as wide as its text, so one long legend pushes everything laid out beside it
off the screen. Hud.controlsHint wraps to the pixel width it will be drawn at
rather than trusting the layout engine to.
The layout adapts
The instrument is often given a short space — the editor's play pane is a wide, shallow rect. So the readout is assembled from blocks and filled with whole blocks while they fit: a short viewport loses its least important sections instead of clipping every one of them. It never draws half a number.
Phase 10 — three levels of information
- A · Full Debug — everything: density, connectivity, component statistics, cascade statistics, the distribution, production, damage, energy, intervention tallies and the strategy comparison.
- B · Player Information — production, energy, density, recent event sizes, largest recent event. The question this mode exists to ask is whether a player needs the rest.
- C · Minimal — production, energy, score.
The point of having all three is to find out how much direct information the player actually needs, because the destination is a player who reads the world visually instead of a dashboard.
Phase 14 — pressure without a risk meter
The frame around the board warms and the background lifts as
system_pressure rises, driven through a slow pulse. It is deliberately
unquantified: there is no "disaster probability" anywhere on screen. The test
is whether this place feels dangerous arrives before the numbers say so.
Scoped to this part · feeds back into the world's score.