wobblyhead hg > minor_monsters
annotate doc/balance.md @ 22:ad1b478fc4dc
balancing work, docs and scripts
| author | ark |
|---|---|
| date | 2026-10-20 03:08 +0200 |
| parents | c1c7e4f54bf6 |
| children | 2f555a54c332 |
| rev | line source |
|---|---|
| 0 | 1 balance |
| 2 ------- | |
| 3 | |
| 4 all game numbers in one place. the values used by the game are in the config | |
| 5 file (see architecture.md); this document explains them and records where each | |
| 6 one comes from. | |
| 7 | |
| 8 source markers: | |
| 9 | |
| 10 - notes: from the original design notes or the original drawing sheet, | |
| 11 decided | |
| 12 - decided: decided after the notes were written | |
| 13 - guess: a starting value for playtesting, expected to change | |
| 14 - derived: calculated from other values | |
| 15 | |
| 15 | 16 notes and decided values are not fixed either. they come from the original |
| 17 drawing sheet and the first design rounds, made without experience in game | |
| 18 design, and are all open to change in balancing. | |
| 19 | |
| 0 | 20 units: distances are in map pixels, that is pixels of the map image as |
| 21 scanned. times are in seconds, speeds in map pixels per second. | |
| 22 | |
| 23 | |
| 24 scale | |
| 25 ----- | |
| 26 | |
| 27 | item | value | source | | |
| 28 |------------------------------|-------|--------| | |
| 29 | map images | 1.0 | notes | | |
| 30 | towers, monsters, projectiles | 0.25 | notes ("maps scaled approx 400%") | | |
| 31 | coins | 0.4 | guess, 0.25 makes them about 10 pixels | | |
| 32 | hp bars | 0.25 | guess | | |
| 33 | |
| 9 | 34 measured from the earlier masks, which covered the whole road (approximate, |
| 35 from red area divided by path width): | |
| 0 | 36 |
| 37 | map | size | path width | path length, all branches | | |
| 38 |------|---------|------------|---------------------------| | |
| 39 | map0 | 705x697 | 56 | 1930 | | |
| 40 | map1 | 663x590 | 48 | 1350 | | |
| 41 | map2 | 618x537 | 42 | 2075 | | |
| 42 | map3 | 642x459 | 52 | 905 | | |
| 43 | |
| 44 a single route on map1 or map2 is shorter than the total. exact route lengths | |
| 45 come from the build (see architecture.md). | |
| 46 | |
| 47 | |
| 48 monsters | |
| 49 -------- | |
| 50 | |
| 51 | monster | hp | coins | speed | source | | |
| 52 |---------|----|-------|-------|--------| | |
| 53 | m0 | 5 | 1 | 35 | hp, coins: notes; speed: guess | | |
| 54 | m1 | 10 | 2 | 40 | as above | | |
| 55 | m2 | 15 | 3 | 45 | as above | | |
| 56 | m3 | 20 | 4 | 40 | as above | | |
| 57 | m4 | 30 | 6 | 35 | as above | | |
| 22 | 58 | b0 | 150 | 30 | 25 | hp: decided, 5 x the notes; coins: notes; speed: guess | |
| 59 | b1 | 250 | 50 | 25 | as above | | |
| 60 | b2 | 350 | 70 | 25 | as above | | |
| 61 | b3 | 500 | 100 | 25 | as above | | |
| 0 | 62 |
| 22 | 63 monsters and bosses drop 0.2 coins per hp (derived). the notes gave bosses |
| 64 hp equal to their coins; balancing raised it to 5 times that (decided). | |
| 0 | 65 |
| 66 time to walk the whole path at 35-45 speed (derived): map0 about 50 s, map3 | |
| 67 about 23 s. | |
| 68 | |
| 69 animation (all guesses): | |
| 70 | |
| 71 - one hop takes 0.35 s | |
| 72 - hop height 5 | |
| 73 - squash on landing 6 % (wider and flatter), stretch in the air 4 % | |
| 74 - idle bob 2 % | |
| 75 - each monster starts at a random point in its hop cycle, so a group does not | |
| 76 hop in step | |
|
8
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
77 - the death puff shows for 0.4 s |
| 0 | 78 |
| 10 | 79 variation between monsters, so a group does not walk in single file (all |
| 80 guesses): | |
| 81 | |
| 82 - each monster's speed differs from its table speed by up to 5 % either way. | |
| 83 faster ones overtake slower ones | |
| 84 - a monster walks beside the centre line of the road, at most 0.45 of the | |
| 85 road half width away from it: 8.6, 7.7, 7.2 and 9.9 pixels by map | |
| 86 - half of that is a fixed lean to one side, chosen at spawn. the other half | |
| 87 wanders, with a new random value every 40 pixels along the route and a | |
| 88 smooth change between them | |
| 89 - the offset grows from 0 over the first 20 pixels of the route | |
| 90 - on the inside of tight bends the offset is reduced, so a monster never moves | |
| 91 backwards. monsters may bunch up there | |
| 92 | |
| 0 | 93 |
| 94 route preference | |
| 95 ---------------- | |
| 96 | |
| 97 on maps with several routes, a monster picks one at spawn. faster monsters | |
| 98 prefer longer or straighter routes, slower ones prefer shortcuts (decided). | |
| 99 | |
| 100 proposed rule (guess): | |
| 101 | |
| 102 - for each route the build calculates its length and how much it turns (sum of | |
| 103 direction changes along the route) | |
| 104 - each route gets a value between 0 and 1: the average of its length relative | |
| 105 to the longest route and its straightness relative to the straightest route | |
| 106 - each monster gets a speed factor: its speed minus the reference speed, | |
| 107 divided by the reference speed, limited to -1..1 | |
| 108 - route weight = 1 + bias * speed factor * (2 * route value - 1), at least 0.1 | |
| 109 - a monster at the reference speed sees all routes as equally likely | |
| 14 | 110 - a boss always takes the shortest route (decided). a route with a fixed |
| 111 weight of 0 is left out | |
| 0 | 112 |
| 113 | parameter | value | source | | |
| 114 |-----------------|-------|--------| | |
| 115 | reference speed | 40 | guess | | |
| 116 | bias | 3 | guess | | |
| 117 | |
| 118 with the speeds above, m2 is the only regular monster faster than the | |
| 119 reference, and the effect on it is small. the speeds may need to spread out | |
| 120 more for the preference to be visible. | |
| 121 | |
| 122 | |
| 123 towers | |
| 124 ------ | |
| 125 | |
| 15 | 126 towers have 5 levels (decided). the config sets damage, range, slow and cost |
| 127 for level 1 and level 5 only. the build fills in the levels between in equal | |
| 128 steps, rounded to whole numbers where both ends are whole. | |
| 129 | |
| 130 the drawing sheet gives five damage values for t0 and t1, and four for t2 and | |
| 131 t3. level 5 of t2 and t3 continues the trend (guess). the equal steps change | |
| 132 three values from the sheet: t1 level 2 from 7 to 8, t1 level 4 from 17 to 18, | |
| 133 and t3 level 2 from 5 to 4 (decided). | |
| 0 | 134 |
| 135 | tower | damage by level | cost | range by level | attack every | projectile speed | source | | |
| 136 |-------|------------------|------|---------------------|--------------|------------------|--------| | |
| 6 | 137 | t0 | 5,10,15,20,25 | 5 | 60,63,66,69,72 | 1.5 s | none (melee) | damage, cost: notes; range level 1: decided (was 45); rest: guess | |
| 15 | 138 | t1 | 3,8,13,18,23 | 10 | 100,104,108,112,116 | 0.7 s | 300 | damage levels 1 and 5, cost: notes; range: guess | |
| 139 | t2 | 1,3,5,7,9 | 20 | 90,94,98,102,106 | 1.2 s | 220 | damage level 1, cost: notes; rest: guess | | |
| 140 | t3 | 1,4,7,10,13 | 25 | 220,230,240,250,260 | 1.3 s | 800 | damage level 1: notes; cost: decided (was 40), may go lower; rest: guess | | |
| 141 | |
| 142 the cost column is the build cost, level 1. | |
| 0 | 143 |
| 144 rules: | |
| 145 | |
| 146 - attack speed stays the same at every level (decided). t0 is slower than the | |
| 147 others (decided), t1 faster than t2, t2 faster than t3 (notes) | |
| 148 - range grows about 4 % per level (decided "slightly", amount guessed) | |
| 149 - t0 damages every monster in range at once, each attack | |
| 150 - t2 slow: hit monsters move at 0.60, 0.55, 0.50, 0.45, 0.40 of their speed | |
| 151 by level, for 2 s (guess). a new hit restarts the time. slows do not add up; | |
| 152 the strongest one applies | |
| 153 - p1, p2, p3 home in on their target. if the target dies first, the | |
| 154 projectile flies on to the last position and disappears (guess) | |
| 155 - towers aim at the monster furthest along its route (guess) | |
| 156 | |
| 15 | 157 costs: the price of building, or of the upgrade to a level. they started as |
| 158 level n costs base cost x n (decided); the config sets levels 1 and 5: | |
| 0 | 159 |
| 160 | tower | level 1 (build) | level 2 | level 3 | level 4 | level 5 | total | | |
| 161 |-------|-----------------|---------|---------|---------|---------|-------| | |
| 162 | t0 | 5 | 10 | 15 | 20 | 25 | 75 | | |
| 163 | t1 | 10 | 20 | 30 | 40 | 50 | 150 | | |
| 164 | t2 | 20 | 40 | 60 | 80 | 100 | 300 | | |
| 165 | t3 | 25 | 50 | 75 | 100 | 125 | 375 | | |
| 166 | |
| 6 | 167 selling refunds half of everything paid for the tower, build and upgrades, |
|
13
8df95050fc8b
no more build during pause; tower popup closes on any click outside it
ark
parents:
10
diff
changeset
|
168 rounded down (decided). a tower is sold whole. |
| 0 | 169 |
| 170 | tower | level 1 | level 2 | level 3 | level 4 | level 5 | | |
| 171 |-------|---------|---------|---------|---------|---------| | |
| 6 | 172 | t0 | 2 | 7 | 15 | 25 | 37 | |
| 173 | t1 | 5 | 15 | 30 | 50 | 75 | | |
| 174 | t2 | 10 | 30 | 60 | 100 | 150 | | |
| 175 | t3 | 12 | 37 | 75 | 125 | 187 | | |
| 0 | 176 |
| 177 damage per second against a single target, at the guessed attack times | |
| 178 (derived): | |
| 179 | |
| 180 | tower | level 1 | level 2 | level 3 | level 4 | level 5 | | |
| 181 |-------|---------|---------|---------|---------|---------| | |
| 182 | t0 | 3.3 | 6.7 | 10.0 | 13.3 | 16.7 | | |
| 15 | 183 | t1 | 4.3 | 11.4 | 18.6 | 25.7 | 32.9 | |
| 0 | 184 | t2 | 0.8 | 2.5 | 4.2 | 5.8 | 7.5 | |
| 15 | 185 | t3 | 0.8 | 3.1 | 5.4 | 7.7 | 10.0 | |
| 0 | 186 |
| 187 t3 is meant to be weaker than the other towers; its range lets it reach more | |
| 188 targets (decided). to keep the gap moderate, its cost went from 40 to 25 and | |
| 189 its attack time from 2.0 s to 1.3 s, just slower than t2 as the notes require | |
| 190 (decided, amount guessed). at level 1 it deals about a fifth of t1's damage per | |
| 191 second at two and a half times the cost. its range covers more path, roughly | |
| 192 three times as much on a winding map (estimate). | |
| 193 | |
| 194 | |
| 195 placement | |
| 196 --------- | |
| 197 | |
| 198 | parameter | value | source | | |
| 199 |--------------------------------------------|-------|--------| | |
| 200 | tower footprint radius | 16 | guess | | |
| 9 | 201 | road half width, centre line to road edge | per map: 19, 17, 16, 22 | measured from the earlier masks | |
| 202 | largest gap between footprint and road edge | 14 | guess | | |
| 203 | space between footprint and spawn point | per map: 50 | decided | | |
| 204 | space between footprint and exit point | per map: 40 | decided | | |
| 22 | 205 | smallest distance between tower centres | 40 | decided (was 32, two footprints; towers stood too close together) | |
| 0 | 206 | distance from the map edge | 16 | guess | |
| 207 | snap radius, how far a tap may be from a legal position | 48 | guess | | |
| 208 | placement grid cell | 4 | guess | | |
| 209 | |
| 210 towers may not be placed on the entrance or exit areas. | |
| 211 | |
| 9 | 212 the spawn point is where the path leaves the blue entrance area. the space |
| 213 between it and a tower footprint is one to one and a half times the average | |
| 214 tower size (decided). level 1 towers average about 36 pixels across at sprite | |
| 215 scale 0.25, so the space is 36 to 53 pixels. | |
| 216 | |
| 217 the exit point is where the path enters the green exit area. towers keep a | |
| 218 somewhat smaller space from it (decided), so they do not cover the building | |
| 219 drawn at the exit. | |
| 220 | |
| 0 | 221 |
| 222 economy | |
| 223 ------- | |
| 224 | |
| 225 | map | starting coins | coins dropped in total | boss coins | regular monster coins | regular monster hp | | |
| 226 |------|----------------|------------------------|------------|-----------------------|--------------------| | |
| 227 | map0 | 10 | 100 | 30 | 70 | 350 | | |
| 228 | map1 | 20 | 200 | 50 | 150 | 750 | | |
| 229 | map2 | 40 | 400 | 70 | 330 | 1650 | | |
| 230 | map3 | 60 | 600 | 100 | 500 | 2500 | | |
| 231 | |
| 232 starting coins and the 10 x starting coins total are from the notes; the rest | |
| 233 is derived. early wave bonuses come on top of this total. | |
| 234 | |
| 235 the source sheet gives 50 starting coins for map3. the notes raise it to 60 to | |
| 236 make the step from map1 to map3 more even (10, 20, 40, 60 instead of 10, 20, | |
| 237 40, 50). likely to change after playtesting. | |
| 238 | |
| 239 share of the regular monster coins by monster level (guess). all monster | |
| 240 levels appear on all maps (decided): | |
| 241 | |
| 242 | map | m0 | m1 | m2 | m3 | m4 | | |
| 243 |------|------|------|------|------|------| | |
| 244 | map0 | 40 % | 25 % | 15 % | 10 % | 10 % | | |
| 245 | map1 | 30 % | 25 % | 20 % | 15 % | 10 % | | |
| 246 | map2 | 20 % | 20 % | 20 % | 20 % | 20 % | | |
| 247 | map3 | 15 % | 15 % | 20 % | 25 % | 25 % | | |
| 248 | |
| 249 resulting monster counts (derived, rounded): | |
| 250 | |
| 251 | map | m0 | m1 | m2 | m3 | m4 | monsters | coins | | |
| 252 |------|----|----|----|----|----|----------|-------| | |
| 253 | map0 | 28 | 9 | 4 | 2 | 1 | 44 | 72 | | |
| 254 | map1 | 45 | 19 | 10 | 6 | 2 | 82 | 149 | | |
| 255 | map2 | 66 | 33 | 22 | 16 | 11 | 148 | 328 | | |
| 256 | map3 | 75 | 38 | 33 | 31 | 21 | 198 | 500 | | |
| 257 | |
| 258 the build prints these totals from the actual wave lists and warns when a map | |
| 259 is more than 5 % off its coin total. | |
| 260 | |
| 261 | |
| 262 waves | |
| 263 ----- | |
| 264 | |
| 265 | parameter | value | source | | |
| 266 |------------------------------------|---------------------|--------| | |
| 267 | waves per map | 6, 8, 10, 12 | guess | | |
| 268 | break before the first wave | 40 s | guess | | |
| 269 | break between waves | 25 s | guess ("longer", decided) | | |
| 14 | 270 | time between spawns | 1.0, 1.0, 0.8, 0.7 s by map | guess | |
| 0 | 271 | early start bonus, coins per second left | 0.05, 0.1, 0.2, 0.3 by map | guess (starting coins / 200) | |
| 272 | |
| 273 the bonus is rounded down. if every break is skipped at once, the bonus adds | |
| 274 about 6, 17, 45 and 82 coins per map (derived). | |
| 275 | |
| 276 suggested shape of a map's waves (guess): the coin value of wave n grows in | |
| 14 | 277 proportion to n, so the last wave is the largest. the boss comes in the last |
| 278 wave and spawns first. later waves mix monster levels; early waves are mostly | |
| 279 m0 and m1. | |
| 0 | 280 |
| 281 | |
| 282 hearts | |
| 283 ------ | |
| 284 | |
| 285 | parameter | value | source | | |
| 286 |-------------------------|-------|--------| | |
| 287 | hearts per map | 10 | decided | | |
| 288 | heart cost of a monster | 1 | decided | | |
| 289 | heart cost of a boss | 5 | decided | | |
| 290 | |
| 291 | |
| 292 coins in flight | |
| 293 --------------- | |
| 294 | |
| 295 | parameter | value | source | | |
| 296 |----------------------------------|-------|--------| | |
| 297 | flight time to the counter | 0.7 s | guess | | |
| 298 | most coin sprites for one death | 8 | guess | | |
| 299 | |
| 300 coins are added to the counter at the moment the monster dies; the flying | |
| 301 coins only show it (guess). this keeps the counter correct for a player who | |
| 302 builds right after a kill. | |
| 303 | |
| 304 | |
| 305 controls | |
| 306 -------- | |
| 307 | |
| 308 | parameter | value | source | | |
| 309 |------------|--------|--------| | |
|
8
2c4fed8baed9
art update, persistent sound setting, tower selling as double action
ark
parents:
6
diff
changeset
|
310 | game speeds | 1x, 2x, 4x | decided | |
| 22 | 311 |
| 312 | |
| 313 balancing | |
| 314 --------- | |
| 315 | |
| 316 the values above were set without a way to estimate their effect, and the | |
| 317 game is far too easy. two t1 towers win every map, t2 is never needed, and | |
| 318 many coins are left over when a map is won. the aim is a game where the | |
| 319 player has to think about where to place towers and which ones to build. a | |
| 320 player who only buys plain firepower should need nearly every coin a map | |
| 321 pays in order to win it. coins left over then come from better choices. | |
| 322 | |
| 323 two scripted players mark the range (decided): | |
| 324 | |
| 325 - naive: builds t1 only, on placement cells of median coverage, whenever it | |
| 326 can afford one. it should win with about 5 of its 10 hearts left and with | |
| 327 next to no coins at the start of the last wave | |
| 328 - greedy: builds on the best cells, and upgrades when no good cell is left. | |
| 329 it should win with coins to spare | |
| 330 | |
| 331 rules for changing values: | |
| 332 | |
| 333 - shop prices and starting coins stay multiples of 5. round upgrade prices | |
| 334 are preferred | |
| 335 - values the player does not see are free: hp, damage, coin drops, speeds, | |
| 336 attack times | |
| 337 - shop prices are set first. hp, damage and the wave mix are then fitted to | |
| 338 them | |
| 339 - the main control is coins per hp. regular monsters drop 0.2 coins per hp, | |
| 340 so a map's difficulty and its income grow together. a map gets harder when | |
| 341 its hp go up while its coins stay the same | |
| 342 | |
| 343 the coins of the last wave, the boss's included, arrive when the map is as | |
| 344 good as won. leftover coins are therefore measured at the start of the last | |
| 345 wave. the last wave's coins are left out of the calculation. the boss keeps | |
| 346 its drop as a visible reward (decided). | |
| 347 | |
| 348 the calculation goes wave by wave, not per map. at the start of each wave | |
| 349 the player has the starting coins, the coins dropped in earlier waves and | |
| 350 any early start bonus. these coins buy a certain amount of firepower. the | |
| 351 wave sets two demands on it: | |
| 352 | |
| 353 - throughput: the towers' damage per second has to keep up with the hp | |
| 354 arriving per second. the time a monster spends in range gives some buffer | |
| 355 - single target: the toughest monster of the wave, m4 or the boss, has to | |
| 356 die within its time in range | |
| 357 | |
| 358 damage is counted in whole shots. t1 at level 1 needs 2 shots for the 5 hp | |
| 359 of an m0, not five thirds of one. | |
| 360 | |
| 361 simplifications in tools/balance.py: | |
| 362 | |
| 363 - a tower attacks from the first monster of a wave reaching it until the | |
| 364 last has passed. it is idle when no monster is in range. with route | |
| 365 length c in range and spacing s between monsters, the share of time with | |
| 366 a monster in range is taken as 1 - e^(-c/s) | |
| 367 - for the single target demand the monster gets every tower's full | |
| 368 attention while in range. in the game, faster monsters overtake the | |
| 369 boss and draw fire away from it | |
| 370 - the naive player builds at the start of a wave with the coins on hand | |
| 371 and never starts a wave early. the greedy player always starts early and | |
| 372 takes the bonus. coins dropped during a wave count from the next wave | |
| 373 - monsters that leak cost one heart each and drop no coins, so a leaky | |
| 374 wave leaves less for the next one | |
| 375 - routes are equally likely; the route preference is left out. the boss | |
| 376 takes the shortest route | |
| 377 - towers keep their level 1 range when upgraded | |
| 378 | |
| 379 the time a monster spends in range comes from coverage: the length of route | |
| 380 within a tower's range, measured for every legal placement cell from the | |
| 381 build's route and placement data. the median cell stands for the naive | |
| 382 player and the best cells for the greedy one. for more than one tower, | |
| 383 cells are picked one after the other, each counting only route that no | |
| 384 earlier tower covers. maps with several routes are measured per route. | |
| 385 | |
| 386 t1 coverage at range 100 and footprint radius 16, in map pixels of route | |
| 387 within range, the mean over routes on maps with several. top 10 % is the | |
| 388 coverage the best tenth of the cells reach: | |
| 389 | |
| 390 | map | routes | legal cells | best | top 10 % | median | | |
| 391 |------|--------|-------------|------|----------|--------| | |
| 392 | map0 | 1 | 2893 | 415 | 360 | 228 | | |
| 393 | map1 | 3 | 2132 | 325 | 232 | 129 | | |
| 394 | map2 | 6 | 1857 | 276 | 195 | 111 | | |
| 395 | map3 | 1 | 1369 | 422 | 311 | 174 | | |
| 396 | |
| 397 route lengths: map0 2068, map1 737 to 1048, map2 722 to 1363, map3 1035. | |
| 398 | |
| 399 value per coin is damage per second divided by all coins paid for the | |
| 400 tower. for t1 it falls with level: 0.43, 0.38, 0.31, 0.26 and 0.22. this | |
| 401 is the intended trade between upgrading and building another tower. t0 at | |
| 402 level 1 reaches 0.67 against a single target, kills an m0 in one hit and | |
| 403 damages every monster in range. it may be the better buy for a naive | |
| 404 player than t1, so the calculation lists value per coin for every tower and | |
| 405 level, area damage included. | |
| 406 | |
| 407 t2 works as a time multiplier. a slow to 0.6 of the speed gives 1.67 times | |
| 408 the time in range for every tower covering the same stretch. this only | |
| 409 helps against the single target demand, so t2 needs faster monsters or | |
| 410 tough monsters spaced apart to pay off. it is tuned after the t1 baseline. | |
| 411 | |
| 412 order of work (decided): | |
| 413 | |
| 414 1. the calculation, tools/balance.py (architecture.md): value per coin for | |
| 415 every tower, the wave demands against t1 only | |
| 416 2. shop prices fixed, then hp, damage and waves fitted to them | |
| 417 3. t2 after the t1 baseline | |
| 418 4. a headless simulation of the real game code with the two scripted | |
| 419 players confirms the result |
