- commit
- 8d00e5544f417619abfaf48dd4f855599718eb32
- parent
- bab478bbedf561bc182204bf486494cb9205fdc7
- author
- Dami <dami.etoile@gmail.com>
| M | progress.md | 52 | ++++++++++++++++++++++++------ |
@@ -563,17 +563,47 @@ clearances, island column mapping, port continuity), screenshot pass. OPEN
563563 DECISIONS: exact scale factor (2 vs 2.5), whether speeds/gravity constants564564 rescale.565565 566-**M9 — Physics engine spike (offline, no game changes).** FIRST verify the567-"Box2D 3D" release (post-cutoff: search for it — Erin Catto / box2d.org; user568-prefers it as the target). Fallback candidates if unusable from the browser:569-Jolt (WASM port), Rapier3D (deterministic feature). Selection gates: fixed-step570-same-build determinism (state hash of N steps reproducible), WASM size/perf (≥4×571-realtime at 120 Hz on target hardware), CCD quality for a small fast sphere,572-mesh/convex collider support. Deliverable: standalone spike — marble body573-rolling through ONE measured piece's collision proxy + determinism + perf574-numbers. Collision proxies become registry data like centerlines: floor ribbon +575-wall strips per PieceDef, MEASURED from the GLBs (tools/measure_* pattern),576-never guessed from bboxes.566+**M9 — Physics engine spike.** [DONE — see tools/physics-spike/README.md. BOX3D567+CONFIRMED: Erin Catto released Box3D 2026-06-30 (MIT, C17, the 3D successor to568+Box2D; verified via web search — it's real and it's exactly what the user569+meant). Pinned commit 3fc20f5b453ba9e14cdf54ecafa87a2a4bcdf53c. Gates: builds to570+WASM via `emcmake cmake` with ZERO patches (emscripten via brew); BIT-IDENTICAL571+determinism across runs (advertises cross-platform determinism + record/replay);572+~228k steps/s ≈ 3800× realtime at 60 Hz ×4 substeps; contact precision exact to573+the geometric wall plane (slalom maxAbsX = 0.500 = wall face − radius); C API in574+Box2D-v3 style575+(b3DefaultWorldDef/b3CreateBody/b3CreateHullShape/b3CreateSphereShape/576+b3CreateMeshShape/b3World_Step/b3Body_GetPosition); double-precision positions577+by default — fits the endless line's unbounded coords; spike .wasm 369 KB.578+b3MakeOffsetBoxHull is the workhorse for channel proxies.]579+580+**M10 IMPLEMENTATION PLAN (worked out at M9 close):**581+582+1. Vendor box3d at the pinned commit (extern/box3d or fetch script) + a build583+ task emitting static/dist/box3d.js+wasm from a hand-written C shim (keep the584+ JS surface tiny: world create/step, batched static hull upload, one dynamic585+ sphere, transform readback into a Float64Array).586+2. Collision proxies GENERICALLY from existing def data — no per-piece587+ authoring: sample each placement's world centerline (the client already has588+ it per segment) and emit short hull runs: floor slab (half-width589+ 0.35·TRACK_SCALE narrow / 0.85 wide) + two wall slabs (to +0.5·scale),590+ oriented by tangent. Curved pieces = more samples. Island blocks = box hulls591+ on the world grid. Tunnel roofs: skip v1.592+3. Physics streaming mirrors the render window: static bodies per segment593+ built/destroyed with build/dispose (marble only needs [cur−1, cur+2]).594+4. Marble = dynamic sphere r 0.2; keep-rolling assist force along the local595+ tangent when |v| < target (replaces the old kinematic drag model); fixed 60596+ Hz × 4 substeps stepping with accumulator.597+5. Progress s = nearest-point projection on the built window's curves (client598+ samplePoint machinery inverts fine via coarse scan + refine).599+6. Checkpoints: island run starts + every K≈10 void cells → {s, pos, dir} list600+ per segment; respawn when marble y < (lowest co-live band world y − 8) OR601+ horizontal distance to line > 12: reset to last checkpoint with its tangent602+ velocity at BASE_SPEED. Camera snaps.603+7. Survivability scenarios (M7 harness extension): node script under tools/604+ drives the SAME wasm module headless over generated segments; deno test605+ shells it (--allow-run) and asserts completion/respawn rates. Physics606+ determinism test: same seed → same trajectory hash.577607 578608 **M10 — Physics marble + checkpoints + respawn (one milestone — a physics marble579609 without respawn is broken the moment it falls).** Marble = dynamic body;