wobblyhead hg > minor_monsters
annotate doc/roadmap.md @ 8:2c4fed8baed9
art update, persistent sound setting, tower selling as double action
| author | ark |
|---|---|
| date | 2026-10-19 13:37 +0200 |
| parents | 910b26feca76 |
| children | 53f015966118 |
| rev | line source |
|---|---|
| 0 | 1 roadmap |
| 2 ------- | |
| 3 | |
| 4 steps in order. each ends with something that runs and can be looked at. | |
| 5 | |
| 6 1. build basics | |
| 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, routes.toml | |
| 13 corrections | |
| 14 - previews in temp/preview/ | |
| 15 - check: routes on all four maps follow the paths, placement grid looks | |
| 16 sensible | |
| 17 3. map and walking monsters | |
| 18 - index.html, main loop, scaling to the window, map drawing | |
| 19 - monsters walk their routes with hop animation and route preference | |
| 20 - check: hop and squash feel; speeds against path lengths | |
| 21 4. waves and hearts | |
| 22 - wave timing, countdown, early start and bonus, hearts, win and loss | |
| 23 5. towers | |
| 24 - shop, placement with snapping and preview, targeting, projectiles, | |
| 25 damage, hp bars, coin drops and flying coins | |
| 26 - first playable version of map0 | |
| 27 6. tower details | |
| 6 | 28 - upgrades, selling the whole tower with the pause refund rule, t0 melee |
| 29 and spike sides, t2 slow with the blue hp bar, boss with its bar | |
| 0 | 30 7. game flow |
| 6 | 31 - splash screen with title, byline and play button over the paused first |
| 32 map; the play button starts the sound | |
| 33 - map won with next, game won after the last map with restart to the | |
| 34 splash screen, map lost back to the first map | |
| 35 - no map selection, unlocking or localStorage | |
| 0 | 36 8. tuning on all maps |
| 37 - wave lists for maps 1-3, playtesting, balance changes in config only | |
| 38 9. supplied art and sound | |
| 39 - icons, screens and digits as the drawings arrive (art.md) | |
| 40 - voice recordings as they arrive (sound.md) | |
| 41 10. publishing | |
| 42 - publish script, www/, dist/ zip, hosting for tablet play | |
| 43 | |
| 44 debug switches (architecture.md) are added as each step needs them, starting | |
| 45 with step 3. | |
| 1 | 46 |
| 47 | |
| 48 prototype notes | |
| 49 --------------- | |
| 50 | |
| 6 | 51 decisions taken while building steps 1-7 that the other documents do not |
| 1 | 52 cover. values marked proto in config/game.toml refer to this list. |
| 53 | |
| 54 build: | |
| 55 | |
| 56 - runs on python 3.11 or later with pillow; numpy is not used. a full build | |
| 57 takes about 5 s, most of it in the mask step | |
| 58 - a step is skipped when its outputs are newer than its inputs and the build | |
| 59 scripts. the mask step also reruns when the placement settings in | |
| 60 game.toml change; it keeps its result in temp/build/maps.json for the | |
| 61 checks and previews | |
| 62 - map images are written as jpeg, quality 88. the maps have no transparency | |
| 2 | 63 - tower strips are split at columns without ink. ink is anything darker |
| 1 | 64 than luminance 225. outline gaps of up to about 4 pixels are closed before |
| 65 the fill. the white paper edge outside the outline fades to transparent | |
|
8
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
66 - tools/cut_sheet.py cuts the sprites out of art_sources/source_sheet_2.jpg |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
67 into art/. it |
| 2 | 68 is run by hand, not by the build. one hand-set box per drawing; in each box |
| 69 the largest connected outline is the drawing and other ink is dropped. | |
| 70 outline ink is darker than luminance 150. sprites stay at the sheet's | |
| 71 scale, which is the scale the first cutouts had, so [scale] is unchanged. | |
| 72 coins and maps are not on the inked sheet and stay as they were | |
|
8
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
73 - game_won.png and game_won_button.png were cut once from |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
74 art_sources/game_won.jpg with the cut function of cut_sheet.py; the scan |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
75 has no boxes in the script |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
76 - tools/cut_digits.py takes every connected stroke on digits.png as one |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
77 character. ink is darker than luminance 150, strokes under 30 pixels are |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
78 specks. rows are told apart by the stroke centre, and the characters of |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
79 each row are listed in the script. the scaled height is 66.5 pixels, the |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
80 median of the drawings |
| 1 | 81 - the empty part of the hp bars is a darkened copy made by the build |
| 6 | 82 (hpm_empty, hpb_empty). the blue bars for slowed monsters have the hue of |
| 83 every pixel set to 220 degrees, which leaves the black outline as it is | |
| 84 (hpm_slow, hpb_slow, each with its _empty copy) | |
| 1 | 85 - sprite sizes go into config.js, so the game knows them before the images |
| 86 load | |
| 87 - mask pixels count when at least half opaque, and take the class of their | |
| 88 strongest colour. entrance or exit areas under 50 pixels are ignored | |
| 89 - the placement test draws discs around the path edge instead of keeping a | |
| 90 distance for every pixel. the result is the same. edge_distance applies to | |
| 91 the tower centre | |
| 92 - the centre line runs through the entrance and exit areas, so routes start | |
| 93 and end inside them. dead ends shorter than 0.8 path widths are dropped. | |
| 94 junctions closer together than 0.75 path widths count as one | |
| 95 - map2 has three loops (the round one at the top left, two squares at the | |
| 96 bottom). each leaves the path at a junction and comes back to the same | |
| 97 junction, so the rule "no junction twice" would never walk them. a route | |
| 98 may walk such a loop once. of its two directions, the one that turns less | |
| 99 is kept. map2 gives 8 routes, all kept; map1 gives 3 | |
| 100 - route smoothing: moving average over 17 points, applied twice, then | |
| 101 simplified to 0.8 pixel tolerance | |
| 102 - straightness for the route value is the least turning of the map's routes | |
| 103 divided by the route's turning. turning is the total, not per length | |
| 104 - routes.toml names routes by their number in the build output. the numbers | |
| 105 change when a mask changes | |
| 106 - measured path widths are lower than in balance.md (map1 38, map2 38, map3 | |
| 107 46) because the centre line length includes the entrance and exit areas. | |
| 108 map0's route is 2020 long | |
| 109 - the coin check compares all coins dropped, boss included, with 10 x | |
| 110 starting coins | |
| 111 - the build prints the early start bonus for skipping every break, including | |
| 112 the one before the first wave: 8, 21, 53, 94. balance.md gives 6, 17, 45, | |
| 113 82, which leaves that break out. the game pays the bonus before the first | |
| 114 wave too. to decide | |
| 115 | |
| 116 config: | |
| 117 | |
| 118 - per map: [map.N] holds starting_coins, early_bonus, wave_count and | |
| 119 monster_share, followed by the [[map.N.wave]] lists | |
| 120 - added: hit_radius in [animation] (0.4 of the monster sprite's smaller | |
| 121 side), min_weight in [route_preference] (the "at least 0.1" of the rule), | |
| 122 [art.angle] and [art.pivot]. t1 turns around the middle of its box, not | |
| 2 | 123 the middle of the image; the pivots for levels 1-5 are the centre of the |
| 124 box measured on the cutouts. temp/preview/towers.png marks them | |
| 1 | 125 - draft waves: monster counts per level from the coin shares. each level is |
| 126 spread over the waves by the coin budget still open, with wave n worth n | |
| 127 shares. higher levels start later: m1 after 15 % of the waves, m2 35 %, m3 | |
| 128 50 %, m4 65 %. groups hold at most 5 monsters and alternate between | |
| 129 levels. spawn interval 1.0 s on maps 0 and 1, 0.8 s on map2, 0.7 s on | |
| 130 map3. 2 s between groups, 4 s before the boss. totals: 102, 199, 398, 600 | |
| 131 coins | |
| 132 | |
| 133 game: | |
| 134 | |
|
8
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
135 - scripts share the namespace object MM. storage.js keeps the settings in |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
136 the localStorage entry minor_monsters, as version 1 |
| 1 | 137 - the simulation runs on wall clock time: at 60 frames per second, 2x gives |
| 138 two steps per frame. at most 4 steps per frame and speed step; a longer | |
| 139 frame drops the rest | |
| 6 | 140 - game flow: the first map is debug.start_map, and only the first map |
| 141 starts at debug.start_wave; the next maps start at wave 1. | |
| 142 debug.start_coins applies to every map. the splash screen pauses the | |
| 143 first map without counting the pause for the sell refund, and only its | |
| 144 play button responds. the next map starts with its break running, as | |
|
8
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
145 does the first map after a lost map. the splash screen has a pale veil |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
146 over the map, the other screens a dark one |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
147 - screens: the scale is the same for all four drawings, set so the widest |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
148 and the tallest fit 92 % of the window width and 90 % of its height, at |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
149 most 1. the separate button image is drawn over the button in the |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
150 drawing; [art.screen] in game.toml holds where, measured by matching the |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
151 images. its tap area is the button image. it pulses by 4 % over 1.2 s; |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
152 under the mouse it is 8 % larger with a shadow |
| 1 | 153 - a break starts when all monsters of the wave are gone, killed or escaped, |
| 154 not when the last one has spawned. during a break the wave counter shows | |
| 155 the next wave | |
| 156 - monsters move at constant speed; the hop is drawn only. a hop spends 80 % | |
| 157 of its time in the air and 20 % landing. the idle bob is a slow breathing | |
| 158 (1.3 s) on top of the hops, as monsters never stand still | |
| 159 - route choice weighs all routes of the map. on map2 this also picks the | |
| 160 entrance | |
| 161 - "furthest along" means the least distance left to the exit. a monster is in | |
| 162 range when its centre is. projectiles hit on reaching the target's hit | |
| 163 radius. a new tower attacks at once | |
| 164 - turning towers face their target at once and keep the last direction when | |
| 165 idle | |
| 6 | 166 - t0's attack stretches each spike from under the tower until its tip |
| 167 reaches the range, and back, over 0.3 s | |
| 168 - t0 spike sides: each side covers a quarter of the directions around the | |
| 169 tower. the route centre lines are sampled every 4 pixels; a side gets a | |
| 170 spike when it holds at least 20 % of the samples within t0's level 5 | |
| 171 range. with no sample in that range, only the side towards the nearest | |
| 172 one gets a spike. the preview shows the same sides. on map0 about half the | |
| 173 placement cells give one side, most of the rest two, a few three | |
| 174 - t2 slow: each running slow keeps its own time, and the strongest one | |
| 175 applies. a slowed monster also hops slower, by the same factor | |
|
8
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
176 - tower menu: tapping a built tower shows the tower_popup bubble, 168 css |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
177 pixels wide, above it, or below it when there is no room above, kept |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
178 inside the map. upgrade and sell sit in it side by side, each with its |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
179 price below, and each takes half of the bubble as tap area. the upgrade |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
180 price is the cost of the next level, dimmed when it cannot be afforded; at |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
181 level 5 upgrade is left out and sell takes the whole bubble. the sell |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
182 price is the refund. selling clears the selection; upgrading keeps it |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
183 - selling takes two taps. the first arms it: sell_button pulses by 15 % |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
184 every 0.5 s with a red glow. the second sells. a tap anywhere else, |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
185 another button or the map, cancels it; there is no timeout |
| 6 | 186 - the pause refund counts pauses: each purchase records the pause it was |
| 187 made in. a purchase made during the current pause is refunded in full | |
| 1 | 188 - placement: a tap within the footprint radius or 28 css pixels of the |
| 189 preview builds. the shop choice is cleared after building, and a second tap | |
| 190 on the chosen shop button cancels it. a tap on a built tower selects it and | |
| 191 shows its range. a refused tap shows a red cross for 0.5 s. shop buttons | |
| 192 the player cannot afford are dimmed and do nothing | |
| 193 - flying coins: one sprite per coin, at most 8, started 0.05 s apart, flying | |
| 194 in game time on an arc. they are dropped when the map ends | |
|
8
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
195 - top bar: coin_icon, heart and monster_icon with their counters. each |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
196 counter keeps the width of a usual largest value (3, 2 and 5 |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
197 characters), so the next one does not move. pause shows pause_button |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
198 while the game runs and play_button while it is paused. speed shows the |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
199 drawing of the current speed; debug speeds show their number. the early |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
200 start button shows the countdown on next_wave, without the bonus. the top |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
201 bar needs about 670 css pixels of width; narrower screens are not handled |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
202 - numbers: the digit variant of each place depends on the digit and its |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
203 place counted from the right, so the variants differ along a number but a |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
204 number keeps its look. top bar digits are 28 css pixels high, prices 18, |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
205 with coin_icon in front, as behind the amount it reads as an extra zero |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
206 - shop: items are 84 x 72 css pixels, drawn on shop_bubble. the chosen |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
207 item switches between shop_bubble_dark and shop_bubble_dark2 every 0.4 s |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
208 - death puffs: at the monster's centre, at sprite scale. they grow from 60 % |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
209 to full size over the first half of their time and fade out over the |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
210 second half. they are dropped when the map ends |
| 6 | 211 - debug switches: all from architecture.md. start_coins -1 means the map's own value, seed 0 a new seed per |
| 1 | 212 run |
| 6 | 213 - sound: the play button on the splash screen starts the sound; taps |
| 214 before it leave sound off. later pointer and touch events resume audio | |
|
8
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
215 if the browser has suspended it. switching sound off mutes the output at |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
216 once and stops new sounds; the button tap is played after switching, so |
|
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
217 it is heard when sound goes on. beeps use a square wave. variants are picked with Math.random, not the seeded |
| 4 | 218 generator, so sound does not change a repeated run. a sound that cannot be |
| 219 played at once (audio still locked) is dropped, not queued | |
| 1 | 220 - towers at scale 0.25 are small: t1 level 1 is about 43 x 30 map pixels. |
| 221 worth a look with the hop and squash check of step 3 |
