towerdef/docs/BALANCE.md
Claude 72c49eee1f Wrap up: review findings, balance baseline, bot tool and next-session notes
- docs/NEXT.md: where to pick up, prioritised, with the known wall-selling bug
  and its two-line fix
- docs/review-2026-10-09/: 85 reviewer findings (touch, co-op, client code,
  visual, reverse proxy) with verification status, repro scripts archive and
  the review workflow script; nothing fixed yet by design
- docs/BALANCE.md + tools/bot.js: headless balance bot and the untuned baseline
  (IDS Sniper dominates, maze is a near-guaranteed win, credits snowball)
- test/sim.test.js derives tunable numbers from the tables, plus a shape test
- README status note

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tb8pW2KAN4oFkh1aK1BfD8
2026-10-09 21:38:59 +00:00

64 lines
4.2 KiB
Markdown

# Balance notes (baseline measured 2026-10-09, nothing tuned yet)
`public/js/sim.js` still holds my first-guess numbers. A balance engineer agent built `tools/bot.js` (a headless player that
drives the sim through `sim.cmd()` / `sim.preview()`) and measured the untouched numbers; it was stopped before it applied any
tuning. `test/sim.test.js` was already updated by it so that no test hard-codes a tunable number (they derive values from
the `TOWERS` / `ENEMIES` tables), plus one test that pins the table *shape* the client and server depend on.
## Re-running the measurement
```bash
node tools/bot.js --maps open,twin,hub \
--strategies maze,nomaze,spam-filter,spam-ids,spam-mortar,spam-arc,lazy,maze-no-ids,maze-no-filter,maze-no-mortar,maze-no-throttle,maze-no-arc \
--seeds 8 --max 45
```
(runs on all cores; `--sim other/sim.js` measures another copy; `--json out.json --detail` for raw games.) Strategies: `maze`
(the mixed build), `nomaze`, `spam-<type>` (maze + one turret type), `maze-no-<type>` (ablation), `lazy`.
## Baseline results (8 seeds, waves up to 45; "win" = survived to wave 45)
| strategy | open | twin | hub |
|---|---|---|---|
| maze (mixed) | 8/8 win | 6/8 | 8/8 |
| nomaze | 7/8 (dies ~wave 29-43) | 0/8 (wave 29-30) | 0/8 (wave 29) |
| spam-ids | **8/8 win** | **8/8 win** | **8/8 win** |
| spam-filter | 0/8 (wave 14-28) | 0/8 | 0/8 |
| spam-mortar | 0/8 (wave 8) | 0/8 (wave 6-8) | 0/8 (wave 6-7) |
| spam-arc | 0/8 (wave 14-22) | 0/8 | 0/8 |
| maze without IDS | 0/8 (wave 14-29) | 0/8 | 0/8 |
| maze without filter / throttle / arc | still wins (7-8 of 8) | still wins (7-8 of 8) | still wins (7-8 of 8) |
| lazy | dies wave 8-9 | wave 3-4 | wave 6 |
Route length at wave 30 with the maze strategy, per gateway: about 150 cells on open, ~165 on twin and ~136 on hub, versus
roughly 25 for the unobstructed path (the bot reports the sum over gateways: 150 / 330 / 409). Credits at wave 30: about 280 unspent.
## What the numbers say
1. **IDS Sniper is mandatory and sufficient.** Every build without it collapses around wave 15-28; a maze + IDS-only
build wins everything on every map. That breaks the design goal that no single tower dominates and that flyers/armour
force a mixed defence. IDS needs a cost/damage/range nerf, or the other towers need real roles (Mortar and Arc are
far too weak on their own: they die by wave 8 / 15-22).
2. **The maze is a near-guaranteed win.** Cheap 5-credit walls stretch routes about 5 to 6 times, and the game is too easy
once you do it. Mazing should be rewarding but not a solved game. Candidate levers (a design decision, see NEXT.md):
escalating wall price (for example +1 credit per 10 walls), a wall cap, faster late waves, or armour/regen that punishes
long exposure.
3. **No-maze is too viable on open** (reaches wave 29-43). Early waves are too gentle, or turrets too strong without a maze.
4. **Economy snowballs** (about 280 credits unspent at wave 30) while the early game is tight (about 30-45 credits spare
around waves 5-10). Cut late-game rewards or add sinks (upgrade costs, escalating prices).
5. Throttle, Filter and Arc individually add little (removing any one still wins): either buff their roles or accept they
are support pieces.
## Targets the tuning should hit (from the original brief)
* Maze clearly beats no-maze; no-maze still survives the first 8-10 waves; lazy dies early.
* On `open`, a good maze build wins wave 30 in most seeds with a few lives to spare but not with a perfect record; no leaks
in waves 1-5.
* `twin` harder than `open`; `hub` hardest (maze build reaching roughly waves 24-30).
* Every single-tower spam strategy loses before wave 30 on `open`; every tower type is part of the best mixed build at least
sometimes. Flyer waves must punish a defence without anti-air, boss/Trojan waves must punish pure Filter spam.
* Credits neither snowball nor starve.
Only constants and tables in `sim.js` should need to change (costs, damage, range, rates, enemy hp/speed/armor/reward,
`waveGroups` counts, `hpScale`, `rewardScale`, `START_GOLD`, `SELL_RATIO`). Keep every table key, the 3-entry `levels`
arrays and the field names: the client UI and the server read them. A wall price escalation would be a logic change in
`Sim.place` and in the client's cost display.