Co-op robustness, audio/a11y, new towers and enemies, Uplink rebalance

Co-op (QA'd with two to three real browsers, TCP-proxy chaos scenarios):
- partner's tower changes are never dropped after a render stall or snapshot burst
- half-open connections show "reconnecting" in ~6 s instead of 45-65 s
- upgrade and next-wave are idempotent (stale commands refused), restart message,
  promoted host gets Play again, failed joins never kill a live game, listener leaks

Audio / keyboard / a11y:
- one Audio element per track, fade/stinger supersede tokens, play() retry on the
  next gesture, 5 s fallback to the synth, mute works everywhere, dialogs with
  role/aria-modal/focus handling, accessible names for sound/speed/pause

New content:
- enemies: Daemon (healer), Proxy (regenerating shield), Botnet (flyer swarm);
  waves weave them in from wave 9 (waves 1-8 unchanged)
- towers: Sandbox (stun pulse), Load Balancer (fire-rate aura); hotkeys 1-9
- glyphs/shapes, stun/heal effects, gallery e2e that pixel-checks every kind

Orbital Uplink rebalanced after playtesting (was affordable by wave ~6 and buyable
in bulk from boss rewards): 1500 credits, upgrades 1200/2000/3200, and every Uplink
already owned makes the next one 25% dearer to buy AND to upgrade (each tower
remembers its multiplier, carried in the tower list as a 9th field). Shared
TD.priceFor/upgradePrice so the UI shows exactly what the sim charges.

Also: tablet/foldable viewports in the layout matrix (tolerant colour check),
docs (README tower/enemy tables, PROTOCOL shield/stun/pm encodings, NEXT roadmap).

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 21:18:43 +00:00
parent 962189419a
commit 28502984ec
29 changed files with 3370 additions and 230 deletions

View file

@ -32,6 +32,8 @@ if (process.env.MATRIX_ONLY) {
for (let i = SIZES.length - 1; i >= 0; i--) if (!only.includes(SIZES[i][0] + 'x' + SIZES[i][1])) SIZES.splice(i, 1);
}
// the selected border fades in over 120 ms; on a loaded machine it can be sampled mid-fade, so compare with a tolerance
const nearCyan = (c) => { const m = /rgb\((\d+), (\d+), (\d+)\)/.exec(c || ''); return !!m && Math.abs(m[1] - 77) <= 12 && Math.abs(m[2] - 227) <= 12 && Math.abs(m[3] - 255) <= 12; };
// pretend the game ships 10 towers and 8 maps (the sim is untouched: clones of existing definitions)
function stressContent() {
let td;
@ -186,7 +188,7 @@ module.exports = async function ({ browser, url: URL, out: OUT }) {
if (st.selType !== type) { fails.push(`palette tile ${type}: tap did not select it (selType=${st.selType})`); continue; }
const sp = await probe(page, `.tbtn[data-type="${type}"]`);
const vis = await page.evaluate((t) => { const e = document.querySelector(`.tbtn[data-type="${t}"]`); return { pressed: e.getAttribute('aria-pressed'), border: getComputedStyle(e).borderTopColor, cls: e.classList.contains('sel') }; }, type);
if (!sp.on || sp.blocked || !st.sel || vis.pressed !== 'true' || vis.border !== 'rgb(77, 227, 255)') fails.push(`palette tile ${type}: selected state not visible (${JSON.stringify({ on: sp.on, blocked: sp.blocked, ...vis })})`);
if (!sp.on || sp.blocked || !st.sel || vis.pressed !== 'true' || !nearCyan(vis.border)) fails.push(`palette tile ${type}: selected state not visible (${JSON.stringify({ on: sp.on, blocked: sp.blocked, ...vis })})`);
else reachable++;
}
check(reachable === order.length, `only ${reachable}/${order.length} palette towers selectable and visibly selected`);
@ -279,6 +281,13 @@ module.exports = async function ({ browser, url: URL, out: OUT }) {
if (!joined) fails.push('could not create a co-op room');
else {
await sleep(300);
// a first-time co-op player gets the first-run help too (code-26): same rule as solo, it needs a visible "Got it"
check(await page.evaluate(() => !document.getElementById('help').hidden), 'co-op first run: help overlay did not open');
await must(page, '#btnHelpClose', 'co-op help Got it');
const ph = await probe(page, '#btnHelpClose');
if (!ph.err) await tapAt(page, centre(ph).x, centre(ph).y);
await sleep(250);
check(await page.evaluate(() => document.getElementById('help').hidden), 'Got it did not close the co-op help overlay');
const room = await page.evaluate(() => NW.app.ctrl.room);
const chip = await must(page, '#netChip', 'room chip');
const txt = await page.evaluate(() => document.getElementById('netChip').innerText + ' ' + (document.getElementById('netChip').getAttribute('aria-label') || ''));