# The Rock of Monkey Island

Playable browser fan-mod proof of concept for **The Secret of Monkey Island — English EGA interactive demo**, starring a cartoon Dwayne “The Rock” Johnson.

## Play

Play **https://therockofmonkeyisland.templestein.com**. Turn your phone sideways and tap **Start with sound**. Fullscreen and Add to Home Screen are available.

For local development, open **http://localhost:8765** while the included server is running. If it is not running, double-click `serve.command`, or run:

```sh
python3 -m http.server 8765 --bind 127.0.0.1 --directory web
```

Use a desktop or mobile browser in landscape. Tap a verb then an object or character. Quick save / Load save use a dedicated browser-local slot. F5 opens the full save/load menu, period advances a dialogue line, and Escape skips a cutscene. The page's Restart button starts a fresh game. Saves use this browser and origin's storage.

Try “Look at protein tub”, then walk left and talk to the troll. Insist on being Hollywood superstar Dwayne The Rock Johnson. The fortune teller and prisoner also have new jokes.

## What changed

- Built ScummVM itself to WebAssembly from source, with its original SCUMM interpreter, pathfinding, rooms, puzzles, and inventory.
- Replaced actor 1's costume rendering with **16 new 48 × 52, 15-opaque-colour frames**: four views each for idle, two walking phases, and talking. The original compositor handles scaling, occlusion, and redraws.
- Added a new 320 × 200 title screen directly to the engine framebuffer. The old advertising intro is skipped on a fresh launch.
- Replaced displayed Guybrush/Threepwood names in the SCUMM text pipeline, including dialogue choices. `dialogue.json` contains 34 authored joke replacements, including NPC mockery.
- Patched actual XOR-encoded demo data: actor names and inventory names, using equal-length replacements so all bytecode offsets remain intact.
- Added a real “protein tub” to the starting inventory. It repurposes the breath-mint object, keeping the original object's scripts and puzzle role.
- Added Dwayne Jr., a real pet-rock inventory object with custom responses, and a Flex action with boasts and delayed troll heckles.
- Added landscape mobile layout, portrait rotation gate, fullscreen/installation, explicit sound unlock, touch controls, and splash-based social preview.
- Added an original 48-second browser-clocked chiptune score. The official demo has no playable music resources; this is newly authored audio. `compose-score.py` reproduces it.
- Added versioned JS/WASM pairs and offline caching. Art iterations and source are linked at `/about.html`.

This is a demo-specific proof of concept, not a tested conversion of the complete retail game. Some original writing remains. The sprite replacement covers normal idle/walk/talk poses; bespoke retail animations would need further artwork and hooks. The browser build is the tested deliverable; the `runtime` folder contains an earlier native experiment. Use the browser Restart button rather than the original game's restart command to replay the replacement title.

## Art iterations

Generated with the built-in image-generation tool. All final project art is saved locally:

- `assets/iteration-1-realistic.png`: early, more realistic/vested design.
- `assets/iteration-2-costumes.png`: three shirtless wrestler/pirate variants.
- `assets/iteration-3-cartoon.png`: selected large-head red-sash design.
- `assets/rock-atlas-source.png`: earlier illustrated atlas.
- `assets/pixel-candidates-v4.png`: four new coarse pixel-art designs.
- `assets/rock-atlas-v5-source.png`: final reference-guided atlas before grid reconstruction.
- `assets/rock-sprites-preview.png`: exact sprites used in game.
- `assets/title-source.png` and `assets/title-320.png`: generated title and engine-sized version.

The simple red-sash design was selected because its bald head, eyebrow, chest, tattoo, and wrestling boots remain recognizable at 52 pixels tall. See `ART-PROMPTS.md` for the exact new prompts and `PIXEL-ART.md` for measured grid reconstruction, palette constraints, rejected variants, and research sources.

## Source and rebuild

ScummVM upstream commit: `12fa21690555fb504cdd02dd92a905ca4b3e3499`.
Local source checkout: `/Users/jonastemplestein/src/github.com/scummvm/scummvm`.

All engine changes are in `patches/scummvm-rock.patch`; new generated headers are alongside it. Apply the patch to that revision and copy the three headers into `engines/scumm/`. No commit, push, or PR was made.

The existing `web-build/` is an out-of-tree build using Homebrew Emscripten. To rebuild it after changing engine C++:

```sh
emmake make -C web-build -j8
python3 package-engine.py
```

For a clean configure, set `EMSDK` to an Emscripten SDK directory (the local shim is `web-build/emsdk`), then run the source configure via `emconfigure` from a build directory:

```sh
emconfigure /path/to/scummvm/configure --host=wasm32-unknown-emscripten \
  --disable-all-engines --enable-engine=scumm --disable-tts \
  --disable-fluidsynth --disable-mt32emu --disable-libcurl --disable-cloud \
  --disable-debug --enable-release
```

For this upstream revision's out-of-tree web build, `config.mk` needs its `--js-library backends/networking/http/emscripten/networkreadstream-emscripten.js` changed to `--js-library $(srcdir)/backends/networking/http/emscripten/networkreadstream-emscripten.js`. Replace the upstream `--pre-js` path with this project's `rock-pre.js`. Keep the hand-written `web/index.html`, not the generated stock HTML.

To regenerate art headers/data:

```sh
npm ci
.venv-pixels/bin/python reconstruct-sprites.py # setup: PIXEL-ART.md
node build-sprites.mjs
python3 -m venv .venv
.venv/bin/pip install -r requirements.txt
.venv-pixels/bin/python build-title.py
python3 build-dialogue.py
python3 patch-demo.py
# Copy rock-*.h into the ScummVM engines/scumm directory before rebuilding.
node verify-assets.mjs
```

Regenerate HTTP directory indices after adding game/theme data:

```sh
python3 /path/to/scummvm/dists/emscripten/build-make_http_index.py web/data
```

## Provenance

Original demo downloaded from the [official ScummVM demo mirror](https://downloads.scummvm.org/frs/demos/scumm/monkey1-dos-ega-demo-en.zip). Unmodified archive and files are retained in `demo.zip` and `original/`. `game-patch-report.json` records source/output hashes and exact replacements. Original game notices remain with its files.

ScummVM is GPL-licensed; its licence and credits are copied into `web/`. This is an unofficial parody, with no endorsement by the original creators or the depicted celebrity. Celebrity status does not place someone's likeness or photographs in the public domain.

## Mobile validation limits

See `RESEARCH.md` and `evidence/`. Chrome mobile emulation is used for touch and responsive-layout checks; this is not physical iPhone/Android testing. The source-specific mixer format and buffer fixes address identified audio defects. ScummVM SDL3 remains an experimental web backend; do not assume every mobile browser performs identically.
