Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·originates fromworld bf18e270-2…

CascadeStats

The rule this module exists to enforce: **no number is hidden behind another.** The efficiency score is offered, but always beside the production and the damage it was computed from.

by◐m3rck·posted 21d ago
What it does

CascadeStats — everything measured, and every way of getting it out

The rule this module exists to enforce: no number is hidden behind another. The efficiency score is offered, but always beside the production and the damage it was computed from.

local Stats = require("CascadeStats")
Stats.snapshot(sim)              -- one flat table of every live number
Stats.strategyComparison(sim)    -- Phase 13, both strategies side by side
Stats.dashboard(sim)             -- Phase 26, the whole run
Stats.csvCascades(sim)           -- Phase 27
Stats.csvSamples(sim)
Stats.jsonRun(sim)

Export

Stats.jsonRun writes the dashboard, every retained cascade and every periodic world sample as one JSON document; the two CSV writers write the same records row-wise. Each cascade carries simulation_tick, timestamp_seconds, cascade_id, trigger_type, cascade_size, duration, density_at_trigger, largest_component_at_trigger, energy_at_trigger, pressure_at_trigger, peak_active, merges and classification. Each sample carries tick, density, largest_component, production, cumulative_damage, player_energy and pressure.

That is the artefact for analysing the mechanics outside the engine.

Percentiles

Computed over the retained cascade window (the last history_capacity events, 1000 by default), not over all time — so the readout answers "what does this world look like now", and the lifetime counters beside it answer "what has it ever done". Both are on screen; neither replaces the other.

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

CascadeStats — everything measured, and every way of getting it out. The rule this module exists to enforce: no number is hidden behind another. The efficiency score is offered, but it is always handed over beside the production and the damage it was computed from, and the export writes the raw records rather than a summary of them.

fmtTime(seconds: number) → string

argtypedescription
secondsnumber

fmtInt(v: number) → string

argtypedescription
vnumber

snapshot(sim: any) → any

--!desc One flat snapshot of every live number the readouts can show. --! Cheap enough to call on a HUD refresh; the expensive analyses --! (percentiles, histogram) are asked for separately.

argtypedescription
simany

strategyComparison(sim: any) → any

--!desc Phase 13 — the controlled-burn question, answered in numbers. --! Both strategies are reported side by side; neither is called correct.

argtypedescription
simany

dashboard(sim: any) → any

--!desc Phase 26 — the whole run as a dashboard row. Every number that --! fed the score is present.

argtypedescription
simany

csvCascades(sim: any) → string

--!desc Every retained cascade as CSV, oldest first.

argtypedescription
simany

csvSamples(sim: any) → string

--!desc The periodic world samples as CSV.

argtypedescription
simany

jsonEscape(s: string) → string

argtypedescription
sstring

jsonObj(t: any) → string

argtypedescription
tany

jsonRun(sim: any) → string

--!desc The whole run as JSON: the dashboard, every retained cascade, and --! the periodic samples. This is the artefact for analysing the --! mechanics outside the engine.

argtypedescription
simany

Sub-parts

Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.

Showing up to 3 levels deep. Open a part to see what it holds further down.

7+items
▣
module · born here
❒asset
# CascadeCore — the model The simulation, and nothing else. This module owns no engine API: it is pure Luau over flat arrays, so the same code steps headless (baseline strategies, batch experiments) at the speed it steps on screen. ## Shape ```lua local Core = require("CascadeCore") local sim = Core.new({ width = 256, height = 256, seed = 42, params = {} }) for _ = 1, 1000 do Core.step(sim) Core.afterTick(sim, 1 / 25) end print(Core.summary(sim).efficiency) ``` `Core.step` advances the model by one tick. `Core.afterTick` does the bookkeeping a driver wants at its own cadence — production accrual, connectivity, pressure, history samples — and takes the wall-clock seconds since the last call. A caller that only wants the physics can skip it. ## Cells `EMPTY` 0 · `OCCUPIED` 1 · `ACTIVE` 2 · `COOLDOWN` 3 · `BLOCKED` 4 The board is a flat array **padded by one `BLOCKED` ring**, so a neighbour is a plain index offset and no propagation step ever needs a bounds check. `Core.idx(sim, x, y)` maps board coordinates to that index. ## Propagating the grid `neighbor_mode` (4 or 8) fixes the neighbourhood. `propagation_mode` picks how fire crosses it: 1. **adjacency** — every occupied neighbour ignites 2. **probabilistic** — each at `spread_probability` 3. **distance** — within `spread_radius`, probability falling with distance 4. **directional** — probability weighted toward `direction_x/y`, with `direction_bias` as the floor a cell keeps against the flow Adding a model means adding a branch to `Core.rebuildNeighbors`, which fills each offset's probability once per parameter change rather than per tick. ## Performance The tick is written for the common case: one pass over the board for decay, trigger and growth, then work proportional to the *burning* cells rather than the whole grid. Two things matter and are easy to get wrong: - **The generator is unrolled into the loop.** A tick draws a number for most cells on the board, and at this VM's call costs a `bit32`-based xorshift made the simulation three times slower than the arithmetic it was producing. See `CascadeRng`. - **Thresholds are integers.** A probability is stored pre-multiplied by the generator's modulus, so the hot comparison never pays for a float divide. Measured: ~5.4 ms per tick at 256×256 on a sparse board, ~7.3 ms at the density the model settles at. ## `system_pressure` (Phase 21) A smoothed read of density, largest-component ratio and recent cascade activity. **It is observational only.** Nothing in this module reads it to decide an outcome — catastrophic events remain emergent consequences of the cellular system, and there is no branch anywhere that spawns one.
▲ 0↑ born
backing path · CascadeStats.module

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported on this asset or on the parts this page shows. Parts it leaves out are not counted here.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.