One player defends, the other plays the Internet: earns credits over time and spends them on packets, upgrades and sabotage. Two rounds with swapped roles, timed (the faster fall wins). Built end to end, NOT yet QA'd or balanced. Sim (public/js/sim.js, TD.VS table): attacker economy (income, lifetime bonus, leak payback), spawn / stage / launch convoys, 7 tech tracks, abilities (EMP, decoy, surge, DDoS), defender tools (scan, patch, repair, quarantine), role-checked commands, round result, role-private state. Co-op/solo unchanged (24 scripted games replay identically). Bots (public/js/bot.js, tools/versus.js): defender (maze + turrets) and attacker (budgeted spender reading the tower mix); headless bot-vs-bot runner. Server (server/versus.js, protocol doc): versus rooms with lobby / countdown / playing / roundover / matchover, role stamping, cross-role refusal, role-private priv messages at 4 Hz, computer seat, freeze/forfeit rules, no pause/speed. Client (public/js/versus.js): setup dialog (role, length, vs computer or online), countdown, defender tools row, attacker unit shop with convoy + launch, tech and abilities, gateway choice, round/match screens, sounds, phone-first dock rows. Status and next steps (balance: the attacker currently wins ~100% of bot rounds; QA with two browsers; layout matrix rerun) are in docs/NEXT.md and docs/VERSUS.md. The full planned workflow incl. balance/QA prompts is in docs/workflows/versus-full.js. 253 unit tests pass; one smoke e2e run; no other e2e per the user's request. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Tb8pW2KAN4oFkh1aK1BfD8
121 lines
11 KiB
Markdown
121 lines
11 KiB
Markdown
# Where to pick up (written 2026-10-09)
|
|
|
|
Netwall is playable and pushed: solo (desktop + phone), two-player co-op through the Node server, music, PWA, deploy docs.
|
|
Development was paused on purpose before the fix stage. This file is the entry point for the next session.
|
|
|
|
## State of the repo (2026-10-11)
|
|
|
|
| Area | State |
|
|
|---|---|
|
|
| `public/js/sim.js` | Shared rules: 7 maps, 9 towers (Sandbox, Load Balancer, 4-level Orbital Uplink with escalating prices), 9 enemy kinds, Easy/Normal/Hard. **Balance tuned once** (Normal ~71% bot wins, see `docs/BALANCE.md`); remaining imbalances are listed there. |
|
|
| `server/` | Adversarially reviewed (pid leak, room flood, XFF, ...) and proxy-tested against real nginx with Proxy Manager's config. Co-op robustness fixed (stalls, half-open sockets, idempotent commands). |
|
|
| `public/` client | Phone-first layout (action bars, scrollable palette, pinned overlay footers), touch precision (nothing commits on pointerdown, nudge arrows), a11y/audio fixes, difficulty picker. Tested across 33 viewports incl. tablets and foldables (emulated). |
|
|
| `e2e/` | `npm run e2e`: 17 scenarios (smoke, touch, touch precision, select/sell, info-panel stability, UI states, a11y, audio, content gallery, co-op chaos, session UI, Uplink price, difficulty, 33-layout matrix ~8 min). Timing checks can flake on a loaded machine: rerun a scenario alone before concluding anything. |
|
|
| `tools/bot.js` | Headless defender bot (dev tool; deterministic). Does not build Sandbox / Load Balancer / Uplink. |
|
|
| Deploy | `docs/DEPLOY.md`, `deploy/netwall.service`, README setup guide; proxy behaviour verified against nginx 1.26 with Proxy Manager v2.16's rendered config (not the NPM app itself, not a real LXC). |
|
|
|
|
`npm test` = 156 passing.
|
|
|
|
## Fixed since this was written
|
|
|
|
* 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, proxy/server doc fixes, QA | **done 2026-10-10** |
|
|
| 2 | Co-op robustness (stalled-render tower loss, half-open sockets, idempotent upgrade/wave, restart message), audio + keyboard + a11y | **done 2026-10-10** (QA passed) |
|
|
| 3 | New enemies (Daemon healer, Proxy shielded, Botnet swarm) and towers (Sandbox stun, Load Balancer buff), glyphs/shapes, gallery e2e; Orbital Uplink (4 levels, priced 1500 + 25% per owned, upgrades scale equally; ); 4 new maps | **done 2026-10-10** (QA passed) |
|
|
| 4 | Difficulty picker (Easy/Normal/Hard) + ONE time-boxed balance pass (IDS no longer sufficient, credit snowball tamed, Mortar/Arc/Filter buffed, flyers slower); Uplink price step set to 30% per owned | **done 2026-10-11** (QA passed) |
|
|
| 5 | Attack-vs-defend versus mode, bots for both sides | **built 2026-10-11, NOT QA'd, NOT balanced** (sim, bots, server, client; see below) |
|
|
| 6 | Server leaderboard (needs `StateDirectory=netwall` + `DATA_DIR`; solo scores are client-reported) and an opt-in public room list | after 5 |
|
|
| any | Fold/tablet real-device check; open items below | |
|
|
|
|
### Open items from wave 2 QA (all minor)
|
|
|
|
* The loser of a simultaneous Sell sees a red toast ("That tower no longer exists"); the loser of a simultaneous Keep going sees "Nothing to continue". Silence them like the stale upgrade/wave.
|
|
* A host who closes the tab (no Leave) stays host for the whole grace period (60 s), so the guest on the end screen waits that long for Play again.
|
|
* `room.js` checks the 1500-unit 'busy' cap before the sim's stale check; main.js has no wording for 'busy'.
|
|
* Any `no_room` after a successful join says "The server restarted..." even if the room merely expired (a lone sleeping phone); the tests pin the string.
|
|
* Tablet/fold polish: the co-op top bar wraps to two rows at 690x830; at 1180x820 the board letterboxes (~249 px dead band); the Players panel (Invite, Leave) is below the fold on stacked layouts; "Waiting for the host" sits flush under the Menu button.
|
|
* Test strength: the e2e 'stall' scenario passes even without the `_carryTw` fix (the sync backstop heals it; unit tests pin it); the audio fade-supersede guard is not pinned by 09-audio.
|
|
* If room codes ever get longer than 4 characters, boot's regex and the `inCode` maxlength must change together.
|
|
|
|
|
|
### Versus mode: where it stands and what is left
|
|
|
|
Built: sim rules + economy + tech + abilities + defender tools (`TD.VS` table), `public/js/bot.js` (defender and attacker bots), `tools/versus.js`
|
|
(bot-vs-bot runner), server rooms/phases/roles/forfeit/private data/computer seat (`server/versus.js`), protocol (`docs/PROTOCOL.md` "Versus"),
|
|
client (`public/js/versus.js`: setup dialog, countdown, role-aware HUD, shop, convoy/launch, tech, abilities, tools, round/match screens). 253 unit tests
|
|
pass; the client was played by hand (local match vs the computer through both rounds, online rooms on the real server). **No e2e, no layout-matrix
|
|
run, no independent QA, no balance pass** (the user asked to skip them for now).
|
|
|
|
Left to do, in order:
|
|
1. **Balance** with `node tools/versus.js --maps all --limit 720 --seeds 6`: the attacker wins ~100% today. Cheapest lever: raise the buyCost of botnet
|
|
and spam (3 credits each; botnet 8 / spam 6 flips it to ~0%); target 40-60% for equal bots on every map. The `buyCost` lives in `ENEMIES`, the rest in `TD.VS`.
|
|
2. **QA** with two real browsers (prompt in `docs/workflows/versus-full.js`) plus the usual suites: `npm run e2e` (rerun the layout matrix: the menu foot now holds
|
|
three buttons, the palette becomes the unit shop in versus, new dock rows in the side panel).
|
|
3. Known limits from the client agent: a local computer match cannot be paused (opening the menu leaves the round running); no one-tap convoy presets (Rush, Swarm,
|
|
Siege...); the defender sees no stealth/shield cue (by design); on very small phones the setup dialog's Online block needs a scroll; remote rematch, frozen/reconnect
|
|
and reload-resume into a versus room were not exercised.
|
|
4. Ideas not built: spectators, handicap sliders in the lobby, a leaderboard of attack times, an invite link that opens the versus lobby directly.
|
|
|
|
## Suggested order of work
|
|
|
|
1. **The wall bug above**, then the other confirmed high/medium client bugs:
|
|
* `code-2`: the info panel is rebuilt with `innerHTML` on every `view.rev` change, so an Upgrade/Sell/Target tap that
|
|
lands during a rebuild is lost (worse in co-op, where the partner's actions bump `rev`). Update in place or rebuild
|
|
only when this tower's signature changes.
|
|
* `coop-1` / `code-1`: `RemoteController` keeps only the last 10 snapshots; a render stall of ~0.5 to 1 s drops snapshots
|
|
that carry `tw` (tower list) before they are displayed, so the partner's new towers are lost until a resync. Never
|
|
discard an entry whose `tw` has not been applied (or apply `tw` to the mirror on arrival and only delay the drawn list).
|
|
* `touch-1`, `touch-2`: with a wall armed, the first finger of a pinch builds a wall immediately; with a turret armed
|
|
it moves the pending placement. Defer the first placement to pointerup/first real move and cancel on a second pointer.
|
|
* Phone layout: after tapping a tower the Upgrade/Sell/Target buttons are below the fold (`visual-2`, `touch-3`); on small
|
|
phones the first-run Help has no visible "Got it" (`visual-3`) and the co-op room code and Invite button are not
|
|
visible while waiting for a partner (`visual-4`, `touch-8`). Likely fix: show the selected-tower panel as a bottom
|
|
sheet over the palette, put room code/invite in the top bar or a toast, make overlays scroll with a sticky button row.
|
|
* `coop-2`: after a half-open connection (Wi-Fi/cell switch) the UI looks alive but frozen for 47 to 65 s; show the
|
|
reconnect overlay as soon as the watchdog fires and open a new socket without waiting for the old one to close.
|
|
2. **Co-op correctness**: simultaneous Upgrade / Next Wave from both players are applied twice (`coop-5`: make upgrade
|
|
idempotent, e.g. send the expected level; ignore a wave command within ~1 s of another), host-leaves-while-end-screen
|
|
(`coop-3`, `code-11`), failed join from the menu kills the live game (`coop-4`), controller races (`code-3`, `code-4`).
|
|
3. **Smaller UX/a11y**: reduced-motion hides every toast (`touch-5`, `visual-6`), Space held launches ~20 waves
|
|
(`code-6`: ignore `e.repeat`), co-op music/stinger after Play again (`code-5`, `code-7`, `code-12`), touch target sizes,
|
|
safe-area double padding, contrast, colour-only enemy legend, pause not obvious.
|
|
4. **Proxy docs/behaviour** (`proxy-*` in the findings): 403 when the public URL has a non-default port (Origin vs Host
|
|
port handling), DEPLOY.md claims NPM can send `X-Forwarded-Host` from the Advanced tab (it cannot), NPM's default read
|
|
timeout is 90 s not 60 s, service worker serves nginx's 502 page instead of the cached app, path-prefix instructions for NPM.
|
|
5. **Balance** (`docs/BALANCE.md`): the baseline shows the game is currently too easy and IDS Sniper dominates.
|
|
6. Real-world checks that were never possible in the sandbox: a real phone (iOS Safari audio unlock, safe areas, wake
|
|
lock), real nginx Proxy Manager with Let's Encrypt, a Proxmox LXC with the systemd unit.
|
|
|
|
Findings marked UNVERIFIED were reported with a reproduction but not yet independently re-checked (the verification
|
|
stage was stopped); re-run the repro from `docs/review-2026-10-09/repro-scripts.tgz` before fixing.
|
|
|
|
## Decisions waiting for the user
|
|
|
|
* **Maze exploit.** A long serpentine of cheap walls (5 credits) makes routes about 5 to 6 times longer than the direct path.
|
|
Options: escalating wall price, a wall cap, or faster/tougher waves. See `docs/BALANCE.md`.
|
|
* **Room codes** are 4 characters (about 1M); a stranger could guess an open room. Options: 6 characters, an optional
|
|
room password, per-IP rate limit on failed joins.
|
|
* **Music size.** battle/boss/menu are 3 to 8 MB each and downloaded whole on first use; fine on Wi-Fi, heavy on mobile
|
|
data. Could re-encode to mono ~48 kbps.
|
|
|
|
## Dev environment (what the session used, none of it is in the repo)
|
|
|
|
* The sandbox had no Node and no root. The user's machine can install anything: `apt install nodejs npm`, `npm install`,
|
|
`npx playwright-core install chromium-headless-shell` (plus `npx playwright-core install-deps` as root) and `npm run e2e` is all that is needed.
|
|
* The review pipeline (5 reviewers, a verifier per finding, one fixer, a final QA) was a Workflow script; a copy is in
|
|
`docs/review-2026-10-09/phase2-workflow.js` and can be re-run (re-point its scratch paths) to verify the UNVERIFIED
|
|
findings and to run the fix stage.
|
|
* Conventions: `public/js/sim.js` must stay pure and DOM-free (it runs in the browser for solo and in Node for co-op); `ws` is the only
|
|
runtime dependency; the client uses only relative URLs (works under a proxy path prefix); `test/` may only hold real test files
|
|
(plain `node --test` runs everything there).
|
|
* Git: commit and push at milestones is pre-authorised for this project.
|