wobblyhead hg > minor_monsters
comparison AGENTS.md @ 36:a464bd43b76c 1.0.0
clean documentation rewrite
| author | ark |
|---|---|
| date | 2026-10-21 22:34 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 35:0d40f346059c | 36:a464bd43b76c |
|---|---|
| 1 agent instructions | |
| 2 ------------------ | |
| 3 | |
| 4 minor monsters is a browser tower defense game, in beta and feature | |
| 5 complete. expected work: fixes found in playtesting, and balance tweaks. | |
| 6 README.md has the overview. | |
| 7 | |
| 8 what to read | |
| 9 ------------ | |
| 10 | |
| 11 load only the document the task needs. each is self-contained. | |
| 12 | |
| 13 - rules or behaviour of the game: doc/game.md | |
| 14 - build, config layout, runtime structure, debug switches: | |
| 15 doc/architecture.md | |
| 16 - changing or debugging an algorithm, layout or input detail: | |
| 17 doc/implementation.md, then the code | |
| 18 - sprites, masks, screens, sound events: doc/art.md | |
| 19 - balance tweaks or the balance tools: doc/balancing.md | |
| 20 - open items: doc/roadmap.md | |
| 21 | |
| 22 sources of truth | |
| 23 ---------------- | |
| 24 | |
| 25 - config/game.toml holds every tuning value. the docs refer to its | |
| 26 sections and do not repeat its numbers. where a doc and the config | |
| 27 disagree, the config is right | |
| 28 - the code is right about behaviour. when a doc disagrees with the code, | |
| 29 say so; do not change the code to match the doc without asking | |
| 30 - when a change alters behaviour described in a doc, update that doc in | |
| 31 the same change. keep doc and config comments free of values that | |
| 32 repeat the config | |
| 33 | |
| 34 files | |
| 35 ----- | |
| 36 | |
| 37 - never edit www/, dist/ or temp/. they are generated and ignored by | |
| 38 mercurial. files with a "generated by" header line are build output | |
| 39 - game/ holds the hand-written game files. the build copies them to www/; | |
| 40 a change shows in the browser only after a build | |
| 41 - art/ holds supplied files. only the cutting scripts write there | |
| 42 | |
| 43 code conventions | |
| 44 ---------------- | |
| 45 | |
| 46 - javascript: no libraries, no modules, no build step for code. plain | |
| 47 script tags in the order of game/index.html, one global namespace MM, | |
| 48 "use strict" inside each module, var and function declarations as in | |
| 49 the existing files. the page must keep working from file://, so no | |
| 50 fetch(), no canvas pixel reads | |
| 51 - data the game needs from images is prepared by tools/build.py | |
| 52 - python: 3.11 or later. the build uses the standard library and pillow | |
| 53 only; numpy and matplotlib are for tools/balance.py alone | |
| 54 - comments are lower case prose, as in the existing files. the docs for | |
| 55 human readers, README.md and doc/, use normal capitalisation: capital | |
| 56 letters at the start of sentences, headings and list items, and for | |
| 57 names and abbreviations such as HTML or Python. code names, files and | |
| 58 config keys keep their spelling | |
| 59 - a new sprite has to be added to SPRITES in tools/build.py. a new sound | |
| 60 event needs an entry in [sound.event]; a recording with variants also an | |
| 61 entry in VARIANTS in tools/cut_sounds.py | |
| 62 | |
| 63 commands | |
| 64 -------- | |
| 65 | |
| 66 python3 tools/build.py # build into www/ | |
| 67 python3 tools/build.py --force # rerun every step | |
| 68 python3 tools/build.py --release # no debug code | |
| 69 tools/make_dist.sh # release tarball in dist/ | |
| 70 node tools/simulate.js # scripted players on the real game logic | |
| 71 python3 tools/balance.py # balance estimate, needs numpy, matplotlib | |
| 72 python3 tools/balance.py --draft 2 # wave lists drafted for map2 | |
| 73 | |
| 74 the build prints checks and warnings per map; read them after a change to | |
| 75 the config or the masks. temp/preview/ has map previews with routes and | |
| 76 placement grid, and towers.png with tower angles and pivots. | |
| 77 | |
| 78 for balance changes: edit config/game.toml, build, run tools/simulate.js | |
| 79 and compare temp/preview/simulate.txt with the targets in | |
| 80 doc/balancing.md. | |
| 81 | |
| 82 screenshots | |
| 83 ----------- | |
| 84 | |
| 85 firefox's own --screenshot captures before the game has drawn. use | |
| 86 ff_screenshot (in $PATH), which drives headless firefox and waits before | |
| 87 capturing. `ff_screenshot -h` lists its options. | |
| 88 | |
| 89 ff_screenshot -w 1024,768 -s 2 file://$PWD/www/index.html temp/splash.png | |
| 90 | |
| 91 -w sets the viewport, -s the wait after loading. the game state is not | |
| 92 reachable from outside, so other screens are reached by tapping: -J runs | |
| 93 javascript after the wait, -S waits again before capturing. a pointer | |
| 94 event sent to the canvas is a tap at that position in css pixels. a fresh | |
| 95 firefox profile has no stored settings, so the splash screen first shows | |
| 96 the sound button over the play button. this taps it, and the play button | |
| 97 a second later, at 1024 x 768: | |
| 98 | |
| 99 ff_screenshot -w 1024,768 -s 2 -S 3 -J 'function tap() { | |
| 100 document.getElementById("game").dispatchEvent(new PointerEvent( | |
| 101 "pointerdown", {clientX: 497, clientY: 560, bubbles: true})) } | |
| 102 tap(); setTimeout(tap, 1000)' \ | |
| 103 file://$PWD/www/index.html temp/play.png | |
| 104 | |
| 105 the debug switches in [debug] (start map and wave, unlimited coins, no | |
| 106 heart loss, overlays) help to reach a state quickly. a release build | |
| 107 leaves them out. |
