wobblyhead hg > minor_monsters
comparison doc/balance.md @ 22:ad1b478fc4dc
balancing work, docs and scripts
| author | ark |
|---|---|
| date | 2026-10-20 03:08 +0200 |
| parents | c1c7e4f54bf6 |
| children | 2f555a54c332 |
comparison
equal
deleted
inserted
replaced
| 21:fa04481563b7 | 22:ad1b478fc4dc |
|---|---|
| 53 | m0 | 5 | 1 | 35 | hp, coins: notes; speed: guess | | 53 | m0 | 5 | 1 | 35 | hp, coins: notes; speed: guess | |
| 54 | m1 | 10 | 2 | 40 | as above | | 54 | m1 | 10 | 2 | 40 | as above | |
| 55 | m2 | 15 | 3 | 45 | as above | | 55 | m2 | 15 | 3 | 45 | as above | |
| 56 | m3 | 20 | 4 | 40 | as above | | 56 | m3 | 20 | 4 | 40 | as above | |
| 57 | m4 | 30 | 6 | 35 | as above | | 57 | m4 | 30 | 6 | 35 | as above | |
| 58 | b0 | 30 | 30 | 25 | as above | | 58 | b0 | 150 | 30 | 25 | hp: decided, 5 x the notes; coins: notes; speed: guess | |
| 59 | b1 | 50 | 50 | 25 | as above | | 59 | b1 | 250 | 50 | 25 | as above | |
| 60 | b2 | 70 | 70 | 25 | as above | | 60 | b2 | 350 | 70 | 25 | as above | |
| 61 | b3 | 100 | 100 | 25 | as above | | 61 | b3 | 500 | 100 | 25 | as above | |
| 62 | 62 |
| 63 regular monsters drop 0.2 coins per hp; bosses drop 1 coin per hp (derived). | 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). | |
| 64 | 65 |
| 65 time to walk the whole path at 35-45 speed (derived): map0 about 50 s, map3 | 66 time to walk the whole path at 35-45 speed (derived): map0 about 50 s, map3 |
| 66 about 23 s. | 67 about 23 s. |
| 67 | 68 |
| 68 animation (all guesses): | 69 animation (all guesses): |
| 199 | tower footprint radius | 16 | guess | | 200 | tower footprint radius | 16 | guess | |
| 200 | road half width, centre line to road edge | per map: 19, 17, 16, 22 | measured from the earlier masks | | 201 | road half width, centre line to road edge | per map: 19, 17, 16, 22 | measured from the earlier masks | |
| 201 | largest gap between footprint and road edge | 14 | guess | | 202 | largest gap between footprint and road edge | 14 | guess | |
| 202 | space between footprint and spawn point | per map: 50 | decided | | 203 | space between footprint and spawn point | per map: 50 | decided | |
| 203 | space between footprint and exit point | per map: 40 | decided | | 204 | space between footprint and exit point | per map: 40 | decided | |
| 204 | smallest distance between tower centres | 32 | derived (two footprints) | | 205 | smallest distance between tower centres | 40 | decided (was 32, two footprints; towers stood too close together) | |
| 205 | distance from the map edge | 16 | guess | | 206 | distance from the map edge | 16 | guess | |
| 206 | snap radius, how far a tap may be from a legal position | 48 | guess | | 207 | snap radius, how far a tap may be from a legal position | 48 | guess | |
| 207 | placement grid cell | 4 | guess | | 208 | placement grid cell | 4 | guess | |
| 208 | 209 |
| 209 towers may not be placed on the entrance or exit areas. | 210 towers may not be placed on the entrance or exit areas. |
| 305 -------- | 306 -------- |
| 306 | 307 |
| 307 | parameter | value | source | | 308 | parameter | value | source | |
| 308 |------------|--------|--------| | 309 |------------|--------|--------| |
| 309 | game speeds | 1x, 2x, 4x | decided | | 310 | game speeds | 1x, 2x, 4x | decided | |
| 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 |
