01Requirements
- Node.js 20 or newer.
- A modern browser. The game needs network access to unpkg.com and Google Fonts at runtime.
02Run the game
npm run serve
This serves game/. Open http://localhost:4190/Substellar.dc.html. Add ?mobile=1 to force the compact phone layout. Any static server works (python -m http.server), but file:// does not, because the game fetches sibling files.
03Checks
npm run check
This parses every script, confirms that every literal asset path in the code exists, checks the entry point's script tags, checks that the version shown in the game matches package.json and that CHANGELOG.md was regenerated from the release notes, and plays a headless game of Obsidian Pass on Easy to a win. It does not cover asset paths built at runtime from ids; the playtest does.
04Balance bot
node tools/balance-bot.js --maps obsidian,cd_pass --diffs easy,normal --runs 3
Options: --maps (ids from MAPS in game/sub-data.js), --diffs, --runs, --waves (stop after this wave) and --threat (enemy multiplier). The bot places Missile Turrets and Chain Guns on plateau cells along the traced shortest route, AA Guns near the gate before air waves, Goo Cannons at one per five ground defenses, and then buys upgrades cheapest first. Keep the route trace: a bot that builds off the route reports false difficulty.
--strat picks a stronger player: mixed (a spread of weapons, support structures, abilities), pro (mixed plus AA anywhere near the gate and swapping cheap turrets for better machines once the board is full), or the exploit checks radar and howitzer. For rule or wave changes, check --strat pro on Easy to Hard; late-game ceilings need a fully upgraded board, which the bot only reaches on long runs.
More options: --seed N (runs repeat exactly; run i uses seed N and its index), --detail (lives lost per wave and which classes leaked), --lives N (start with N lives, to judge the late game apart from the bot's early leaks), --bank N (extra credits each wave, to test whether a maxed board can hold).
Wave budget and the balance gate
When balancing, check Meridian Rim Works (md_rim) first, on Hard (128) and Extreme (256), with --strat mixed as the average player; then the other maps.
From wave 24 (BUD.start) every wave keeps its classes, levels and modifiers but follows a smooth health target per difficulty (BUD and budT() in sub-data.js). Counts scale by the square root of target over natural health, and the per-wave multiplier hm makes up the rest; kill rewards scale with hm^0.8. Air units and modifiers count extra (BUD.air, BUD.mod). To change difficulty, tune BUD.<difficulty> (b start health, g and p curve, knee and lin for the late linear climb), not the hand-written PROG lists.
npm run balance:gate (also in CI, about a minute) fails if any wave strays from its target or jumps more than 1.6× over the previous one, or if the seeded pro bot stops winning Easy and Normal or reaching wave 64 on Hard and Extreme (Extreme with 40 lives). For a deeper check before a release:
node tools/balance-bot.js --maps obsidian,foundry --diffs hard,extreme --runs 2 --strat pro --waves 256 --detail
node tools/balance-bot.js --maps obsidian,foundry --diffs extreme --runs 2 --strat pro --waves 256 --lives 40
At v2.2.0 the second command wins all 256 waves in every run, losing 12-26 of the 40 lives, of which the bot loses 8-9 by wave 17.
npm run smoke also times an Extreme wave-200 battle with every plateau cell built at 3× speed and fails on a median frame over 50 ms (100 ms in CI, where GitHub's runners have no GPU and measure about 66 ms on unchanged code) or a 99th-percentile frame over 250 ms. Other heavy work on the machine (a compiler, another game) makes it flaky locally; rerun when the machine is idle.
05Playtesting
Before calling a change done, play it through the normal menus with player-style input:
- Splash, menu, Deploy, pick a map and difficulty, battle.
- Build, upgrade, sell, use each ability, and play a few waves.
- Leave the page mid-battle, come back, and confirm the session resumes paused.
- For any UI change, repeat in the compact layout (
?mobile=1, or a phone-sized window) in portrait and landscape.
Known gaps at v2.3.2: balance has only been checked with the bot (the bot builds no walls and leaks early on Extreme), portrait has not been checked on real iOS Safari and Android Chrome, gamepad menu navigation is untested on hardware, and only some cursors in assets/sub/cursors/ are wired.
06Build the site locally
npm install
npm run build
npm run preview
npm run build writes dist/: the homepage and changelog from site/ at the root, the game unchanged in dist/play/, the docs rendered to dist/docs/, Cloudflare _headers and _redirects files, and build-manifest.json with the sha256 of every file and the export digest. npm run preview serves it at http://localhost:4191/; the game is at /play/.
07Website art
The site uses web-sized copies of the game's paintings, emblems, boss portraits and menu layers in site/assets/art/. After changing that art in game/assets/, run node tools/site-art.cjs (it drives Google Chrome through Playwright) and commit the output.
08Release notes
Add every user-visible change to the top entry of site/release-notes.json (create a new entry for a new version), in plain language: Added, Changed, Fixed or Security, plus developer details under technical. Then run node tools/changelog.cjs to regenerate CHANGELOG.md. Never edit CHANGELOG.md by hand; npm run check fails if it is stale.