Difficulty picker (Easy/Normal/Hard) and a balance pass

Difficulty:
- TD.DIFFICULTIES (starting credits, lives, enemy hp/shield, kill reward), validated
  create-room / newgame option, state carries it; solo menu picker and co-op lobby
  picker (44px segmented control, reachable on every layout), HUD/room/end-screen
  labels, best-wave record per map AND difficulty (Normal keeps the legacy key),
  Play again keeps the running game's difficulty for host and guest

Balance (12 bot runs, deterministic, 48/48 games replay identically in QA):
- Normal ~71% bot wins at wave 30 (was 94%), Easy 100%, Hard 25% on open
- credits tamed: reward growth 3% -> 2% per wave, clear bonus 10+2n -> 10+n, hp scaling
  eased, Rootkit pays 60 (was 100) but is tougher, flyers slower; unspent credits at
  wave 30: 1309 -> 335
- IDS Sniper is now a slow heavy hitter (essential, no longer sufficient: IDS-only
  dies by wave 7); Mortar, Arc and Filter buffed
- Orbital Uplink price step per owned unit 30% (buy and upgrade)
- remaining imbalances documented in docs/BALANCE.md

Tests: difficulty (19) and balance (8) unit suites, 14-difficulty e2e, layout matrix
reachability of the picker. 156 unit tests, 17 e2e scenarios.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Tb8pW2KAN4oFkh1aK1BfD8
This commit is contained in:
Claude 2026-10-10 23:41:21 +00:00
parent 28502984ec
commit b4ae6cb57d
19 changed files with 1348 additions and 156 deletions

View file

@ -94,7 +94,10 @@
<p id="mapDesc" class="mapdesc"></p>
</div>
<div class="card-foot">
<div id="menuOpts" class="opts"></div><!-- room for the difficulty selector (Easy / Normal / Hard) -->
<div id="menuOpts" class="opts">
<div id="diffPick" class="seg" role="radiogroup" aria-label="Difficulty"></div><!-- Easy / Normal / Hard, built by main.js from TD.DIFFICULTIES -->
<p id="diffNote" class="diffnote"></p>
</div>
<div class="row">
<button id="btnSolo" class="primary big"><svg class="ic"><use href="#i-play"/></svg>Play solo</button>
<button id="btnCoop" class="big"><svg class="ic"><use href="#i-users"/></svg>Co-op online</button>
@ -121,6 +124,7 @@
<div class="col">
<h3>Host a game</h3>
<p class="muted small" id="lobbyMapName"></p>
<div id="lobbyDiff" class="seg" role="radiogroup" aria-label="Difficulty"></div>
<button id="btnCreate" class="primary big">Create room</button>
</div>
<div class="col">