The game plays in the browser from a page any web server can host, with keys, pads and sound, the built-in pack or a ROM imported on the device, and the settings, the progress and the ROM kept in the browser. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Stompede
A side-scrolling platformer engine with the feel of classic 8-bit platformers: exact, frame-by-frame movement at 60 updates per second, whole pixels on screen.
The engine plays content packs. It comes with a built-in pack, and it can import an NES platformer ROM that you own into a pack on your machine, so the game looks like that original. Nothing imported is part of this repository or of the program.
Playing
Start stompede. The start screen offers a new game, continuing at the
start of the level you left, the settings, importing a ROM, and
quitting. After a pack's last level every new game is its expert run,
where the pack has one; the start screen then picks the world it begins
at (left and right on its entry).
Keys: arrows or WASD move, X or space jump, Z or shift run, Enter is start, Esc opens the pause menu, F11 switches the full screen on and off. Gamepads work too, also plugged in during play: the cross and the left stick move, the lower face button jumps, the left one runs, start is start.
In the menus up and down choose an entry, left and right change its value, jump or start takes it, run or Esc goes back. Start or Esc in play pauses the game and opens the pause menu: resume, the settings, or back to the start screen (the progress stays as when you quit).
Two players
Two can play one game at the same time: choose 2 on the start screen's Players entry before a new game or continuing. Both share one view, one score, the coins and the lives; player two wears his own colours, and the status bar shows a small mark in both players' colours. A player caught between the view's left edge and a wall drops out; he, or one who loses a life, comes back small where the other is, after a short while: as soon as the other is in play, has control, is not climbing and stands on solid ground or is in water. Dropping out costs no life; with the classic lives, a player who loses the last life stays out. When a player loses a life and the other is not in play either, the level starts again; a pipe or another way into the next area, or the level's end, takes the other along.
Player two's keys: I, J, K and L (or the number pad's 8, 4, 5 and 6) move, right Alt (or the number pad's 0) jumps, U (or the number pad's point) runs, P (or the number pad's Enter) is start. Start from either player pauses. With two playing, the first gamepad plugged in drives player one and the second player two, with the same buttons; each pad keeps its player while it stays plugged in. With one player every pad drives player one.
Settings
Every change takes effect at once and is saved.
- View: the classic one, 256 px wide, or the wide one, widened on both sides; its width goes from 320 to 560 px (426 for 16:9). One player and two players each keep their own view: one starts with the classic view, two with the wide one.
- Scale: the window's size in whole multiples of the picture, up to what fits the screen. The window also takes any size by hand; the picture then grows by whole multiples, centred on black.
- Full screen, on or off.
- Status bar: the pack's own layout, or a modern one: one row of numbers (the score, the coins, world and level, the clock).
- Controls: choose the player, then a button, then press the key or pad button for it; it replaces that button's keys, or its pad buttons. Defaults brings back that player's keys and pad buttons above.
- Lives: by default there is no game over and lives only count for the score; classic lives end the game when none are left.
- Slow mode: the game at 75 % or 50 % of its speed, the sound at its pitch.
- Volume, 0 to 100 %.
Importing your own ROM
Three ways, each makes a pack from the ROM on your machine and offers it on the start screen:
- "Import a ROM" on the start screen opens a file dialog.
- Drop the ROM file on the window.
stompede --import game.nesimports it, then plays.
The importer accepts only the version it supports and says so for any other file; nothing is written for it.
Where things are kept
The data directory is $XDG_DATA_HOME/stompede or
~/.local/share/stompede on Linux, %APPDATA%\stompede on Windows,
~/Library/Application Support/stompede on macOS; --data <dir> names
another one. In it: imported packs in packs/<name>/, the settings in
settings.zon (the bindings too: each button's keys and pad buttons by
name), and each pack's progress in saves/: the levels reached, the
best time of each level, whether the last level is beaten. The game
saves at a level's end, when you go back to the start screen and when
you quit, never inside a level.
Without other choices the game plays the first imported pack by name, if there is one, else the built-in pack.
In the browser
The web archive (stompede-<version>-web.zip) holds a folder with the
page, its scripts and the game as WebAssembly. Any web server that
serves files can host it: put the folder's files in one directory and
open its index.html through the server; there is no logic on the
server and all paths are relative. The server has to send the .js
files as JavaScript (text/javascript), or the browser does not run
them. Opened straight from the disk (file://) the browser refuses to
load the game. Sound needs a secure page, over https or from
localhost; elsewhere the game plays without sound and the page says
so.
A click starts the game. The keys are the program's; gamepads work
when the browser gives them the standard layout. Esc opens the pause
menu. "Quit" on the start screen ends the run, and a click starts a
new one. "Import a ROM" asks for the file over the game; the ROM is
read and imported in the page and never leaves your device. With
"Remember on this device" (on by default) the browser keeps it and
imports it again on the next visit; Forget removes it. The settings
and each pack's progress stay in the browser's storage for this site:
a setting is kept as soon as it changes, the progress when a level is
finished and when the pause menu goes back to the start screen. Adding
?no-blend to the page's address shows each update as it is.
The page is tested in Chromium-based browsers; Firefox may work, without guarantee.
Switches
stompede --pack <dir> # play the pack in a directory
stompede --continue # go on at the start of the level you left
stompede --expert <world> # the expert run from that world
stompede --players 2 # two players
The switches for the settings hold for one run and change no saved
setting: --lives (classic lives), --slow 75 or --slow 50,
--view wide (with --players 2 the view for two), --wide <px>
(256 to 560), --status modern,
--fullscreen, and --no-blend, which shows each update as it is
instead of drawing the moments between updates (smooth on screens
faster than 60 Hz).
Without a window (for checks): --script <text or file> plays a list of
held buttons and frame counts (r right, l left, u up, d down,
j jump, x run, though the X key jumps, s start, n nothing;
b and f make the player big or fire in the token's first update,
t shows the start screen and m presses Esc: n10 rx60 rxj20),
--script-two plays player two's alongside it (with --players 2),
--shot <out.png> saves the last frame, --hashes <out> writes a
hash of each update's frame and state, a line each, --map <out.png>
the whole area, and --area <n> picks the pack's area.
--gallery <out.png> saves every picture of the pack in the area's
colours. --sound <name> prints what an effect, a track (death, hurry,
...) or an area's track (area<n>) writes to the sound chip, frame by
frame, for --frames <n> frames (600); with --wav <out.wav> it saves
the sound instead.
zig build color-swatch -- <out.png> [hue saturation contrast gamma]
shows the console colours an import uses.
Building
Needs Zig 0.17. SDL3 is fetched and built by the Zig build.
zig build # the game: zig-out/bin/stompede
zig build run # build and start it
zig build test # the tests
zig build release # archives for Linux, Windows and the browser
zig build wasm # the browser version: zig-out/web/*.wasm
zig build web # and its page: zig-out/web/index.html
The release step builds both programs (ReleaseSafe, x86_64) and the
browser version and packs each with this guide, the licence and the
credits into zig-out/release/; it needs bsdtar (libarchive).
zig build wasm builds the game for the browser. With node, the
equality run tools/hashes.mjs plays scripts or behaviour cases in the
browser version that zig build wasm-check builds and writes each
update's hash; its --compare names the first update that differs. A
script's hashes compare with those the program writes with --hashes
beside --script, the cases' with those the tests write with
-Dcase-hashes=<out> beside -Drom and -Dcases.
Licence
MIT, see LICENSE. The built-in pack's pictures and music by others are
CC0 1.0; content/CREDITS.md names each work, its author and its page.