From dad0382e10b5a9b147872f5b946b8d2d251a40b5 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 10 Oct 2026 15:48:10 +0000 Subject: [PATCH] docs: versus mode design and roadmap Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01Tb8pW2KAN4oFkh1aK1BfD8 --- docs/NEXT.md | 17 ++++++++++++ docs/VERSUS.md | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 docs/VERSUS.md diff --git a/docs/NEXT.md b/docs/NEXT.md index 26e7f41..415a6d3 100644 --- a/docs/NEXT.md +++ b/docs/NEXT.md @@ -20,6 +20,23 @@ Development was paused on purpose before the fix stage. This file is the entry p * 2026-10-10: selecting a placed Firewall no longer throws (walls can be sold again; e2e scenario `06-select-sell`). +## Roadmap (decided with the user, 2026-10-10) + +The user playtested ("fun, mostly usable") and chose: maze stays strong (no wall price rule), an Easy/Normal/Hard picker, +and these features after the fixes: more maps, new towers and enemies, server leaderboard, room list / quick match. +Later requests: an **endgame tower** (Orbital Uplink, in the sim already), **attack-vs-defend multiplayer** (`docs/VERSUS.md`), +and a check that the layout holds on **tablets and foldables**. + +| Wave | Content | State | +|---|---|---| +| 1 | Phone panels/layout + touch precision (one owner of main.js/style.css), proxy/server doc fixes, QA | running / see git log | +| 2 | Co-op robustness (stalled-render tower loss, half-open sockets, idempotent upgrade/wave), audio + keyboard + a11y | drafted | +| 3 | Content: Orbital Uplink client side (glyph, beam, hotkey), new towers/enemies (healer, shielded, Sandbox, Load Balancer), 4 new maps (in sim already) | sim half done | +| 4 | Attack-vs-defend versus mode, bots for both sides | design in `docs/VERSUS.md` | +| 5 | Difficulty picker + ONE time-boxed balance pass (IDS dominance, weak Mortar/Arc, credit pile-up; maze stays strong) | after 3 and 4 | +| 6 | Server leaderboard (needs `StateDirectory=netwall` + `DATA_DIR`; solo scores are client-reported) and an opt-in public room list | after 5 | +| any | Tablet/foldable viewports in the e2e matrix (near-square 690x830, 840x700, half-folded 841x400, cover 344x800) | todo | + ## Suggested order of work 1. **The wall bug above**, then the other confirmed high/medium client bugs: diff --git a/docs/VERSUS.md b/docs/VERSUS.md new file mode 100644 index 0000000..7f91a17 --- /dev/null +++ b/docs/VERSUS.md @@ -0,0 +1,74 @@ +# Versus mode: attack vs defend ("play as the Internet") + +Requested 2026-10-10. One player **defends** (builds the maze and turrets, as today); the other **attacks** (earns credits over +time, spends them on spawning packets, upgrades and sabotage). Same board, same rules, one authoritative simulation per room. +Decisions made with the user: timed rounds then swap roles; attacker abilities *and* defender counter-tools; a computer +opponent for either side so it can be played alone. + +## Match structure + +* A match is **two rounds with the roles swapped** (host picks who starts as what; or random). +* A round ends when the **server falls** (attacker wins, the time it took is recorded) or when the **round timer** runs out + (defender wins; default 12 minutes, host can pick 8 / 12 / 16). +* Match result compares each player's attacking performance: faster fall wins; if neither felled the server, the one who + took off more integrity wins; otherwise draw. Show both rounds side by side on the result screen. +* No pause, no speed control in versus (both would be exploitable). Disconnect: the round freezes up to the 60 s grace; on + expiry the other player wins the round. + +## Attacker economy ("bandwidth") + +| Rule | Starting value (to be tuned with the bot) | +|---|---| +| Start credits | 150 | +| Base income | 4 credits/s, rising slowly (+0.02/s per second of the round) | +| **Lifetime bonus** | every living attacker unit earns `cost x 0.004` credits per second alive, capped at 50% of its cost in total | +| Leak bonus | a unit that reaches the server pays back its full cost (and damages integrity) | +| Unit shop | every enemy kind has a `buyCost` (pinger 10, worm 14, spam pack 20, ghost 40, trojan 60, healer 70, rootkit 400, ...) | +| Caps | at most 250 units alive, 200 staged (performance) | + +**Save up and launch.** Units can be bought instantly (`spawn`) or **staged** (`stage`): the price is paid now, the units wait in +a convoy and are released together by `launch` (optionally split over gateways, as a 3 s burst). The defender sees the +*size* of the staged convoy but not its composition. Presets for one tap: Rush (20 pings), Swarm (60 spam), Siege (4 +trojans + a healer), Air raid (10 ghosts), Boss (rootkit). + +**Tech upgrades** (permanent for the round, apply to units spawned afterwards): Armor (+1 per level, 5 levels), Speed (+8%), +Health (+15%), Regeneration (+1% hp/s), Shield (absorbs damage), Stealth (towers cannot acquire a unit for its first second +on the map, 3 levels), Encryption (resists slows). Costs double per level. + +**Sabotage abilities** (credits + cooldown): *EMP* disables one turret for 6 s; *Decoy* a harmless packet every turret +prioritises for 5 s; *Surge* all units +40% speed for 6 s; *DDoS* all turrets fire 40% slower for 4 s (long cooldown). + +## Defender economy and counter-tools + +* Start credits 250, kill rewards (scaled by unit cost), plus a small trickle (2/s), so the defender can adapt before the first rush. +* Builds, upgrades and sells as today (walls still can never seal the route). +* **Counter-tools:** *Scan* (reveals stealth for a few seconds and clears EMP on turrets in an area), *Patch* (instantly + re-enable an EMPed turret), *Repair* (restore 3 integrity, long cooldown, costs credits), *Quarantine* (freeze every unit on + the board for 2 s, very long cooldown). + +## More suggestions (not decided yet) + +* Gateway choice per spawn on multi-gateway maps; attacker sees a faint heat-map of where the defender's fire is strongest. +* A short **ready/countdown** before each round so both players are present; a rematch button that swaps roles. +* **Spectators** (third connection, read-only) later. +* **Handicap sliders** in the lobby (attacker income, defender start credits) for mixed-skill pairs. +* Per-map, per-difficulty **leaderboard of attack times** once the server leaderboard exists. +* The bot defender is the maze builder from `tools/bot.js` moved into shared code; the bot attacker is a budgeted spender that + reacts to the tower mix (flyers if there is no anti-air, armoured trojans against filters, saves for a convoy). + +## Implementation plan + +1. **Sim** (`public/js/sim.js`, pure, with unit tests): `mode: 'versus'`, attacker state (credits, income, tech levels, staged convoy, + cooldowns), commands `spawn`, `stage`, `launch`, `tech`, `ability`, defender tools, round timer and result, role checks + (a command carries the issuer's role; the sim refuses cross-role commands). Add `buyCost` to the enemy table. No automatic waves. +2. **Bots** shared by browser and server (`public/js/bot.js`), driven only through the public sim API. +3. **Server** (`server/room.js`, protocol): room option `mode: 'coop' | 'versus'`, role assignment, ready/countdown, rounds and swap, + per-role command whitelist, attacker data in snapshots, match result message, bot seat. Update `docs/PROTOCOL.md` and tests. +4. **Client**: lobby (mode, role, limit, bot), role-aware HUD: attacker gets the unit shop (the palette becomes the shop), tech panel, + abilities, convoy and Launch, income readout, round timer; defender keeps the build palette plus counter-tools. Phone layout + first (the action bar pattern), same canvas renderer. +5. **Balance** with bot-versus-bot matches over the maps (like `tools/bot.js` does for solo): neither side should win more than + about 60% of rounds on any map. +6. **e2e**: two browsers play a round each way; one bot match. + +Depends on the content wave (new enemy kinds become shop items) and on the difficulty/economy constants, so it comes after them.