wobblyhead hg > minor_monsters
diff doc/architecture.md @ 4:2d46729a022e
sound processing and in-game sounds
| author | ark |
|---|---|
| date | 2026-10-18 20:58 +0200 |
| parents | 7af9dd4e2595 |
| children | 910b26feca76 |
line wrap: on
line diff
--- a/doc/architecture.md Sun Oct 18 20:09:40 2026 +0200 +++ b/doc/architecture.md Sun Oct 18 20:58:33 2026 +0200 @@ -16,6 +16,8 @@ proposed: art/ drawings as supplied: scans, masks, sprites + sound_sources/ voice recordings as supplied + sounds/ sounds cut from the recordings (tools/cut_sounds.py) config/ hand-edited game settings (toml) game.toml numbers from balance.md, waves, debug switches routes.toml manual corrections to the extracted routes @@ -25,7 +27,7 @@ style.css js/ game code, hand-written assets/ processed images (generated, committed) - data/ maps.js, config.js (generated, committed) + data/ maps.js, sounds.js, config.js (generated, committed) doc/ design and technical notes www/ copy of game/ prepared for publishing (ignored) dist/ zip archives for distribution (ignored) @@ -55,8 +57,8 @@ - data files are javascript files that assign to that object, not json files - the game never reads mask pixels; the build turns the masks into data - images are loaded with image elements, which works from disk -- recorded sounds will be embedded by the build as base64 data in a - javascript file, so they can be decoded without fetch() +- recorded sounds are embedded by the build as base64 data in a javascript + file, so they can be decoded without fetch() build @@ -67,6 +69,10 @@ built-in toml reader) and pillow. numpy is optional, if the pure python image steps turn out too slow. +tools/cut_sheet.py and tools/cut_sounds.py are run by hand and write to art/. +cut_sounds.py also needs ffmpeg with mp3 support, so the build itself does not +depend on it. see sound.md. + steps: 1. sprites: trim transparent edges, write to game/assets/ @@ -82,14 +88,16 @@ - write a placement grid: cells where a tower footprint fits next to the path, within the limits in balance.md - extract routes, see below -5. config: read config/game.toml, check it, write game/data/config.js -6. checks: print a summary per map (routes with length and turning, monster +5. sounds: embed art/sounds/*.mp3 as base64 in game/data/sounds.js, + grouped by event +6. config: read config/game.toml, check it, write game/data/config.js +7. checks: print a summary per map (routes with length and turning, monster counts, coins and hp per map against the target) and warn on problems -7. previews: draw each map with its routes, entrances, exits and placement +8. previews: draw each map with its routes, entrances, exits and placement grid into temp/preview/, for checking without starting the game a watch mode (`tools/build.py --watch`) reruns the build when a file in -config/ or art/ changes. tuning then means: edit the toml, save, reload the +config/, art/ or art/sounds/ changes. tuning then means: edit the toml, save, reload the browser. `tools/publish.py` copies game/ to www/ with debug switches off, and writes a @@ -159,9 +167,10 @@ data/config.js generated settings data/maps.js generated map data + data/sounds.js generated sound data js/util.js vector maths, random numbers, easing js/assets.js image loading, sprite table - js/audio.js placeholder beeps, later recorded sounds + 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
