Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Physics FFI (~110 of the ~230) is generated by the `define_physics_ffi!` macro i
The web target uses a two-module WASM architecture:
- **Perry WASM** (game logic) imports bloom_* functions under the `"ffi"` namespace
- **bloom_web.wasm** (rendering engine) compiled from `native/web/` via wasm-pack
- **JS glue** (`index.html`) bridges both modules, handles DOM events, string conversion, asset fetching, and Web Audio
- **JS glue** (`bloom_glue.js`) bridges both modules, handles DOM events, asset fetching, Web Audio, and the rAF game loop. For game builds, `build.sh` runs `splice_game.py` to inject this bootstrap into Perry's self-contained WASM HTML (which carries the `rt` runtime + NaN-boxing) and gate the game's `bootPerryWasm()` on engine readiness. Perry's runtime already decodes FFI args to plain JS values (`wrapFfiForI64`), so the bridge passes plain values straight through — no manual NaN-boxing.

Key features flags in `native/shared/Cargo.toml`:
- `default = ["mp3", "jolt"]` — includes minimp3 (C dep, not WASM-compatible) + Jolt physics
Expand All @@ -92,5 +92,7 @@ The web crate exposes `_str` variants (accepting `&str`) and `_bytes` variants (
| `native/third_party/bloom_jolt/` | C++ shim wrapping JoltPhysics behind a C ABI |
| `native/web/src/lib.rs` | Web platform: all FFI functions via wasm-bindgen |
| `native/web/jolt_bridge.js` | Web physics: JoltPhysics.js implementation of FFI |
| `native/web/index.html` | JS glue: FFI bridge, input, asset loading, Web Audio |
| `native/web/build.sh` | Build script: wasm-pack + wasm-opt + assembly |
| `native/web/bloom_glue.js` | Engine bootstrap + FFI bridge: loads bloom_web, builds `__ffiImports`, input, asset loading, Web Audio, rAF game loop |
| `native/web/index.html` | Engine-only standalone page (no game); creates `__bloomReady` + loads bloom_glue.js |
| `native/web/splice_game.py` | Splices the Bloom bootstrap into Perry's self-contained WASM HTML, gating `bootPerryWasm()` on `__bloomReady` |
| `native/web/build.sh` | Build script: wasm-pack + wasm-opt + Perry compile + splice/assembly |
Loading
Loading