From 54048c6bacc8d9500a094d01b35218a56c240b01 Mon Sep 17 00:00:00 2001 From: Mike Liu Date: Tue, 3 Mar 2026 23:27:25 +0000 Subject: [PATCH] feat: add polished loading overlay with progress bar Replace the bare "Please wait... Loading webassembly" text with a branded loading screen featuring a Rosebud logo (base64-embedded), rotating theme-park phrases, gradient progress bar, and phase labels that track actual engine/asset loading stages. - rosebud/static/index.html: dark overlay with CSS animations, JS helpers (updateLoadingBar, showLoadingError, dismissOverlay) - rosebud/static/index.js: fork copy of upstream index.js wired to report 14 progress stages and 6 error paths through the overlay - .claude/verification.md: project-specific verification instructions Key fixes during development: - Canvas must be visible before callMain() for WebGL init - Progress helpers use window scope so file-level functions can call them - Body flex layout reset on dismiss to prevent canvas offset Co-Authored-By: Claude Opus 4.6 --- .claude/verification.md | 68 +++++++++ rosebud/static/index.html | 190 +++++++++++++++++++---- rosebud/static/index.js | 307 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 538 insertions(+), 27 deletions(-) create mode 100644 .claude/verification.md create mode 100644 rosebud/static/index.js diff --git a/.claude/verification.md b/.claude/verification.md new file mode 100644 index 0000000000..d949a06a3c --- /dev/null +++ b/.claude/verification.md @@ -0,0 +1,68 @@ +# OpenRCT2-Web Verification + +## Build Before Verify + +Visual changes must be tested against the full game, not standalone HTML. Always ensure `build/www/` has the latest overlay before serving. + +```dot +digraph build { + "What changed?" [shape=diamond]; + "C++ / CMake / deps" [shape=box]; + "rosebud/static/ only" [shape=box]; + "Full WASM build" [shape=box]; + "Re-overlay only" [shape=box]; + "Serve build/www" [shape=box]; + + "What changed?" -> "C++ / CMake / deps" [label="C++/WASM"]; + "What changed?" -> "rosebud/static/ only" [label="HTML/CSS/JS"]; + "C++ / CMake / deps" -> "Full WASM build"; + "rosebud/static/ only" -> "Re-overlay only"; + "Full WASM build" -> "Serve build/www"; + "Re-overlay only" -> "Serve build/www"; +} +``` + +### Re-overlay (fast — for rosebud/static/ changes only) + +```bash +cp -r rosebud/static/* build/www/ +``` + +Requires a previous `build/www/` from a prior WASM build. If `build/www/` doesn't exist, do a full build first. + +### Full WASM build (slow — for C++/CMake/dependency changes) + +```bash +rosebud/docker-build +``` + +This automatically overlays `rosebud/static/` at the end. + +## Serve Command + +Always use the project server — never bare `python3 -m http.server`: + +```bash +python3 rosebud/serve.py --host 0.0.0.0 --port 8000 +``` + +Default directory is `build/www/`. Sets required COOP/COEP/CORP headers for SharedArrayBuffer. + +## By Change Type + +| Change type | Build step | Then | +|-------------|------------|------| +| **Loading overlay / UI** | Re-overlay | Serve, Playwright screenshot, test JS API | +| **index.js wiring** | `node --check rosebud/static/index.js` + re-overlay | Serve and verify in browser | +| **C++ / WASM** | Full build via `rosebud/docker-build` | Serve `build/www/` | +| **Asset packaging** | Full build | Verify all three zips load | + +## Scope Your Claims + +- **Overlay-only test**: State "overlay renders correctly; full game load not tested (requires WASM build)" +- **Full build test**: State "game loads end-to-end through loading screen" +- Never say "all checks pass" when only testing a subset + +## Visual Verification + +For any CSS/HTML/UI change: `playwright-capture` then `visual-judge`. Code review alone is not verification. diff --git a/rosebud/static/index.html b/rosebud/static/index.html index 518d7c7239..948c937426 100644 --- a/rosebud/static/index.html +++ b/rosebud/static/index.html @@ -1,31 +1,167 @@ - - OpenRCT2 - - - - - - -

Please wait... Loading webassembly

-