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

@ -163,17 +163,18 @@ the trailing slash). A dedicated sub-domain is simpler.
| **Goal** | Survive 30 waves (then keep going in endless mode) on one of seven maps. Every packet that reaches the server costs integrity. |
| **Firewall** (5) | A wall. Packets path-find around it; the route preview shows how much longer it makes their trip. |
| **Packet Filter** | Fast and cheap. Weak against armour. |
| **IDS Sniper** | Long range, hits hard, slow. The answer to armour and bosses. |
| **IDS Sniper** | Long range, hits hard, slow. The answer to armour and bosses, but a poor answer to swarms of weak packets (use Filters, Mortars and Arcs for those). |
| **Flood Mortar** | Splash damage on ground swarms. Cannot hit flyers. |
| **Rate Limiter** | Slows everything in range. Rootkits resist it. |
| **Router Arc** | Chain lightning between nearby packets. |
| **Sandbox** | Control tower, no damage: pulses a stun on every packet in range (bosses are stunned half as long). |
| **Load Balancer** | Support tower, no attack: nearby attack turrets fire 15 / 25 / 35% faster (the best balancer in range applies, they do not stack). |
| **Orbital Uplink** | The endgame weapon: a piercing beam that ignores armour, hits ground and air, blasts and slows around the target and reaches across most of the map. Extremely expensive: 1500 credits, upgrades 1200 / 2000 / 3200 (4 levels), and **every Uplink you already own makes the next one 25% dearer, to buy and to upgrade** (1500, 1880, 2340, 2930, ...), so kill rewards cannot buy a carpet of them. |
| **Orbital Uplink** | The endgame weapon: a piercing beam that ignores armour, hits ground and air, blasts and slows around the target and reaches across most of the map. Extremely expensive: 1500 credits, upgrades 1200 / 2000 / 3200 (4 levels), and **every Uplink you already own makes the next one 30% dearer, to buy and to upgrade** (1500, 1950, 2540, 3300, ...), so kill rewards cannot buy a carpet of them. |
| **Spoofed packets** | Fly straight over your maze: keep some anti-air. Botnet drones are fast flying swarms. |
| **Daemons** | Healers: they restore nearby packets (up to 12% of max health per second), so kill them first. |
| **Proxies** | Shielded packets: the shield soaks damage first and regrows after 3 s without being hit. |
| **Credits** | From kills and cleared waves. Upgrade turrets (3 levels, 4 for the Uplink); selling returns 70% (walls 100%). |
| **Difficulty** | **Easy / Normal / Hard**, picked in the menu (solo) or by the host when creating a co-op room, and shown next to the next-wave list and on the end screen. It scales the starting credits and integrity, the hit points of every packet and what a kill pays (the table is `DIFFICULTIES` in `public/js/sim.js`). Normal uses the base tables of the game with every multiplier at 1. Your best wave is kept per map **and** difficulty. |
Controls, desktop: click to build, drag to paint walls, right-click cancels, `1`-`9` pick a tower, `Space` next wave,
`U` upgrade, `X` sell, `T` change targeting, `P` pause, `F` speed, `A` auto-waves, `M` mute, wheel zoom, Alt+click pings.