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
| Field | Meaning |
|---|---|
Trigger | Event name that started the cascade |
Device / Key | Device type and key (single-event captures) |
Depth | Number of levels in the cascade tree |
Queue | Pending child events not yet expanded |
Summary Line
| Field | Meaning |
|---|---|
Total | Wall-clock duration for the whole cascade, in microseconds |
Events | Number of nodes in the tree |
Score | Total points awarded by the cascade |
Mult | Active multiplier (shown when it changes during the cascade) |
Tree Glyphs
| Glyph | Meaning |
|---|---|
ââ / ââ | 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 |
+N | Points awarded by this node |
(pending) | Child event queued but not yet dispatched |
Detail Bar
The line below the divider describes the currently selected node:
| Field | Meaning |
|---|---|
Node | Selected node name |
Type | scoring, effect, sound, or system |
Duration | Time spent in this node, in microseconds |
Score | Points awarded by this node |
Calc | Calculated expression value (before any score modifier) |
Children | Child count and expanded/collapsed state |
Changes | Variables touched by this node, comma-separated |
Keyboard Shortcuts
| Key | Action |
|---|---|
â / â | Move to previous / next node |
â / â | Collapse or expand the selected node |
Space | Toggle expand/collapse |
1â9 | Expand the tree to that depth level |
[ / ] | Step backward / forward through the cascade history buffer |
Ctrl+D | Toggle the details pane |
Ctrl+F or / | Open search |
Ctrl+A | Toggle auto-update (jump to latest cascade on capture) |
Ctrl+E | Export the current cascade |
Ctrl+R | Enter or exit replay mode |
P | Toggle the performance overlay |
p | Play sound (when a sound node is selected) |
Alt+E | Toggle 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:
| Key | Action |
|---|---|
Space | Play / pause |
â / â | Step one event backward / forward |
+ or = | Double playback speed |
- | Halve playback speed |
Home / End | Jump to first / last event |
Esc | Exit replay mode |
Filtering and Search
Press / to open the search bar. The search UI supports several modes:
| Mode | Description |
|---|---|
| Search | Free-text search across node names and content |
| Filter | Type-based filtering (hardware, signal, game, system) |
| Pattern | Pattern matching with wildcards |
| Preset | Quick 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:
- Total cascade duration â wall-clock time for the whole cascade
- Per-node duration â time spent in each rule, event, or effect
- Critical path â the longest chain of sequential operations
Press P to overlay bottleneck analysis on the tree:
- Bottleneck detection â nodes that exceed a duration threshold, ranked low / medium / high / critical
- Impact score â each bottleneck’s share of total cascade time
- Optimization suggestions â practical recommendations for slow cascades
- Duration histogram â distribution of node execution times
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.
| Option | Description |
|---|---|
| Ignore timestamps | Exclude timing differences from the diff |
| Ignore durations | Exclude per-node duration differences |
| Timing tolerance | Threshold below which timing differences are ignored |
| Compare structure | Detect added, removed, and moved nodes |
| Compare content | Detect changes in variable values and rule parameters |
| Compare performance | Compare 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:
| Format | Extension | Description |
|---|---|---|
| JSON | .json | Structured data with full tree, metrics, and metadata |
| CSV | .csv | Tabular â one row per node â suitable for spreadsheets |
| D2 | .d2 | D2 diagram language for rendering cascade graphs |
| DOT | .dot | GraphViz DOT format |
| Text | .txt | Human-readable report with optional metrics and patterns |
Export options:
- Include metrics â timing and performance data
- Include metadata â source file, tags, and configuration context
- Include timings â per-node duration information
- Include patterns â detected scoring patterns
- Max depth â limit tree depth in the export
- Event type filter â export only hardware, signal, game, or system events
- Node selection â export specific node IDs or exclude specific node IDs