feat: cinematic demo, adaptive gates, crash-map HNSW, training defaults#6
Conversation
Improve the training demo so learning is more legible, cars survive more often, and checkpoint curriculum can adapt from pass rates and crash heat.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughThis PR adds adaptive checkpoint gates backed by crash-map retrieval and persistence, a cinematic 2D/3D presentation layer, expanded crash telemetry, revised training defaults and presets, new track geometry, and UI controls for adaptive gates and demo mode. ChangesAdaptive training and presentation
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant Worker
participant Main
participant AdaptiveGates
participant CrashMapBridge
participant Canvas
Worker->>Main: generation results and crash coordinates
Main->>AdaptiveGates: onGenEnd(genData)
AdaptiveGates->>CrashMapBridge: archive and query crash layouts
CrashMapBridge-->>AdaptiveGates: recommended gate layout
AdaptiveGates->>Main: apply updated checkpoints
Main->>Canvas: render cached road, swarm, and champion
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
AI-Car-Racer/demoPresentation.js (1)
704-711: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low valueRedundant
drawHeatmap/drawTrailin the 3D branch.Both branches are identical, and in the 3D path
beginFramealready painted the heatmap and trail (Lines 870–871) beforedrawSwarmruns. Re-drawing them here double-blends the semi-transparent overlays in 3D (denser heat/brighter trails than 2D) and re-scans the full 160×90 heat grid an extra time each frame. Consider drawing heat/trail once per frame for both view modes.♻️ Collapse identical branches
- if (!state.view3d) { - drawHeatmap(ctx); - drawTrail(ctx); - } else { - // Refresh trail/heat under the latest poses (road already drawn). - drawHeatmap(ctx); - drawTrail(ctx); - } + // 2D: paint under the cars/camera. 3D already drew them in beginFrame. + if (!state.view3d) { + drawHeatmap(ctx); + drawTrail(ctx); + }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@AI-Car-Racer/demoPresentation.js` around lines 704 - 711, Remove the redundant conditional around drawHeatmap and drawTrail in the frame-rendering flow, leaving a single invocation of each for both 2D and 3D modes. Preserve the existing beginFrame behavior so 3D overlays are not drawn a second time, while keeping the 2D rendering order unchanged.AI-Car-Racer/uiPanels.js (1)
1813-1814: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winGuard the adaptive-gate status poll interval from duplicates.
setInterval(refreshAdaptStatus, 1500)is never cleared, and the experiments details is appended from one build path that later survives re-parenting moves. If this path can run more than once, each run adds another 1500ms poller. Store/fall back to a single interval id, or move the poll to a true one-time registration.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@AI-Car-Racer/uiPanels.js` around lines 1813 - 1814, Update the interval setup near refreshAdaptStatus so repeated executions of the panel build path reuse a single poller instead of creating additional 1500ms intervals. Store the interval identifier in a persistent scope, guard registration when one already exists, and preserve the existing status-refresh behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@AI-Car-Racer/ruvectorBridge.js`:
- Line 573: Update archiveCrashMap around the meta.cps assignment to deep-clone
the cps array before storing it in m.cps, rather than retaining the caller’s
array reference. Preserve the existing Array.isArray guard and ensure nested
checkpoint data is independently copied so later mutations cannot alter the
archived layout.
---
Nitpick comments:
In `@AI-Car-Racer/demoPresentation.js`:
- Around line 704-711: Remove the redundant conditional around drawHeatmap and
drawTrail in the frame-rendering flow, leaving a single invocation of each for
both 2D and 3D modes. Preserve the existing beginFrame behavior so 3D overlays
are not drawn a second time, while keeping the 2D rendering order unchanged.
In `@AI-Car-Racer/uiPanels.js`:
- Around line 1813-1814: Update the interval setup near refreshAdaptStatus so
repeated executions of the panel build path reuse a single poller instead of
creating additional 1500ms intervals. Store the interval identifier in a
persistent scope, guard registration when one already exists, and preserve the
existing status-refresh behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 163797eb-b743-4e49-bed2-4f202d25234b
📒 Files selected for processing (13)
AI-Car-Racer/adaptiveGates.jsAI-Car-Racer/buttonResponse.jsAI-Car-Racer/crashMapCodec.jsAI-Car-Racer/demoPresentation.jsAI-Car-Racer/index.htmlAI-Car-Racer/main.jsAI-Car-Racer/roadEditor.jsAI-Car-Racer/ruvectorBridge.jsAI-Car-Racer/sim-worker.jsAI-Car-Racer/style.cssAI-Car-Racer/trackPresets.jsAI-Car-Racer/uiPanels.jsAI-Car-Racer/utils.js
| nGates: (meta.nGates | 0), | ||
| timestamp: Date.now(), | ||
| }; | ||
| if (Array.isArray(meta.cps)) m.cps = meta.cps; |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
Deep-clone meta.cps before storing to prevent later mutation corrupting the archived layout.
archiveCrashMap stores the caller's cps array by reference (the mirror only copies the vector via .slice()). main.js's passive archive path passes the live road.checkPointList (see main.js Lines 942), so any subsequent in-place edit/rebuild of that array before the debounced persist() fires would silently rewrite the crash-layout association. adaptiveGates.js sidesteps this by cloning at its call site; centralizing the copy here protects every caller.
🛡️ Proposed defensive copy
- if (Array.isArray(meta.cps)) m.cps = meta.cps;
+ if (Array.isArray(meta.cps)) {
+ m.cps = meta.cps.map((seg) => [
+ { x: +seg[0].x, y: +seg[0].y },
+ { x: +seg[1].x, y: +seg[1].y },
+ ]);
+ }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (Array.isArray(meta.cps)) m.cps = meta.cps; | |
| if (Array.isArray(meta.cps)) { | |
| m.cps = meta.cps.map((seg) => [ | |
| { x: +seg[0].x, y: +seg[0].y }, | |
| { x: +seg[1].x, y: +seg[1].y }, | |
| ]); | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@AI-Car-Racer/ruvectorBridge.js` at line 573, Update archiveCrashMap around
the meta.cps assignment to deep-clone the cps array before storing it in m.cps,
rather than retaining the caller’s array reference. Preserve the existing
Array.isArray guard and ensure nested checkpoint data is independently copied so
later mutations cannot alter the archived layout.
Stop Triangle green lines from sticking after loading Rectangle: notify AdaptiveGates on preset load, key memory by wall geometry, and require matching geometrySig before HNSW layout apply. Reset now recaptures the current track when the baseline is stale.
Summary
Makes the VectorVroom demo more watchable and more effective at training: cinematic presentation, crash-aware adaptive checkpoints, crash-map HNSW memory, a cleaner Triangle track, and survival-oriented default knobs.
Cinematic presentation (
demoPresentation.js)F)H) — death deposits over the track3/?view=3d) of the same 2D sim (instanced-style projected cars + extruded walls)D/?demo=1) guided cinematic pathroadEditor.paintTo()main.jsanimate / genEndTriangle track
trackPresets.jsTraining defaults (survive + learn + archive)
begin()(defaults actually apply)Adaptive green gates (opt-in)
UI: 🧪 Experiments → Adaptive green gates · URL:
?adaptGates=1Crash heat → curriculum + HNSW
popDeathXYongenEnd)crashMapCodec.js)crash_mapsstore):encodeCrashMap/archiveCrashMap/recommendCrashLayoutsOther fixes / wiring
roadEditor.paintTo/drawLinesOnfor offscreen road cachenextSecondscorrectly; sim-speed select matches default 2×How to try
# from repo root python3 -m http.server 8765?view=3d&follow=1?adaptGates=1), train a few gens, watch status for bottleneck /hnsw: applied layout…window.__rvBridge.info().crashMapsTest plan
info().crashMaps.count > 0; later gens may show HNSW layout apply?rv=0still trains (crash passive archive skipped when rv disabled path respected)?adaptGates=1&view=3d— Experiments open, adaptive onSummary by CodeRabbit
New Features
Improvements