Commit Graph

3 Commits

Author SHA1 Message Date
type-two
23865f1483 Web: bake any game into the wasm; never block first paint on audio
- MRPGI_WEB_GAME env (default games/lost-fuse via .cargo/config.toml)
  selects the game include_dir! embeds; web/build.sh <game-dir> stages
  just game.json+rooms+sprites (a repo's raw art was ballooning the wasm
  to 41MB; now 1.9MB) and ships the game's web/index.html and music/.
- sound.rs: file overrides load through macroquad's loader (fs on native,
  HTTP fetch on web), and AudioOut now loads inside a coroutine behind
  LazyAudio — browsers gate audio decoding behind a user gesture, and
  blocking boot on it was a black screen. First frame draws immediately;
  music starts when ready, remembering the requested mood/mute.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-05 15:53:22 +10:00
type-two
cd7f658444 Accounts + cloud saves: the front door for the web engine
- mrpgi-vault (standalone crate): tiny signup/login/world-save service.
  Argon2 password hashes, random session cookies, JSON-file storage,
  naive per-IP rate limit, 4MB body cap. tiny_http, no framework, no db.
  Runs as a container on the dealgod network; nginx proxies
  /engine/api/ to it.
- core: WorldBundle — a whole world (manifest + every room) as one JSON
  document, with World::to_bundle/apply_bundle.
- web bridge: mrpgi_request_save / mrpgi_alloc / mrpgi_world_in exports
  + an mrpgi_world_saved JS plugin import; the page's SAVE button pulls
  the live world out of the running engine, LOAD swaps it back in.
  SAVE_REQUESTED is an AtomicBool on purpose — wasm's thread-less
  Mutex<bool> is a plain static to LLVM and release builds const-folded
  the read (the only writer is JS-visible, not IR-visible).
- web UI: SIGN IN tab → create account (own username + password) /
  sign in / Save world / Load world / sign out. Session restores on
  revisit.

Verified live end-to-end through Cloudflare: signup → save → reload →
anonymous rejected; throwaway account removed after.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-05 11:38:27 +10:00
type-two
11d25f5c52 Browser build: the engine compiles to WASM and runs at a URL
- mrpgi-core: ureq/tiny_http/threads are native-only deps; the AI lane
  compiles to an always-off stub on wasm32 (deterministic parser stays).
- World::from_memory + assets::cel_from_bytes — boot a game with no
  filesystem.
- mrpgi GUI on wasm: embeds games/lost-fuse via include_dir, boots
  straight into Play (Tab still opens the editor; saving needs a disk,
  so web is play + paint-only for now).
- web/: index.html shell + macroquad JS loader + build.sh producing a
  self-contained static web/dist (1.1 MB total, game included).
- .cargo/config.toml: --allow-undefined for miniquad's JS imports.

Verified in-browser: renders, typed commands reach the parser,
click-to-walk works, zero console errors.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-05 09:35:45 +10:00