wobblyhead hg > minor_monsters
diff doc/architecture.md @ 27:75deda08db90 0.9.1
game debug functions separated into own file; release build option, distribution script
| author | ark |
|---|---|
| date | 2026-10-20 17:19 +0200 |
| parents | 3f2811aebb3d |
| children | 85d23328a215 |
line wrap: on
line diff
--- a/doc/architecture.md Tue Oct 20 16:06:50 2026 +0200 +++ b/doc/architecture.md Tue Oct 20 17:19:40 2026 +0200 @@ -31,7 +31,7 @@ index.html copied from game/, as are style.css and js/ assets/ processed images data/ maps.js, sounds.js, config.js - dist/ zip archives for distribution (ignored) + dist/ tarballs for distribution (ignored) temp/ scratch files, build previews (ignored) generated files carry a header line saying so and naming the script that made @@ -44,8 +44,8 @@ - desktop: open www/index.html directly from disk, or serve the directory with any static web server - tablet: tablets cannot easily open local html files, so the game is served - over http, from a computer on the home network or from a web host. the zip - in dist/ is meant for that + over http, from a computer on the home network or from a web host. the + tarball in dist/ is meant for that - an optional later step makes it installable to the home screen (web app manifest, offline cache). that requires https @@ -129,14 +129,25 @@ with its pivot and footprint 9. game files: copy the files in game/ to www/. a file is copied when its time or size differs from the copy. files no longer in game/ are removed - from www/, apart from www/assets/ and www/data/ + from www/, apart from www/assets/ and www/data/. a release build writes + www/js/debug.js empty a watch mode (`tools/build.py --watch`) reruns the build when a file in config/, art/, art/sounds/ or game/ changes. tuning then means: edit the toml, save, reload the browser. the same goes for changes to the game code: they show in www/ only after the build has copied them. -`tools/publish.py` writes a zip of www/ into dist/, with debug switches off. +`tools/build.py --release` leaves the debug code out: it writes +www/js/debug.js empty and leaves [debug] out of config.js. the game then +runs as with every debug switch off. + +`tools/make_dist.sh` runs a release build and packs www/ into +dist/minor_monsters_VERSION.tar.gz, which unpacks into a directory +minor_monsters. the version comes from `tools/get_version.sh -f`: the +latest tag, with a timestamp appended when the working directory is not +clean or not at the tagged revision. `--debug` builds with the debug code +in place of a release build. www/ keeps the build the script made, so a +plain build afterwards brings the debug code back. balance tools @@ -176,9 +187,10 @@ it loads www/data/config.js, www/data/maps.js and the logic files util.js, assets.js, map.js, monster.js, tower.js, projectile.js, wave.js and game.js, as the browser would, with window set to the global object. -render.js, ui.js, input.js and main.js are left out. MM.audio is the only -stub; assets.js loads unchanged, since sprite sizes come from the config -and images are only loaded by main.js. the debug switches are forced off. +render.js, ui.js, input.js, debug.js and main.js are left out, so the +debug switches have no effect. MM.audio is the only stub; assets.js loads +unchanged, since sprite sizes come from the config and images are only +loaded by main.js. the game advances in steps of 1/60 s, as in the browser; game speed plays no part. each run has its own seed, passed to the game. the players build, @@ -257,8 +269,13 @@ button starts it, and a lost map returns to it - no heart loss - show routes, placement grid, tower ranges, hit areas -- higher game speeds - on-screen frame time and entity counts +- a fixed random seed + +js/debug.js holds the code for all of them. it replaces functions of the +game and the top bar drawing, and render.js calls it to draw over the map +image and over the monsters. main.js takes the start map, wave and seed +from it. without it, as in a release build, nothing of this is left. there is no in-game config editor: values are changed in the toml file. @@ -284,6 +301,7 @@ js/render.js drawing js/ui.js top bar, shop, tower menu, screens js/input.js pointer events + js/debug.js debug switches, empty in a release build js/main.js start-up and main loop game loop:
