diff AGENTS.md @ 36:a464bd43b76c 1.0.0

clean documentation rewrite
author ark
date 2026-10-21 22:34 +0200
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/AGENTS.md	Wed Oct 21 22:34:43 2026 +0200
@@ -0,0 +1,107 @@
+agent instructions
+------------------
+
+minor monsters is a browser tower defense game, in beta and feature
+complete. expected work: fixes found in playtesting, and balance tweaks.
+README.md has the overview.
+
+what to read
+------------
+
+load only the document the task needs. each is self-contained.
+
+- rules or behaviour of the game: doc/game.md
+- build, config layout, runtime structure, debug switches:
+  doc/architecture.md
+- changing or debugging an algorithm, layout or input detail:
+  doc/implementation.md, then the code
+- sprites, masks, screens, sound events: doc/art.md
+- balance tweaks or the balance tools: doc/balancing.md
+- open items: doc/roadmap.md
+
+sources of truth
+----------------
+
+- config/game.toml holds every tuning value. the docs refer to its
+  sections and do not repeat its numbers. where a doc and the config
+  disagree, the config is right
+- the code is right about behaviour. when a doc disagrees with the code,
+  say so; do not change the code to match the doc without asking
+- when a change alters behaviour described in a doc, update that doc in
+  the same change. keep doc and config comments free of values that
+  repeat the config
+
+files
+-----
+
+- never edit www/, dist/ or temp/. they are generated and ignored by
+  mercurial. files with a "generated by" header line are build output
+- game/ holds the hand-written game files. the build copies them to www/;
+  a change shows in the browser only after a build
+- art/ holds supplied files. only the cutting scripts write there
+
+code conventions
+----------------
+
+- javascript: no libraries, no modules, no build step for code. plain
+  script tags in the order of game/index.html, one global namespace MM,
+  "use strict" inside each module, var and function declarations as in
+  the existing files. the page must keep working from file://, so no
+  fetch(), no canvas pixel reads
+- data the game needs from images is prepared by tools/build.py
+- python: 3.11 or later. the build uses the standard library and pillow
+  only; numpy and matplotlib are for tools/balance.py alone
+- comments are lower case prose, as in the existing files. the docs for
+  human readers, README.md and doc/, use normal capitalisation: capital
+  letters at the start of sentences, headings and list items, and for
+  names and abbreviations such as HTML or Python. code names, files and
+  config keys keep their spelling
+- a new sprite has to be added to SPRITES in tools/build.py. a new sound
+  event needs an entry in [sound.event]; a recording with variants also an
+  entry in VARIANTS in tools/cut_sounds.py
+
+commands
+--------
+
+    python3 tools/build.py              # build into www/
+    python3 tools/build.py --force      # rerun every step
+    python3 tools/build.py --release    # no debug code
+    tools/make_dist.sh                  # release tarball in dist/
+    node tools/simulate.js              # scripted players on the real game logic
+    python3 tools/balance.py            # balance estimate, needs numpy, matplotlib
+    python3 tools/balance.py --draft 2  # wave lists drafted for map2
+
+the build prints checks and warnings per map; read them after a change to
+the config or the masks. temp/preview/ has map previews with routes and
+placement grid, and towers.png with tower angles and pivots.
+
+for balance changes: edit config/game.toml, build, run tools/simulate.js
+and compare temp/preview/simulate.txt with the targets in
+doc/balancing.md.
+
+screenshots
+-----------
+
+firefox's own --screenshot captures before the game has drawn. use
+ff_screenshot (in $PATH), which drives headless firefox and waits before
+capturing. `ff_screenshot -h` lists its options.
+
+    ff_screenshot -w 1024,768 -s 2 file://$PWD/www/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, -S waits again before capturing. a pointer
+event sent to the canvas is a tap at that position in css pixels. a fresh
+firefox profile has no stored settings, so the splash screen first shows
+the sound button over the play button. this taps it, and the play button
+a second later, at 1024 x 768:
+
+    ff_screenshot -w 1024,768 -s 2 -S 3 -J 'function tap() {
+        document.getElementById("game").dispatchEvent(new PointerEvent(
+        "pointerdown", {clientX: 497, clientY: 560, bubbles: true})) }
+        tap(); setTimeout(tap, 1000)' \
+        file://$PWD/www/index.html temp/play.png
+
+the debug switches in [debug] (start map and wave, unlimited coins, no
+heart loss, overlays) help to reach a state quickly. a release build
+leaves them out.