diff doc/balance.md @ 0:7af9dd4e2595

initial art and design/planning docs
author ark
date 2026-10-18 01:26 +0200
parents
children 910b26feca76
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/doc/balance.md	Sun Oct 18 01:26:39 2026 +0200
@@ -0,0 +1,267 @@
+balance
+-------
+
+all game numbers in one place. the values used by the game are in the config
+file (see architecture.md); this document explains them and records where each
+one comes from.
+
+source markers:
+
+- notes: from the original design notes or the original drawing sheet,
+  decided
+- decided: decided after the notes were written
+- guess: a starting value for playtesting, expected to change
+- derived: calculated from other values
+
+units: distances are in map pixels, that is pixels of the map image as
+scanned. times are in seconds, speeds in map pixels per second.
+
+
+scale
+-----
+
+| item                         | value | source |
+|------------------------------|-------|--------|
+| map images                   | 1.0   | notes  |
+| towers, monsters, projectiles | 0.25 | notes ("maps scaled approx 400%") |
+| coins                        | 0.4   | guess, 0.25 makes them about 10 pixels |
+| hp bars                      | 0.25  | guess  |
+
+measured from the masks (approximate, from red area divided by path width):
+
+| map  | size    | path width | path length, all branches |
+|------|---------|------------|---------------------------|
+| map0 | 705x697 | 56         | 1930 |
+| map1 | 663x590 | 48         | 1350 |
+| map2 | 618x537 | 42         | 2075 |
+| map3 | 642x459 | 52         | 905  |
+
+a single route on map1 or map2 is shorter than the total. exact route lengths
+come from the build (see architecture.md).
+
+
+monsters
+--------
+
+| monster | hp | coins | speed | source |
+|---------|----|-------|-------|--------|
+| m0      | 5  | 1     | 35    | hp, coins: notes; speed: guess |
+| m1      | 10 | 2     | 40    | as above |
+| m2      | 15 | 3     | 45    | as above |
+| m3      | 20 | 4     | 40    | as above |
+| m4      | 30 | 6     | 35    | as above |
+| b0      | 30 | 30    | 25    | as above |
+| b1      | 50 | 50    | 25    | as above |
+| b2      | 70 | 70    | 25    | as above |
+| b3      | 100 | 100  | 25    | as above |
+
+regular monsters drop 0.2 coins per hp; bosses drop 1 coin per hp (derived).
+
+time to walk the whole path at 35-45 speed (derived): map0 about 50 s, map3
+about 23 s.
+
+animation (all guesses):
+
+- one hop takes 0.35 s
+- hop height 5
+- squash on landing 6 % (wider and flatter), stretch in the air 4 %
+- idle bob 2 %
+- each monster starts at a random point in its hop cycle, so a group does not
+  hop in step
+
+
+route preference
+----------------
+
+on maps with several routes, a monster picks one at spawn. faster monsters
+prefer longer or straighter routes, slower ones prefer shortcuts (decided).
+
+proposed rule (guess):
+
+- for each route the build calculates its length and how much it turns (sum of
+  direction changes along the route)
+- each route gets a value between 0 and 1: the average of its length relative
+  to the longest route and its straightness relative to the straightest route
+- each monster gets a speed factor: its speed minus the reference speed,
+  divided by the reference speed, limited to -1..1
+- route weight = 1 + bias * speed factor * (2 * route value - 1), at least 0.1
+- a monster at the reference speed sees all routes as equally likely
+
+| parameter       | value | source |
+|-----------------|-------|--------|
+| reference speed | 40    | guess  |
+| bias            | 3     | guess  |
+
+with the speeds above, m2 is the only regular monster faster than the
+reference, and the effect on it is small. the speeds may need to spread out
+more for the preference to be visible.
+
+
+towers
+------
+
+towers have 5 levels (decided). the drawing sheet gives five damage values for
+t0 and t1, and four for t2 and t3. level 5 of t2 and t3 continues the trend
+(guess).
+
+| tower | damage by level  | cost | range by level      | attack every | projectile speed | source |
+|-------|------------------|------|---------------------|--------------|------------------|--------|
+| t0    | 5,10,15,20,25    | 5    | 45,48,51,54,57      | 1.5 s        | none (melee)     | damage, cost: notes; rest: guess |
+| t1    | 3,7,13,17,23     | 10   | 100,104,108,112,116 | 0.7 s        | 300              | as above |
+| t2    | 1,3,5,7,9        | 20   | 90,94,98,102,106    | 1.2 s        | 220              | damage 1-4, cost: notes; rest: guess |
+| t3    | 1,5,7,10,13      | 25   | 220,230,240,250,260 | 1.3 s        | 800              | damage 1-4: notes; cost: decided (was 40), may go lower; rest: guess |
+
+rules:
+
+- attack speed stays the same at every level (decided). t0 is slower than the
+  others (decided), t1 faster than t2, t2 faster than t3 (notes)
+- range grows about 4 % per level (decided "slightly", amount guessed)
+- t0 damages every monster in range at once, each attack
+- t2 slow: hit monsters move at 0.60, 0.55, 0.50, 0.45, 0.40 of their speed
+  by level, for 2 s (guess). a new hit restarts the time. slows do not add up;
+  the strongest one applies
+- p1, p2, p3 home in on their target. if the target dies first, the
+  projectile flies on to the last position and disappears (guess)
+- towers aim at the monster furthest along its route (guess)
+
+costs (decided: level n costs base cost x n):
+
+| tower | level 1 (build) | level 2 | level 3 | level 4 | level 5 | total |
+|-------|-----------------|---------|---------|---------|---------|-------|
+| t0    | 5               | 10      | 15      | 20      | 25      | 75    |
+| t1    | 10              | 20      | 30      | 40      | 50      | 150   |
+| t2    | 20              | 40      | 60      | 80      | 100     | 300   |
+| t3    | 25              | 50      | 75      | 100     | 125     | 375   |
+
+selling refunds half of the last purchase, rounded down (decided). this is
+low for upgraded towers: a level 5 t1 cost 150 in total and sells for 25.
+
+| tower | level 1 | level 2 | level 3 | level 4 | level 5 |
+|-------|---------|---------|---------|---------|---------|
+| t0    | 2       | 5       | 7       | 10      | 12      |
+| t1    | 5       | 10      | 15      | 20      | 25      |
+| t2    | 10      | 20      | 30      | 40      | 50      |
+| t3    | 12      | 25      | 37      | 50      | 62      |
+
+damage per second against a single target, at the guessed attack times
+(derived):
+
+| tower | level 1 | level 2 | level 3 | level 4 | level 5 |
+|-------|---------|---------|---------|---------|---------|
+| t0    | 3.3     | 6.7     | 10.0    | 13.3    | 16.7    |
+| t1    | 4.3     | 10.0    | 18.6    | 24.3    | 32.9    |
+| t2    | 0.8     | 2.5     | 4.2     | 5.8     | 7.5     |
+| t3    | 0.8     | 3.8     | 5.4     | 7.7     | 10.0    |
+
+t3 is meant to be weaker than the other towers; its range lets it reach more
+targets (decided). to keep the gap moderate, its cost went from 40 to 25 and
+its attack time from 2.0 s to 1.3 s, just slower than t2 as the notes require
+(decided, amount guessed). at level 1 it deals about a fifth of t1's damage per
+second at two and a half times the cost. its range covers more path, roughly
+three times as much on a winding map (estimate).
+
+
+placement
+---------
+
+| parameter                                  | value | source |
+|--------------------------------------------|-------|--------|
+| tower footprint radius                     | 16    | guess  |
+| largest gap between footprint and path edge | 14   | guess  |
+| smallest distance between tower centres    | 32    | derived (two footprints) |
+| distance from the map edge                 | 16    | guess  |
+| snap radius, how far a tap may be from a legal position | 48 | guess |
+| placement grid cell                        | 4     | guess  |
+
+towers may not be placed on the entrance or exit areas.
+
+
+economy
+-------
+
+| map  | starting coins | coins dropped in total | boss coins | regular monster coins | regular monster hp |
+|------|----------------|------------------------|------------|-----------------------|--------------------|
+| map0 | 10             | 100                    | 30         | 70                    | 350                |
+| map1 | 20             | 200                    | 50         | 150                   | 750                |
+| map2 | 40             | 400                    | 70         | 330                   | 1650               |
+| map3 | 60             | 600                    | 100        | 500                   | 2500               |
+
+starting coins and the 10 x starting coins total are from the notes; the rest
+is derived. early wave bonuses come on top of this total.
+
+the source sheet gives 50 starting coins for map3. the notes raise it to 60 to
+make the step from map1 to map3 more even (10, 20, 40, 60 instead of 10, 20,
+40, 50). likely to change after playtesting.
+
+share of the regular monster coins by monster level (guess). all monster
+levels appear on all maps (decided):
+
+| map  | m0   | m1   | m2   | m3   | m4   |
+|------|------|------|------|------|------|
+| map0 | 40 % | 25 % | 15 % | 10 % | 10 % |
+| map1 | 30 % | 25 % | 20 % | 15 % | 10 % |
+| map2 | 20 % | 20 % | 20 % | 20 % | 20 % |
+| map3 | 15 % | 15 % | 20 % | 25 % | 25 % |
+
+resulting monster counts (derived, rounded):
+
+| map  | m0 | m1 | m2 | m3 | m4 | monsters | coins |
+|------|----|----|----|----|----|----------|-------|
+| map0 | 28 | 9  | 4  | 2  | 1  | 44       | 72    |
+| map1 | 45 | 19 | 10 | 6  | 2  | 82       | 149   |
+| map2 | 66 | 33 | 22 | 16 | 11 | 148      | 328   |
+| map3 | 75 | 38 | 33 | 31 | 21 | 198      | 500   |
+
+the build prints these totals from the actual wave lists and warns when a map
+is more than 5 % off its coin total.
+
+
+waves
+-----
+
+| parameter                          | value               | source |
+|------------------------------------|---------------------|--------|
+| waves per map                      | 6, 8, 10, 12        | guess  |
+| break before the first wave        | 40 s                | guess  |
+| break between waves               | 25 s                | guess ("longer", decided) |
+| time between spawns within a group | 1.0 s, set per group | guess |
+| early start bonus, coins per second left | 0.05, 0.1, 0.2, 0.3 by map | guess (starting coins / 200) |
+
+the bonus is rounded down. if every break is skipped at once, the bonus adds
+about 6, 17, 45 and 82 coins per map (derived).
+
+suggested shape of a map's waves (guess): the coin value of wave n grows in
+proportion to n, so the last wave is the largest. the boss comes at the end of
+the last wave. later waves mix monster levels; early waves are mostly m0 and
+m1.
+
+
+hearts
+------
+
+| parameter               | value | source |
+|-------------------------|-------|--------|
+| hearts per map          | 10    | decided |
+| heart cost of a monster | 1     | decided |
+| heart cost of a boss    | 5     | decided |
+
+
+coins in flight
+---------------
+
+| parameter                        | value | source |
+|----------------------------------|-------|--------|
+| flight time to the counter       | 0.7 s | guess  |
+| most coin sprites for one death  | 8     | guess  |
+
+coins are added to the counter at the moment the monster dies; the flying
+coins only show it (guess). this keeps the counter correct for a player who
+builds right after a kill.
+
+
+controls
+--------
+
+| parameter  | value  | source |
+|------------|--------|--------|
+| game speeds | 1x, 2x | guess |