Ember Swarm is a survivors-like horde game on PixiJS 8. You only move; the weapons fire on their own, enemies drop sparks, and every level offers three cards, so each five-minute run builds a different firestorm before The Hollow Pyre arrives at 5:00.
Simulation apart from rendering. All rules live in core/ as plain TypeScript with no engine import: a fixed 60 Hz step, seeded spawns, a wave director (spawn rate a + b·m + c·m², breathers after each elite, a swarm ring at 4:00, a quiet stretch before the boss), six weapons and six relics with five levels each, three evolutions opened by elite chests, the boss's three phases, and the coal economy. Vitest covers the curves, determinism, evolutions, the boss win, Second Wind and save validation.
Up to 400 enemies at 60 fps. Enemies, bolts, enemy shots, sparks and effects are fixed pools that are reused, never allocated mid-run. Collisions use a uniform grid rebuilt each step around the keeper (a linked list in two typed arrays), so every weapon asks only nearby cells. The view mirrors the pools slot for slot: enemy i is always sprite i, so a frame never creates or destroys a display object.
Balanced by a bot. A keeper bot steers away from bodies, shots and telegraphs and drifts toward sparks; the balance test plays a whole career of runs with a skill that grows, buys the cheapest item after each, and checks that the next purchase always comes within one to four runs (BALANCE=1 npx vitest run src/experiments/ember-swarm).
Art and sound in code. Every sprite (the keeper, six enemy kinds with their own eye colour, the boss, decor, two ground tiles) is painted once with Canvas 2D and uploaded as a texture; hit flashes use a second white silhouette of each kind. The boss carries a displacement-map heat haze on capable devices. Every sound is synthesized with Web Audio: a crackle loop, pickup ticks that climb in pitch, a boss drone.
Performance and access. Resolution is capped at 2×; a frame-time watchdog drops to a light tier (fewer particles, resolution 1, no haze) if frames stay slow. The game pauses when the tab is hidden or the window loses focus. Under reduced motion there is no shake, hit-stop, slow motion or damage numbers and fewer particles. The HUD, cards, Forge and results are HTML, so text stays sharp and reachable by keyboard.
Readability pass (2026-11-11). First runs (fewer than GENTLE.runs) start gentle: for 40 s the swarm hits for 40 % (speed unchanged: slowing it delayed the first kills and the first level to ~35 s and still killed 6 of 20 sim keepers). A keeper walking a small square levels up in ~6.6 s on average with no deaths over 20 seeds; one who stands still lasts ~14 s instead of 7.6 s. Shrines wake every 45 s from 0:30 at 280–420 units; standing in the 72-unit ring for 1.8 s lights one and pulls every spark on the field (a choice: walk out into the dark for a burst of levels). The Ash Weaver (from 2:45) keeps its distance and calls three motes after a 1.1 s cast. The boss is announced 10 s ahead (bossWarn). Level-up cards name the level step and the evolution they lead to. Pause has Calm effects (no shake or flashes, Bridge.calm) and Large HUD (zoom 1.3).
Rendering on weak GPUs. Fill rate is the cost, not script time: the glowing cracks are baked into the ground and lit in the half-resolution light map, the vignettes darken the light map instead of the screen, fog is 4 banks (none on the light tier). The frame watchdog drops to the light tier after 3 s of slow frames, then to 0.7 render resolution if still slow; a slow frame may run up to 12 sim steps so game time stays real. Measured on SwiftShader at 1440×900: the hub went from 4.5 to 10.5 fps; a real GPU holds 60 fps in the ?shot scene.
Economy and omens (2026-11-11, user: runs felt samey and paid too little). Coal per run: 1 per 75 kills, 1 per 4 s, 1 per level reached, a floor of 6, daily bonus 15; Forge tracks go deeper (Heart and Kindle 10 levels, Draft and Lure 6, Fortune 8) at cost base · 1.55^n. Career sim (BALANCE=1, 60 runs): a purchase after every run for the first ~22 runs, then every 2–3, everything bought in ~32 runs. From the third run the start screen offers two of six omens (Blood Moon, Gilded Ash, Ember Gale, Glass Flame, Hunters' Night, Still Night), each a twist with a coal multiplier from ×0.8 to ×2, shown as its own receipt line; a fresh pair after every run.
Faster progression and the lantern's breath (2026-11-11, user: progress felt too long; enemies hit right after a pause or a card). Coal is now 1 per 40 kills, 1 per 3 s, 4 per level reached (the HUD counter pops on every level), a floor of 12 and a daily bonus of 25. Career sim: the first run buys three things, then a purchase after every run, everything bought in ~21 runs. After the last level-up choice and on every resume, grace() throws nearby foes back to 170 units, burns enemy shots within 240 and gives 1.2 s of invulnerability with a ring. The end screen fits 720 px high (coal and receipt side by side on wide screens, "New best" as a pill under the number).
Round 2: forged UI, readable fire, keepers and the long night (2026-11-13, user: buttons and intro looked off-style, fire hid everything in big swarms, deepen the mechanics but keep the progression). One button family: the main action is a furnace door (soot panel, glowing vents), secondary actions are riveted iron tags, studs are square plates, Forge prices are stamped tags. The start screen has a big carved title, a keeper picker, arenas as tags with a window onto the ground, a night-heat stepper and omens; phones show the keeper and his brazier between the title and the choices. The keeper's own fire lives in its own layer under foes' eyes, foes' shots and the keeper, and fades as the swarm thickens (crowd factor from the live foe count); fire lights share a per-frame budget and novas are fainter, so the ground no longer washes out to beige. Touch phones start at 1.25× and a smaller spark pool. Mechanics: three keepers (start weapon and trade-offs, scarf tint), Reroll and Banish charges from the Forge plus a free Skip (+2 coal), an evolution for every weapon (Wildfire, Lighthouse, Starfall), chests that are usually one card or a ready evolution and sometimes three or five upgrades at once (one evolution per chest), the long night after the Pyre to dawn at 10:00 (kills stop paying, 1 coal per 3 s and a dawn bonus), and night heat 1–10 per arena opened by wins. Older saves are migrated. Forge growth went to 1.55: with the new pay the career bot buys something after every run and finishes the Forge in ~14 runs (the bot is capped at 6:40). The bot's first-run result is luck-sensitive (a different random path flips a 2:40 death into a win), which was true before this round too. ?shot&crowd packs ~300 foes for readability checks; ?dev also opens heat 3 and one reroll and banish.
Forge tracks Luck, Mend and Armour (round 2, B6): Luck scales both lucky chest slices, Mend heals a little every frame in Run movement, Armour subtracts a flat amount in hurtPlayer but never below a third of the hit, so heat and the boss stay dangerous.
Bellmire (round 2, third arena): the same stable pool cells as Frost Hollow's ice (icePatch), read as water: foes wade at 0.6 speed, the Drowned swim at 1.45, the keeper is never slowed. Enemies refresh their wet flag every fourth step to keep the cost flat in big swarms. Every 40 s the bell tolls and drowned rise on a ring around the keeper after a 1.2 s ripple (rises). Its boss, The Drowned Bell (BOSS_OF, BELL), shares the Pyre's health but has its own moves: a tolled ring of black water that rolls outward and hurts on its band except in two or three gaps (waves), a ring of drowned around the keeper, a slower shot ring and, in the last phase, a four-arm spiral. Hits show as a brighter witch-light glow instead of a white flash, since a strong build hits it every frame. The music drops its pads and answers each phrase with a deep drowned bell. ?shot&arena=mire&t=299 opens a shot run there at any time.