wobblyhead hg > minor_monsters
comparison doc/roadmap.md @ 36:a464bd43b76c 1.0.0
clean documentation rewrite
| author | ark |
|---|---|
| date | 2026-10-21 22:34 +0200 |
| parents | 85d23328a215 |
| children |
comparison
equal
deleted
inserted
replaced
| 35:0d40f346059c | 36:a464bd43b76c |
|---|---|
| 1 roadmap | 1 Roadmap |
| 2 ------- | 2 ------- |
| 3 | 3 |
| 4 steps in order. each ends with something that runs and can be looked at. | 4 The game is in beta and feature complete. It is deployed on a web server |
| 5 and runs in desktop and mobile browsers. The steps that built it are | |
| 6 listed in history.md. | |
| 5 | 7 |
| 6 1. build basics | 8 Open: |
| 7 - directory layout, config/game.toml with the values from balance.md | |
| 8 - build script: sprites, tower level split and fill, map copies, | |
| 9 config.js | |
| 10 - check: the processed tower levels look right | |
| 11 2. maps and routes | |
| 12 - mask classification, placement grid, route extraction | |
| 13 - previews in temp/preview/ | |
| 14 - check: routes on all four maps follow the paths, placement grid looks | |
| 15 sensible | |
| 16 3. map and walking monsters | |
| 17 - index.html, main loop, scaling to the window, map drawing | |
| 18 - monsters walk their routes with hop animation and route preference | |
| 19 - check: hop and squash feel; speeds against path lengths | |
| 20 4. waves and hearts | |
| 21 - wave timing, countdown, early start and bonus, hearts, win and loss | |
| 22 5. towers | |
| 23 - shop, placement with snapping and preview, targeting, projectiles, | |
| 24 damage, hp bars, coin drops and flying coins | |
| 25 - first playable version of map0 | |
| 26 6. tower details | |
| 27 - upgrades, selling the whole tower, t0 melee | |
| 28 and spike sides, t2 slow with the blue hp bar, boss with its bar | |
| 29 7. game flow | |
| 30 - splash screen with title, byline and play button over the paused first | |
| 31 map; the play button starts the sound | |
| 32 - map won with next, game won after the last map with restart to the | |
| 33 splash screen, map lost back to the first map | |
| 34 - no map selection, unlocking or localStorage | |
| 35 8. tuning on all maps | |
| 36 - balance calculation, then the headless simulation to check it | |
| 37 (balance.md, balancing; architecture.md, balance tools) | |
| 38 - wave lists for maps 1-3, playtesting, balance changes in config only | |
| 39 9. supplied art and sound | |
| 40 - icons, screens and digits as the drawings arrive (art.md) | |
| 41 - voice recordings as they arrive (sound.md) | |
| 42 10. publishing | |
| 43 - tools/make_dist.sh, dist/ tarball of www/, hosting for tablet play | |
| 44 11. help page | |
| 45 - a hint page made from game graphics, no text where a picture will do | |
| 46 - the tower ranges side by side | |
| 47 - placing a tower: one tap puts the preview down, a second tap on it | |
| 48 builds | |
| 49 - t0 hitting several monsters with one attack | |
| 50 - t2 slowing a monster, with the blue hp bar | |
| 51 | 9 |
| 52 debug switches (architecture.md) are added as each step needs them, starting | 10 - Playtesting, and fixes for the problems it finds |
| 53 with step 3. | 11 - Balance tweaks, in config/game.toml only (balancing.md) |
| 54 | 12 - Restate the balance targets now that a boss that gets through loses the |
| 55 | 13 map. HEARTS_TARGET in tools/balance.py and tools/simulate.js and the aim |
| 56 prototype notes | 14 in balancing.md date from when it cost 5 hearts |
| 57 --------------- | 15 - The early start bonus is also paid before the first wave. Whether it |
| 58 | 16 should be is undecided |
| 59 decisions taken while building steps 1-7 that the other documents do not | 17 - Screens too narrow for the counters and the buttons in two top bar rows |
| 60 cover. values marked proto in config/game.toml refer to this list. | 18 are not handled |
| 61 | 19 - Optional: make the game installable to the home screen (web app |
| 62 build: | 20 manifest, offline cache). This needs HTTPS |
| 63 | 21 - Optional art (art.md) |
| 64 - runs on python 3.11 or later with pillow; numpy is not used. a full build | |
| 65 takes about 5 s, most of it in the mask step | |
| 66 - a step is skipped when its outputs are newer than its inputs and the build | |
| 67 scripts. the mask step also reruns when the placement settings or the | |
| 68 per map road and spawn settings in game.toml change; it keeps its result in temp/build/maps.json for the | |
| 69 checks and previews | |
| 70 - map images are written as jpeg, quality 88. the maps have no transparency | |
| 71 - tower strips are split at columns without ink. ink is anything darker | |
| 72 than luminance 225. outline gaps of up to about 4 pixels are closed before | |
| 73 the fill. the white paper edge outside the outline fades to transparent | |
| 74 - tools/cut_sheet.py cuts the sprites out of art_sources/source_sheet_2.jpg | |
| 75 into art/. it | |
| 76 is run by hand, not by the build. one hand-set box per drawing; in each box | |
| 77 the largest connected outline is the drawing and other ink is dropped. | |
| 78 outline ink is darker than luminance 150. sprites stay at the sheet's | |
| 79 scale, which is the scale the first cutouts had, so [scale] is unchanged. | |
| 80 coins and maps are not on the inked sheet and stay as they were | |
| 81 - game_won.png and game_won_button.png were cut once from | |
| 82 art_sources/game_won.jpg with the cut function of cut_sheet.py; the scan | |
| 83 has no boxes in the script | |
| 84 - tools/cut_digits.py takes every connected stroke on digits.png as one | |
| 85 character. ink is darker than luminance 150, strokes under 30 pixels are | |
| 86 specks. rows are told apart by the stroke centre, and the characters of | |
| 87 each row are listed in the script. the scaled height is 66.5 pixels, the | |
| 88 median of the drawings | |
| 89 - the empty part of the hp bars is a darkened copy made by the build | |
| 90 (hpm_empty, hpb_empty). the blue bars for slowed monsters have the hue of | |
| 91 every pixel set to 220 degrees, which leaves the black outline as it is | |
| 92 (hpm_slow, hpb_slow, each with its _empty copy) | |
| 93 - sprite sizes go into config.js, so the game knows them before the images | |
| 94 load | |
| 95 - mask pixels are classified by exact colour. any pixel that is not fully | |
| 96 transparent and not one of the three colours stops the build | |
| 97 - the placement test draws discs instead of keeping a distance for every | |
| 98 pixel. the result is the same. the road is a disc of footprint radius plus | |
| 99 road half width around each centre line pixel; centre line pixels inside | |
| 100 the entrance and exit areas do not count. each spawn point gets a disc of | |
| 101 footprint radius plus spawn_distance, each exit point one of footprint | |
| 102 radius plus exit_distance. edge_distance applies to the tower centre | |
| 103 - the spawn point is the first centre line pixel outside the entrance area, | |
| 104 walking from the route start. the exit point is found the same way from | |
| 105 the route end | |
| 106 - the centre line runs through the entrance and exit areas, so routes start | |
| 107 and end inside them. dead ends shorter than 0.8 line widths are dropped. | |
| 108 junctions closer together than 0.75 line widths count as one. the line | |
| 109 width is the red area divided by the centre line length, about 11 pixels | |
| 110 - map2 has three loops (the round one at the top left, two squares at the | |
| 111 bottom). each leaves the path at a junction and comes back to the same | |
| 112 junction, so the rule "no junction twice" would never walk them. a route | |
| 113 may walk such a loop once. of its two directions, the one that turns less | |
| 114 is kept. map2 gives 6 routes, all kept; map1 gives 3 | |
| 115 - route smoothing: moving average over 17 points, applied twice, then | |
| 116 simplified to 0.8 pixel tolerance | |
| 117 - straightness for the route value is the least turning of the map's routes | |
| 118 divided by the route's turning. turning is the total, not per length | |
| 119 - the road half widths are the median distance from the centre line to the | |
| 120 edge of the earlier masks, which covered the whole road. map0's route is | |
| 121 2068 long | |
| 122 - the build prints the coins dropped per map, boss included, with and | |
| 123 without the starting coins. the earlier check against 10 x the starting | |
| 124 coins is gone (balance.md, economy) | |
| 125 - the build prints the early start bonus for skipping every break, including | |
| 126 the one before the first wave: 8, 21, 53, 94. balance.md gives 6, 17, 45, | |
| 127 82, which leaves that break out. the game pays the bonus before the first | |
| 128 wave too. to decide | |
| 129 | |
| 130 config: | |
| 131 | |
| 132 - per map: [map.N] holds starting_coins, early_bonus, wave_count, the | |
| 133 draft numbers monster_share, wave_size and first_wave, followed by the | |
| 134 [[map.N.wave]] lists | |
| 135 - added: hit_radius in [animation] (0.4 of the monster sprite's smaller | |
| 136 side), min_weight in [route_preference] (the "at least 0.1" of the rule), | |
| 137 [art.angle] and [art.pivot]. the turning towers turn around the middle of | |
| 138 their body, not the middle of the image. t1: the centre of the box | |
| 139 measured on the cutouts. t2: the middle of the round body, found as the | |
| 140 rows at least 60 % as wide as the widest row. t3: an estimate, the | |
| 141 centroid of the shape once the barrel and star tips are removed, to adjust | |
| 142 by hand. temp/preview/towers.png marks them. the angles are set by hand on | |
| 143 the same sheet, which shows every turning tower turned to face up | |
| 144 - draft waves: monster counts per level from the coin shares. each level is | |
| 145 spread over the waves by the coin budget still open, with wave n worth n | |
| 146 shares. higher levels start later: m1 after 15 % of the waves, m2 35 %, m3 | |
| 147 50 %, m4 65 %. spawn interval 1.0 s on maps 0 and 1, 0.8 s on map2, 0.7 s | |
| 148 on map3. totals: 102, 199, 398, 600 coins | |
| 149 | |
| 150 game: | |
| 151 | |
| 152 - scripts share the namespace object MM. storage.js keeps the settings in | |
| 153 the localStorage entry minor_monsters, as version 1 | |
| 154 - the simulation runs on wall clock time: at 60 frames per second, 2x gives | |
| 155 two steps per frame. at most 4 steps per frame and speed step; a longer | |
| 156 frame drops the rest | |
| 157 - game flow: the first map is debug.start_map, and only the first map | |
| 158 starts at debug.start_wave; the next maps start at wave 1. | |
| 159 debug.start_coins applies to every map. the splash screen pauses the | |
| 160 first map, and only its buttons respond. the next map starts with its break running, as | |
| 161 does the first map after a lost map. the splash screen has a pale veil | |
| 162 over the map, the other screens a dark one | |
| 163 - screens: the scale is the same for all four drawings, set so the widest | |
| 164 and the tallest fit 92 % of the window width and 90 % of its height, at | |
| 165 most 1. the separate button image is drawn over the button in the | |
| 166 drawing; [art.screen] in game.toml holds where, measured by matching the | |
| 167 images. its tap area is the button image. it pulses by 4 % over 1.2 s; | |
| 168 under the mouse it is 8 % larger with a shadow | |
| 169 - splash screen logo and question mark: placed by their top left corner and | |
| 170 height in [art.screen], and pulse like the play button. the logo opens | |
| 171 logo_url from [links] in a new tab when the pointer is let go over it, as | |
| 172 tablets allow a new tab only then. the question mark and the top bar help | |
| 173 button have no action until the help popup exists | |
| 174 - a break starts when the last monster of the wave has spawned, not when | |
| 175 all of them are gone. monsters of the wave may still be on the map during | |
| 176 the break. during a break the wave counter shows the next wave | |
| 177 - monsters move at constant speed; the hop is drawn only. a hop spends 80 % | |
| 178 of its time in the air and 20 % landing. the idle bob is a slow breathing | |
| 179 (1.3 s) on top of the hops, as monsters never stand still | |
| 180 - route choice weighs all routes of the map. on map2 this also picks the | |
| 181 entrance | |
| 182 - "furthest along" means the least distance left to the exit. a monster is in | |
| 183 range when its centre is. projectiles hit on reaching the target's hit | |
| 184 radius. a new tower attacks at once | |
| 185 - turning towers face their target at once and keep the last direction when | |
| 186 idle | |
| 187 - t0's attack stretches each spike from under the tower until its tip | |
| 188 reaches the range, and back, over 0.3 s | |
| 189 - t0 spike sides: each side covers a quarter of the directions around the | |
| 190 tower. the route centre lines are sampled every 4 pixels; a side gets a | |
| 191 spike when it holds at least 20 % of the samples within t0's level 5 | |
| 192 range. with no sample in that range, only the side towards the nearest | |
| 193 one gets a spike. the preview shows the same sides. on map0 about half the | |
| 194 placement cells give one side, most of the rest two, a few three | |
| 195 - t2 slow: each running slow keeps its own time, and the strongest one | |
| 196 applies. a slowed monster also hops slower, by the same factor | |
| 197 - t2 freeze splash: p2 bursts where it lands, also when its target died on | |
| 198 the way. it slows every monster whose hit area the splash touches. the | |
| 199 splash is drawn under the monsters, as freeze.png across its diameter at | |
| 200 85 % opacity, and grows and fades like a death puff over 0.4 s | |
| 201 (freeze_splash in [animation]) | |
| 202 - tower menu: tapping a built tower shows the tower_popup bubble, 168 css | |
| 203 pixels wide, above it, or below it when there is no room above, kept | |
| 204 inside the map. upgrade and sell sit in it side by side, each with its | |
| 205 price below, and each takes half of the bubble as tap area. the upgrade | |
| 206 price is the cost of the next level, dimmed when it cannot be afforded; at | |
| 207 level 5 upgrade is left out and sell takes the whole bubble. the sell | |
| 208 price is the refund. selling clears the selection; upgrading keeps it. | |
| 209 a tap anywhere outside the bubble closes it | |
| 210 - selling takes two taps. the first arms it: sell_button pulses by 15 % | |
| 211 every 0.5 s with a red glow. the second sells. a tap anywhere else, | |
| 212 another button or the map, cancels it; there is no timeout | |
| 213 - pausing clears the shop choice, the preview and the tower selection. | |
| 214 while paused, presses on the map do nothing and the shop is dimmed. the | |
| 215 top bar buttons, early start included, still work | |
| 216 - placement: a press on the map puts the preview at the nearest legal | |
| 217 position, and the preview follows the pointer until it is let go. only | |
| 218 the first pointer is followed. a press within the footprint radius or 28 | |
| 219 css pixels of the preview grabs it: let go after moving at most 10 css | |
| 220 pixels, it builds; a longer move drags it, keeping its offset to the | |
| 221 pointer. the shop choice is cleared after building, and a second tap on | |
| 222 the chosen shop button cancels it. a tap on a built tower selects it and | |
| 223 shows its range. a press that finds no legal position shows a red cross | |
| 224 for 0.5 s where the pointer is let go. shop buttons the player cannot | |
| 225 afford are dimmed and do nothing | |
| 226 - the preview is drawn at 45 % to 80 % opacity and 100 % to 108 % size. it | |
| 227 grows while the chosen shop item shows shop_bubble_dark and shrinks while | |
| 228 it shows shop_bubble_dark2. the range circle does not pulse | |
| 229 - flying coins: one sprite per coin, at most 8, started 0.05 s apart, flying | |
| 230 in game time on an arc. they are dropped when the map ends. early start | |
| 231 bonus coins start at the exits, taking turns on a map with several, within | |
| 232 the exit's radius | |
| 233 - top bar: coin_icon, heart and monster_icon with their counters. each | |
| 234 counter keeps the width of a usual largest value (3, 2 and 5 | |
| 235 characters), so the next one does not move. when the counters at those | |
| 236 widths and the buttons, early start included, do not fit side by side | |
| 237 (below about 800 css pixels), the buttons get a second row under the | |
| 238 counters, right-aligned as before. the buttons run help, pause, speed, | |
| 239 sound and early start from the right. pause shows pause_button | |
| 240 while the game runs and play_button while it is paused. speed shows the | |
| 241 drawing of the current speed. the early | |
| 242 start button shows the countdown on next_wave, without the bonus. the top | |
| 243 bar needs about 670 css pixels of width; narrower screens are not handled | |
| 244 - numbers: the digit variant of each place depends on the digit and its | |
| 245 place counted from the right, so the variants differ along a number but a | |
| 246 number keeps its look. top bar digits are 28 css pixels high, prices 18, | |
| 247 with coin_icon in front, as behind the amount it reads as an extra zero | |
| 248 - shop: items are 84 x 72 css pixels, drawn on shop_bubble. the chosen | |
| 249 item switches between shop_bubble_dark and shop_bubble_dark2 every 0.4 s | |
| 250 - death puffs: at the monster's centre, at sprite scale. they grow from 60 % | |
| 251 to full size over the first half of their time and fade out over the | |
| 252 second half. they are dropped when the map ends | |
| 253 - debug switches: all from architecture.md. start_coins -1 means the map's own value, seed 0 a new seed per | |
| 254 run. the debug tower ranges are drawn under the towers | |
| 255 - sound: the sound button over the splash screen's play button starts the | |
| 256 sound, or the play button when sound is switched off (sound.md); taps | |
| 257 before it leave sound off. later pointer and touch events resume audio | |
| 258 if the browser has suspended it. switching sound off mutes the output at | |
| 259 once and stops new sounds; the button tap is played after switching, so | |
| 260 it is heard when sound goes on. beeps use a square wave. variants are picked with Math.random, not the seeded | |
| 261 generator, so sound does not change a repeated run. a sound that cannot be | |
| 262 played at once (audio still locked) is dropped, not queued | |
| 263 - towers at scale 0.25 are small: t1 level 1 is about 43 x 30 map pixels. | |
| 264 worth a look with the hop and squash check of step 3 |
