comparison doc/balance.md @ 23:2f555a54c332

layout fixes and balancing
author ark
date 2026-10-20 12:04 +0200
parents ad1b478fc4dc
children 3f2811aebb3d
comparison
equal deleted inserted replaced
22:ad1b478fc4dc 23:2f555a54c332
46 46
47 47
48 monsters 48 monsters
49 -------- 49 --------
50 50
51 | monster | hp | coins | speed | source | 51 | monster | hp | coins | coins per hp | speed | source |
52 |---------|----|-------|-------|--------| 52 |---------|----|-------|--------------|-------|--------|
53 | m0 | 5 | 1 | 35 | hp, coins: notes; speed: guess | 53 | m0 | 5 | 1 | 0.20 | 35 | hp, coins: notes; speed: guess |
54 | m1 | 10 | 2 | 40 | as above | 54 | m1 | 10 | 1 | 0.10 | 40 | hp: notes; coins: decided (was 2); speed: guess |
55 | m2 | 15 | 3 | 45 | as above | 55 | m2 | 15 | 2 | 0.13 | 45 | hp: notes; coins: decided (was 3); speed: guess |
56 | m3 | 20 | 4 | 40 | as above | 56 | m3 | 20 | 2 | 0.10 | 40 | hp: notes; coins: decided (was 4); speed: guess |
57 | m4 | 30 | 6 | 35 | as above | 57 | m4 | 30 | 3 | 0.10 | 35 | hp: notes; coins: decided (was 6); speed: guess |
58 | b0 | 150 | 30 | 25 | hp: decided, 5 x the notes; coins: notes; speed: guess | 58 | b0 | 150 | 30 | 0.20 | 25 | hp: decided, 5 x the notes; coins: notes; speed: guess |
59 | b1 | 250 | 50 | 25 | as above | 59 | b1 | 250 | 50 | 0.20 | 25 | as above |
60 | b2 | 350 | 70 | 25 | as above | 60 | b2 | 350 | 70 | 0.20 | 25 | as above |
61 | b3 | 500 | 100 | 25 | as above | 61 | b3 | 500 | 100 | 0.20 | 25 | as above |
62 62
63 monsters and bosses drop 0.2 coins per hp (derived). the notes gave bosses 63 monster hp is the same on every map (decided). a monster that took two hits
64 hp equal to their coins; balancing raised it to 5 times that (decided). 64 on one map must not take four on a later one. a map gets harder through the
65 size of its waves and the mix of monsters.
66
67 the notes had every monster drop 0.2 coins per hp. regular monster coins are
68 now set apart from hp (decided): m0 keeps 0.2, the others drop 0.10 to 0.13.
69 the mix of monsters then sets the coins per hp of a map. the notes gave
70 bosses hp equal to their coins; balancing raised it to 5 times that
71 (decided).
65 72
66 time to walk the whole path at 35-45 speed (derived): map0 about 50 s, map3 73 time to walk the whole path at 35-45 speed (derived): map0 about 50 s, map3
67 about 23 s. 74 about 23 s.
68 75
69 animation (all guesses): 76 animation (all guesses):
105 to the longest route and its straightness relative to the straightest route 112 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, 113 - each monster gets a speed factor: its speed minus the reference speed,
107 divided by the reference speed, limited to -1..1 114 divided by the reference speed, limited to -1..1
108 - route weight = 1 + bias * speed factor * (2 * route value - 1), at least 0.1 115 - 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 116 - a monster at the reference speed sees all routes as equally likely
110 - a boss always takes the shortest route (decided). a route with a fixed 117 - a boss always takes the shortest route (decided)
111 weight of 0 is left out
112 118
113 | parameter | value | source | 119 | parameter | value | source |
114 |-----------------|-------|--------| 120 |-----------------|-------|--------|
115 | reference speed | 40 | guess | 121 | reference speed | 40 | guess |
116 | bias | 3 | guess | 122 | bias | 3 | guess |
220 226
221 227
222 economy 228 economy
223 ------- 229 -------
224 230
225 | map | starting coins | coins dropped in total | boss coins | regular monster coins | regular monster hp | 231 | map | starting coins |
226 |------|----------------|------------------------|------------|-----------------------|--------------------| 232 |------|----------------|
227 | map0 | 10 | 100 | 30 | 70 | 350 | 233 | map0 | 10 |
228 | map1 | 20 | 200 | 50 | 150 | 750 | 234 | map1 | 20 |
229 | map2 | 40 | 400 | 70 | 330 | 1650 | 235 | map2 | 40 |
230 | map3 | 60 | 600 | 100 | 500 | 2500 | 236 | map3 | 60 |
231 237
232 starting coins and the 10 x starting coins total are from the notes; the rest 238 starting coins are from the notes. the source sheet gives 50 for map3. the
233 is derived. early wave bonuses come on top of this total. 239 notes raise it to 60 to make the step from map1 to map3 more even (10, 20,
234 240 40, 60 instead of 10, 20, 40, 50). likely to change after playtesting.
235 the source sheet gives 50 starting coins for map3. the notes raise it to 60 to 241
236 make the step from map1 to map3 more even (10, 20, 40, 60 instead of 10, 20, 242 the notes set the coins dropped per map to 10 times the starting coins. this
237 40, 50). likely to change after playtesting. 243 is no longer a target (decided): the coins a map pays follow from its waves.
238 244 the build prints, per map, the coins dropped by regular monsters and the
239 share of the regular monster coins by monster level (guess). all monster 245 boss, the total with the starting coins, and the coins per hp of the regular
240 levels appear on all maps (decided): 246 monsters.
241 247
242 | map | m0 | m1 | m2 | m3 | m4 | 248 coins per map from the current wave lists (derived):
243 |------|------|------|------|------|------| 249
244 | map0 | 40 % | 25 % | 15 % | 10 % | 10 % | 250 | map | regular monsters | boss | dropped in all | with starting coins | regular hp | coins per hp |
245 | map1 | 30 % | 25 % | 20 % | 15 % | 10 % | 251 |------|------------------|------|----------------|---------------------|------------|--------------|
246 | map2 | 20 % | 20 % | 20 % | 20 % | 20 % | 252 | map0 | 48 | 30 | 78 | 88 | 395 | 0.12 |
247 | map3 | 15 % | 15 % | 20 % | 25 % | 25 % | 253 | map1 | 139 | 50 | 189 | 209 | 1145 | 0.12 |
248 254 | map2 | 326 | 70 | 396 | 436 | 2615 | 0.12 |
249 resulting monster counts (derived, rounded): 255 | map3 | 157 | 100 | 257 | 317 | 1160 | 0.14 |
250 256
251 | map | m0 | m1 | m2 | m3 | m4 | monsters | coins | 257 early start bonuses come on top.
252 |------|----|----|----|----|----|----------|-------| 258
253 | map0 | 28 | 9 | 4 | 2 | 1 | 44 | 72 | 259 all monster levels appear on all maps (decided).
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 260
261 261
262 waves 262 waves
263 ----- 263 -----
264 264
265 | parameter | value | source | 265 | parameter | value | source |
266 |------------------------------------|---------------------|--------| 266 |------------------------------------|---------------------|--------|
267 | waves per map | 6, 8, 10, 12 | guess | 267 | waves per map | 6, 8, 10, 12 | guess |
268 | break before the first wave | 40 s | guess | 268 | break before the first wave | 40 s | guess |
269 | break between waves | 25 s | guess ("longer", decided) | 269 | break between waves, from the last spawn of a wave | 25 s | guess ("longer", decided) |
270 | time between spawns | 1.0, 1.0, 0.8, 0.7 s by map | guess | 270 | time between spawns | 1.0, 0.65, 0.65, 0.5 s by map | guess, fitted in the simulation |
271 | early start bonus, coins per second left | 0.05, 0.1, 0.2, 0.3 by map | guess (starting coins / 200) | 271 | early start bonus, coins per second left | 0.05, 0.1, 0.2, 0.3 by map | guess (starting coins / 200) |
272 272
273 the bonus is rounded down. if every break is skipped at once, the bonus adds 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). 274 about 6, 17, 45 and 82 coins per map (derived).
275 275
276 suggested shape of a map's waves (guess): the coin value of wave n grows in 276 shape of a map's waves (decided): each wave is at least as hard as the one
277 proportion to n, so the last wave is the largest. the boss comes in the last 277 before, and the last wave is the largest. the boss comes in the last wave and
278 wave and spawns first. later waves mix monster levels; early waves are mostly 278 spawns first. early waves are mostly m0 and m1; later waves mix monster
279 m0 and m1. 279 levels.
280
281 the wave lists in the config are drafted by tools/balance.py
282 (architecture.md) from a few numbers per map, and may be edited by hand
283 afterwards:
284
285 - the number of waves
286 - the number of regular monsters in the first and in the last wave. the waves
287 between grow in equal steps
288 - the share of each monster level in the map's regular monsters, by count
289 - the wave in which each monster level first appears
290
291 each monster level gets a weight per wave that grows by one per wave from its
292 first wave. the weights are scaled until the wave sizes and the shares are
293 met, then rounded to whole monsters per wave. later waves therefore hold more
294 of the levels that came in late. every level keeps at least one monster.
295
296 the draft numbers are kept in the map's section of the config, next to the
297 other map settings. the game does not read them.
298
299 draft numbers, fitted in the simulation to the targets in balancing
300 (guess):
301
302 | map | waves | regular monsters, first and last wave | share by count, m0-m4 | first wave of m0-m4 |
303 |------|-------|-----------------|---------------------|---------------|
304 | map0 | 6 | 4, 7 | 36, 25, 18, 12, 9 % | 1, 2, 2, 4, 5 |
305 | map1 | 8 | 6, 17 | 36, 25, 18, 12, 9 % | 1, 2, 3, 5, 6 |
306 | map2 | 10 | 10, 36 | 39, 26, 17, 11, 7 % | 1, 2, 4, 6, 8 |
307 | map3 | 12 | 5, 16 | 52, 26, 13, 6, 3 % | 1, 2, 4, 6, 9 |
308
309 resulting monster counts (derived):
310
311 | map | m0 | m1 | m2 | m3 | m4 | regular monsters |
312 |------|----|----|----|----|----|------------------|
313 | map0 | 12 | 9 | 5 | 4 | 3 | 33 |
314 | map1 | 32 | 22 | 17 | 12 | 9 | 92 |
315 | map2 | 90 | 59 | 39 | 27 | 15 | 230 |
316 | map3 | 65 | 33 | 17 | 8 | 3 | 126 |
317
318 map3 has fewer and weaker monsters than map2. its 60 starting coins already
319 pay for much of what the naive player needs against b3, so the waves before
320 may pay only about 130 coins (see balancing).
280 321
281 322
282 hearts 323 hearts
283 ------ 324 ------
284 325
296 |----------------------------------|-------|--------| 337 |----------------------------------|-------|--------|
297 | flight time to the counter | 0.7 s | guess | 338 | flight time to the counter | 0.7 s | guess |
298 | most coin sprites for one death | 8 | guess | 339 | most coin sprites for one death | 8 | guess |
299 340
300 coins are added to the counter at the moment the monster dies; the flying 341 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 342 coins only show it (guess). the same holds for an early start bonus, whose
343 coins fly from the exits. this keeps the counter correct for a player who
302 builds right after a kill. 344 builds right after a kill.
303 345
304 346
305 controls 347 controls
306 -------- 348 --------
311 353
312 354
313 balancing 355 balancing
314 --------- 356 ---------
315 357
316 the values above were set without a way to estimate their effect, and the 358 the first values 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 359 game was far too easy. two t1 towers won every map, t2 was never needed, and
318 many coins are left over when a map is won. the aim is a game where the 360 many coins were left over when a map was won. the aim is a game where the
319 player has to think about where to place towers and which ones to build. a 361 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 362 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. 363 pays in order to win it. coins left over then come from better choices.
322 364
323 two scripted players mark the range (decided): 365 two scripted players mark the range (decided):
334 are preferred 376 are preferred
335 - values the player does not see are free: hp, damage, coin drops, speeds, 377 - values the player does not see are free: hp, damage, coin drops, speeds,
336 attack times 378 attack times
337 - shop prices are set first. hp, damage and the wave mix are then fitted to 379 - shop prices are set first. hp, damage and the wave mix are then fitted to
338 them 380 them
339 - the main control is coins per hp. regular monsters drop 0.2 coins per hp, 381 - the main control is coins per hp, set by the mix of monsters. m0 drops
340 so a map's difficulty and its income grow together. a map gets harder when 382 0.2 coins per hp, the other regular monsters 0.10 to 0.13. a mix with
341 its hp go up while its coins stay the same 383 fewer m0 pays less for the same hp
384 - monster hp stays the same on every map. wave size and the mix make a map
385 harder
342 386
343 the coins of the last wave, the boss's included, arrive when the map is as 387 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 388 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 389 wave. the last wave's coins are left out of the calculation. the boss keeps
346 its drop as a visible reward (decided). 390 its drop as a visible reward (decided).
400 tower. for t1 it falls with level: 0.43, 0.38, 0.31, 0.26 and 0.22. this 444 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 445 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 446 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 447 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 448 player than t1, so the calculation lists value per coin for every tower and
405 level, area damage included. 449 level, area damage included. the simulation measures 1.2 to 1.7 monsters
450 hit per t0 attack over whole runs, on median cells as on the best ones.
451 at that rate t0 at level 1 gives 0.8 to 1.1 against m0, two to three times
452 t1.
406 453
407 t2 works as a time multiplier. a slow to 0.6 of the speed gives 1.67 times 454 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 455 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 456 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. 457 tough monsters spaced apart to pay off. it is tuned after the t1 baseline.
458
459 tools/simulate.js (architecture.md) plays the same two players in the game
460 code. with the fitted waves, the two tools agree on the coins on hand at
461 each wave. they differ in the coins a wave needs:
462
463 - the boss needs 5 to 20 % more in the simulation: 49, 143, 338 and 206
464 coins for the naive player against 40, 130, 320 and 170 in the
465 calculation. faster monsters overtake the boss and draw fire away from it
466 - regular waves on map2 need up to 1.5 times as much. towers on median
467 cells cover the six routes unevenly, and monsters on a route with little
468 cover get through. the mean over routes hides this
469 - about a tenth of the shots are lost because the target died before the
470 projectile arrived
471 - route preference changes nothing: with bias 0 the results are the same,
472 since the speeds lie close to the reference speed
473 - the players in the simulation also build during a wave, with coins from
474 the monsters killed in it
475
476 tools/balance.py was left as it is. the waves were fitted with the
477 simulation.
478
479 with the fitted waves the naive player loses hearts to regular monsters
480 only in the first two or three waves. towers stay and add up. what a wave
481 demands, hp arriving per second, follows from the mix and the spawn
482 interval; wave size sets how long the wave lasts and what it pays. the boss
483 is the one demand that grows faster than the coins. the naive player loses
484 its hearts there, 5 at once, in most runs. the target of about 5 hearts
485 left is met on average over the seeds: the boss gets through in most runs
486 and dies in a few.
411 487
412 order of work (decided): 488 order of work (decided):
413 489
414 1. the calculation, tools/balance.py (architecture.md): value per coin for 490 1. the calculation, tools/balance.py (architecture.md): value per coin for
415 every tower, the wave demands against t1 only 491 every tower, the wave demands against t1 only