Cascade Visualization

Cascade Visualization

The cascade viewer shows event cascades as interactive tree structures, so you can see the chain of effects produced by a single event. Each time an event fires in the scoring engine, the console captures the resulting cascade of rule evaluations, variable changes, and child events.

Viewing Cascades

Toggle the cascade panel with F7 (or Ctrl+E). After triggering an event, the cascade is captured automatically:

cade:debug> trigger device.Bumper1.activated
Event cascade captured. Press F7 to view.

The cascade panel replaces the main content area when active. Press F7 again to return to the main panel.

The cascade command provides additional subcommands:

cade:debug> cascade show          # Show current cascade details
cade:debug> cascade show abc123   # Show cascade by ID
cade:debug> cascade list          # List recent cascades
cade:debug> cascade clear         # Clear cascade history
cade:debug> cascade stats         # Show cascade statistics

Panel Layout

A captured cascade looks like this in the panel:

🏆 switch_hit:left_orbit
Trigger: switch_hit:left_orbit | Depth: 3 | Queue: 2

switch_hit:left_orbit Total: 3750Ξs | Events: 5 | Score: +5000 | Mult: x3
└─▾ switch_hit:left_orbit [5000 → 5000] +5000
  ├─  → award_bonus [bonus:1000]
  ├─  play_sound:orbit_hit
  └─▾ → update_multiplier [x1 → x3]
    └─  → flash_lights:orbit

Score Breakdown:
  switch_hit:left_orbit: 5000
Total: 5000
──────────────────────────────────────────────────────────────────
 Node: switch_hit:left_orbit | Type: scoring | Duration: 2500Ξs | Score: +5000 | Calc: 5000 | Children: 3 (expanded) | Changes: score
[↑↓] Navigate | [←→] Collapse/Expand | [Space] Toggle | [P] Performance | [/] Search | [1-9] Expand level | [Alt+E] Toggle emojis

For simpler cascades (single event, no children), the header shows device context instead of depth:

Trigger: device.Bumper1.activated | Device: switch | Key: Bumper1

device.Bumper1.activated Total: 4Ξs | Events: 1 | Score: +1000
└─  device.Bumper1.activated [1000 → 1000] +1000

Score Breakdown:
  device.Bumper1.activated: 1000
Total: 1000
──────────────────────────────────────────────────────────────────
 Node: device.Bumper1.activated | Type: scoring | Duration: 4Ξs | Score: +1000 | Calc: 1000 | Changes: category, device_category, device_key, score

Header Line

FieldMeaning
TriggerEvent name that started the cascade
Device / KeyDevice type and key (single-event captures)
DepthNumber of levels in the cascade tree
QueuePending child events not yet expanded

Summary Line

FieldMeaning
TotalWall-clock duration for the whole cascade, in microseconds
EventsNumber of nodes in the tree
ScoreTotal points awarded by the cascade
MultActive multiplier (shown when it changes during the cascade)

Tree Glyphs

GlyphMeaning
└─ / ├─Last child / intermediate child
▾Node is expanded
â–ķNode is collapsed — children hidden
→Node is an effect produced by its parent
[a → b]Variable went from a to b
+NPoints awarded by this node
(pending)Child event queued but not yet dispatched

Detail Bar

The line below the divider describes the currently selected node:

FieldMeaning
NodeSelected node name
Typescoring, effect, sound, or system
DurationTime spent in this node, in microseconds
ScorePoints awarded by this node
CalcCalculated expression value (before any score modifier)
ChildrenChild count and expanded/collapsed state
ChangesVariables touched by this node, comma-separated

Keyboard Shortcuts

KeyAction
↑ / ↓Move to previous / next node
← / →Collapse or expand the selected node
SpaceToggle expand/collapse
1–9Expand the tree to that depth level
[ / ]Step backward / forward through the cascade history buffer
Ctrl+DToggle the details pane
Ctrl+F or /Open search
Ctrl+AToggle auto-update (jump to latest cascade on capture)
Ctrl+EExport the current cascade
Ctrl+REnter or exit replay mode
PToggle the performance overlay
pPlay sound (when a sound node is selected)
Alt+EToggle emoji icons in node labels
?Show the cascade help overlay

Replay Mode

Press Ctrl+R to step through a cascade event by event. Replay mode adds a playback bar and remaps a few keys:

KeyAction
SpacePlay / pause
← / →Step one event backward / forward
+ or =Double playback speed
-Halve playback speed
Home / EndJump to first / last event
EscExit replay mode

Press / to open the search bar. The search UI supports several modes:

ModeDescription
SearchFree-text search across node names and content
FilterType-based filtering (hardware, signal, game, system)
PatternPattern matching with wildcards
PresetQuick filters for common scenarios

Active filters appear in the filter bar and can be removed individually. The search bar shows the current match position (for example, (3/12)) while navigating results.

Timing and Performance

Every node records its execution duration. The panel surfaces these metrics:

Press P to overlay bottleneck analysis on the tree:

The cascade buffer stores the 100 most recent cascades.

Cascade Comparison

Use the comparator to diff two cascades — useful for before/after checks when you change scoring rules.

OptionDescription
Ignore timestampsExclude timing differences from the diff
Ignore durationsExclude per-node duration differences
Timing toleranceThreshold below which timing differences are ignored
Compare structureDetect added, removed, and moved nodes
Compare contentDetect changes in variable values and rule parameters
Compare performanceCompare execution metrics between cascades

The comparison output shows added, removed, modified, and unchanged nodes with a similarity percentage.

Export Formats

Cascades can be exported for external analysis:

FormatExtensionDescription
JSON.jsonStructured data with full tree, metrics, and metadata
CSV.csvTabular — one row per node — suitable for spreadsheets
D2.d2D2 diagram language for rendering cascade graphs
DOT.dotGraphViz DOT format
Text.txtHuman-readable report with optional metrics and patterns

Export options: