wobblyhead hg > minor_monsters
diff doc/architecture.md @ 6:910b26feca76
full game flow
| author | ark |
|---|---|
| date | 2026-10-19 01:05 +0200 |
| parents | 2d46729a022e |
| children | 2c4fed8baed9 |
line wrap: on
line diff
--- a/doc/architecture.md Sun Oct 18 22:50:24 2026 +0200 +++ b/doc/architecture.md Mon Oct 19 01:05:29 2026 +0200 @@ -61,6 +61,30 @@ file, so they can be decoded without fetch() +screenshots +----------- + +firefox's own --screenshot captures at the load event. the game loads its +images and draws its first frame after that, so the capture shows an empty +page. the ff_screenshot script (in $PATH, ~/bin/ff_screenshot) drives +headless firefox over marionette and waits before capturing: + + ff_screenshot -w 1024,768 -s 2 file://$PWD/game/index.html temp/splash.png + +-w sets the viewport, -s the wait after loading. the game state is not +reachable from outside, so other screens are reached by tapping: -J runs +javascript after the wait, and -S waits again before capturing. a pointer +event sent to the canvas counts as a tap at that position in css pixels. +this taps the play button on the splash screen at 1024 x 768: + + ff_screenshot -w 1024,768 -s 2 -S 3 -J 'document.getElementById("game") + .dispatchEvent(new PointerEvent("pointerdown", + {clientX: 512, clientY: 444, bubbles: true}))' \ + file://$PWD/game/index.html temp/play.png + +`ff_screenshot -h` lists the other options. + + build ----- @@ -75,7 +99,8 @@ steps: -1. sprites: trim transparent edges, write to game/assets/ +1. sprites: trim transparent edges, write to game/assets/. make the hp bar + variants: the empty part, and the blue bars for slowed monsters (art.md) 2. tower levels: t0-t3 are level 1. split each t*p strip into four images, levels 2-5. fill the inside of the outline with white (flood fill from outside, everything not reached is inside), trim, write as t0_2..t0_5 and @@ -150,8 +175,8 @@ debug switches, all off by default: - start coins override, unlimited coins -- start at a given map and wave -- unlock all maps +- start at a given map and wave. that map counts as the first map: the play + button starts it, and a lost map returns to it - no heart loss - show routes, placement grid, tower ranges, hit areas - higher game speeds @@ -171,7 +196,6 @@ js/util.js vector maths, random numbers, easing js/assets.js image loading, sprite table js/audio.js recorded sounds, placeholder beeps for the other events - js/storage.js localStorage wrapper js/map.js placement lookup, snapping, route sampling js/monster.js movement along a route, hops, slow, hp js/tower.js targeting, attacks, upgrade, sell @@ -225,7 +249,11 @@ persistence: -- one localStorage entry holds unlocked maps and settings (sound on or off) +- nothing is stored for now. maps are played in order and a lost map goes + back to the first map, so there is no progress to keep. a reload starts at + the splash screen with a fresh game +- once the game has settings, such as sound on or off, js/storage.js wraps + localStorage, and one entry holds them - all access is wrapped so the game still runs when storage is unavailable, for example in private browsing; progress is then not saved - the entry carries a version number for later format changes
