- JavaScript 43.4%
- TypeScript 16%
- Python 15.3%
- CSS 8.5%
- C 6.2%
- Other 10.6%
|
|
||
|---|---|---|
| .agents/skills/beads | ||
| .beads | ||
| .claude | ||
| .codex | ||
| client | ||
| config | ||
| dist | ||
| docs | ||
| fire-red | ||
| patches/pret | ||
| server | ||
| sim | ||
| tests | ||
| tools | ||
| website | ||
| .gitignore | ||
| AGENTS.md | ||
| CLAUDE.md | ||
| DEPLOYMENT.md | ||
| package-lock.json | ||
| package.json | ||
| PLAN.md | ||
| playwright.config.mjs | ||
| playwright.live.config.mjs | ||
| README.md | ||
| RESEARCH.md | ||
| STATUS.md | ||
| THIRD_PARTY.md | ||
| tsconfig.json | ||
FireRed in the browser
A private, in-development port of Pokémon FireRed (GBA) to the browser. The game's own code, from pret/pokefirered, is compiled to WebAssembly and runs against a software model of the GBA's hardware. There is no ARM emulator, no BIOS image and no emulator wrapper at runtime. A TypeScript client draws the screen, plays the sound, reads input and stores saves. All game content (graphics, maps, text, music, data) is read from your own cartridge image when you build; nothing from the game is in this repository's source.
There are two sites built from this repository:
- The game (
dist/): a player page,play.html. It also still contains the first traversal pilot (index.html), a separate small TypeScript engine kept for comparison. See STATUS.md. - The field guide and companion (
website/): a static Astro site with a Pokédex, items, moves, areas and a story guide. The player is embedded in its home page, and a live companion panel (party, bag, Pokédex, Journey, a map of where you are) reads the running game.
Do not read this as a claim of original-game parity. The whole story has been played through automatically, but comparison against the original is still partial. STATUS.md lists what is checked and what is not.
Build once, then serve dist/
Requirements: Python 3.11+ with venv, Node.js 22+, npm, and for the engine build GNU patch, make, g++ and git. The build needs internet for dependencies and for fetching pret at its pinned commit; the finished game does not.
python3 -m venv .venv
.venv/bin/python -m pip install -r tools/requirements.txt
npm ci
.venv/bin/python tools/build_from_rom.py "/path/to/FireRed.gba"
python3 -m http.server 8080 --directory dist
Open http://localhost:8080/play.html. On Windows use the virtual environment's Scripts/python.exe.
The build accepts English FireRed USA/Europe v1.0, SHA-1 41cb23d8dccc8ebd7c649cd8fbb58eeace6e2fdc. Rev 1 and LeafGreen are not supported. The ROM is read, never changed, and is needed only while building: dist/ holds the compiled core (core.wasm) and a content pack cut from the ROM, but not the ROM or any BIOS. The build is staged and verified before it replaces dist/; a failed build leaves the previous one.
Serve over HTTP (not file://) with application/wasm for .wasm. Cross-origin isolation is not required. Because the content pack is game data, keep a built dist/ private.
Play
The defaults below can be changed with the player's Options ▸ Controls (keyboard and controller, two keys or buttons per action).
| Action | Default keys |
|---|---|
| Move | Arrow keys or W A S D |
| A / B | Z / X |
| Start / Select | Enter / Backspace |
| L / R | Q / E |
| Fast-forward | Space (hold), or the Speed button |
| Sound on / off | M (the Volume slider beside the Sound button sets the level) |
On phones the player shows touch buttons. An Xbox or similar controller works; A confirms and B goes back.
Progress is saved the way the game saves (the real cartridge format) into browser storage. Options has Quick Load (skip the title and go straight to CONTINUE), Intro skip, Export save and Import save. An exported .sav is a real cartridge save, and a cartridge .sav can be imported. Only one player tab can be open at a time so two copies never overwrite each other's save.
For testing, play.html?save=NAME starts from pokemon-saves/NAME.sav beside the page without touching the stored save (see docs/MANUAL_CHECKS.md).
The website
python3 tools/export_tables.py "/path/to/FireRed.gba"
python3 tools/build_website_maps.py "/path/to/FireRed.gba"
cd website && npm ci && npm run import-export && npm run import-areas && npm run build
python3 tools/build_website.py # package website/dist with checks
See website/README.md and DEPLOYMENT.md.
Verify
Build first, then:
npm run check # TypeScript
npm test # core, PPU, audio, save and new-game tests
node --test tests/*.test.mjs # everything, including the story tests (slow)
.venv/bin/python -m unittest discover -s tests -p 'test_*.py' -v
npx playwright install chromium
npm run test:browser # player, embed and single-player specs
.venv/bin/python tools/verify_dist.py dist
.venv/bin/python tools/coverage.py --check # no unsupported stub in ordinary play
npm --prefix website test # website specs
The story tests play the game headless: a new game, Route 1, every gym, the Rocket scenes, Silph Co, the Safari Zone, the Sevii gifts and the Elite Four, using a level-100 helper party where noted. The oracle comparisons against mGBA need the development-only setup in docs/ORACLE.md.
Layout
| Path | Purpose |
|---|---|
sim/port/ |
Our C: the hardware model (frame driver, DMA, BIOS functions, sound chip, flash save, companion snapshot) around pret's code. See sim/port/README.md. |
patches/pret/ |
Small unified diffs applied to the fetched pret tree for wasm-versus-ARM differences. |
client/ |
TypeScript player: PPU renderer, audio, input, controls, saves, companion messages. Also the old traversal pilot. |
tools/ |
ROM to dist build, exporters, pret port, deployment and development checks. See docs/tools.md. |
config/ |
Supported ROM identity, unit list for the engine build, stub list, ROM data layout. |
tests/ |
Node and Playwright tests (core, story, save, audio, player). |
website/ |
The field guide and companion. Has its own README, build and tests. |
docs/ |
Architecture, decisions, plans, oracle, references. |
dist/ |
The built game; tracked in this private repository. |
Documents
STATUS.md what works and what is unverified. PLAN.md the contract and milestones. docs/ARCHITECTURE.md the sim and client boundary. docs/decisions.md decisions with evidence. docs/COVERAGE.md which code is pret's, which is ours and what is stubbed (generated). docs/ENHANCEMENTS_PLAN.md and docs/MULTIPLAYER_PLAN.md plans only, nothing built. docs/REFERENCES.md community tools. THIRD_PARTY.md provenance. RESEARCH.md the original feasibility research (historical). Work items are tracked with Beads (bd).
This is the private working repository. It tracks the supplied cartridge inputs under fire-red/ and the generated dist/ on purpose. A public version will be produced later as a separate reviewed export that contains no ROM, no pret source, no game data and no built game.