Public: anyone can read this; the crew can change it.
Migrated from github.com/amirmushichge/pixel-plays
Add Tower Duel: the playable page and its place in the catalogue, on the rules in `tower-duel/duel.js` #156
Check · Review · Land · Live done — Landed and live in production.
Tower Duel is now a playable page at /tower-duel/, listed in the catalogue and driven only through tower-duel/duel.js. serve.test.mjs, shell.test.mjs and playtest.test.mjs pass (298 tests) after the rebase onto main. Page: tower-duel/index.html draws the 360x280 field under the fixed camera.
shipped production is serving it deploy ab54f53
4 earlier comments · 3 events
Tower Duel is now a playable page at /tower-duel/, listed in the catalogue and driven only through tower-duel/duel.js. serve.test.mjs, shell.test.mjs and playtest.test.mjs pass (298 tests) after the rebase onto main.
- Page:
tower-duel/index.htmldraws the 360x280 field under the fixed camera. You tap a card then your half, or press 1–4, move the ring with the arrows and press Space. The HUD shows elixir, hand, clock and towers down. The end line shows the win, loss or draw the rules report. The canvas aria-label says how to play,#muteis there, and no.mp3is added. Ambient motion (river ripples, king-tower pennants) stops underprefers-reduced-motion. - Catalogue: I added the
GAMESentry as specified and the matching<li>inindex.html. The README Games table, the no-music list and the ambient-motion list all name Tower Duel.bun scripts/og.mjshas been run, soog/tower-duel.pngandog/home.pngare new. - Tests:
rounds.mjshas a scripted round that defends with cards the elixir covers and idles to the clock. It ends on "You win on tower health".serve.test.mjsasserts that/tower-duel/and/tower-duel/duel.jsanswer 200. - Harness fix:
duel.jscallsstructuredClone, which the vm sandboxes inplaytest.mjsandscripts/og.mjsdid not provide. I added it to both contexts, which is why those two files are in the diff. - Rebase: I rebased on main (Seed Packets landed meanwhile) and merged the README conflicts by keeping both games' lines.
- Not run:
scripts/gate.ts,scripts/fast.tsandscripts/design-lint.tsdon't exist in this clone, so I skipped them.bun x tsc --noEmitprinted only its help text because there is notsconfig.json, so it checked nothing. The playtest andserve.test.mjsruns take several minutes because of the 90-second match.
To try it, run bun serve.mjs and open /tower-duel/.
I merged main into the branch and pushed it. The merge conflicted only in README.md and og/home.png. serve.test.mjs, shell.test.mjs and playtest.test.mjs pass (305 tests). I didn't run the rest of bun test here; the forge runs the full check on the push.
README.md: Both conflicts were lists thatmainalso extended for Hoopla Stall. I kept its text and added Tower Duel to the no-music list and to the ambient-motion sentence. The Games table row for Tower Duel merged cleanly.og/home.png: I re-ranbun scripts/og.mjsso the grid includes Hoopla Stall as well as Tower Duel. That's the checkserve.test.mjsmakes.
Not run: bun scripts/gate.ts, scripts/fast.ts and scripts/design-lint.ts still don't exist in this clone. bun x tsc --noEmit has nothing to check because there is no tsconfig.json.
Clean. Static page with no writes, no identity or storage, no innerHTML (textContent only), and no secrets or new dependency. The preview serves /tower-duel/ with 200. It is listed in GAMES, index.html, the README and the og cards. The scripted round and the serve test cover it, and the README credits Clash Royale as an idea-only homage while marking the game as forged. The structuredClone additions to the vm harnesses are justified in the pull.
Tower Duel's playable page and its catalogue entry are unchanged. This push only brings the branch level with main.
main is at e7a1429, the Lock Keeper commit. The merge of main into this branch (7e84d22) had already been made locally but never pushed, so the pull still pointed at the older merge, 9582377. git merge origin/main reports "Already up to date", so there were no conflicts to resolve. I pushed 7e84d22, and the pull should now merge cleanly.
I did not re-run bun test, the type check or the gate for this push. They were green before the restart, and this push adds only the merge commit.
Tower Duel serves 200 in the preview, is wired into GAMES, index.html, README, og and the scripted round, and credits Clash Royale as an idea-only homage. Two things make it hard to use on a 360px phone, which I treat as unusable.
- FIRST: the hand does not fit at 360px. Four buttons labelled like "1 Archers · 3" (about 13 monospace characters) cannot fit in a 328px row. The flex row does not wrap, so the labels break across lines, the buttons grow tall, and the hand covers the field. Put the cost and name on two short lines, or use a 2x2 grid, or shorten the label. Check it at 360x640 and 360x560.
- Touch targets: .card is about 33px tall (8px padding plus one line), under 44px. Raise min-height to 44px.
- Keyboard focus: button:focus-visible only changes the text colour, and .card keeps its border, so a keyboard user cannot see which card has focus. Add a visible outline, for example outline: 2px solid var(--accent); outline-offset: 2px.
- Without JavaScript the page is a blank canvas and empty buttons. Add a <noscript> line saying the game needs JavaScript, and hide the empty cards. Say in the pull if you left it on purpose for consistency with the sibling games.
Tests and the rest are fine. Fix these in one round.
I made all four fixes in tower-duel/index.html and pushed them, but I haven't looked at the page at 360x640 or 360x560. I have no browser in this sandbox, so you'll need to check it on the preview.
- Hand at 360px: the four cards now sit in a 2×2 grid (two columns, capped at 420px wide). Each label has a full cell to itself and is set not to wrap, so "1 Archers · 3" stays on one line. The grid is two rows tall (about 96px), so it may crowd the field on the shortest phones. That is the main thing to look at on the preview.
- Touch targets:
.cardhasmin-height: 44px. - Keyboard focus:
button:focus-visiblenow drawsoutline: 2px solid var(--accent)with a 2px offset. - Without JavaScript: a
<noscript>line says "Tower Duel needs JavaScript to play." The empty cards are hidden with.card:empty.
bun test passes (326 tests) on the Tower Duel, playtest, shell and serve suites. scripts/gate.ts, scripts/fast.ts and scripts/design-lint.ts don't exist in this clone, so none of them ran. The clone has no package.json, so the tsc --noEmit check printed only its usage text and checked nothing.
I merged main into the branch, resolved both conflicts, and pushed (a8c0c90).
- README.md:
mainhad added Ferryman to two lists, so I kept its text and added Tower Duel to each list.
- The "play on their own sound effects" list now ends "Hoopla Stall, Lock Keeper, Ferryman and Tower Duel". - The ambient-motion list keeps Ferryman's river ripples and adds Tower Duel's river ripples and king-tower pennants.
- og/home.png: a binary conflict, so I took
main's file and then re-ranbun scripts/og.mjs. The home card is a collage of every game's opening scene, so it has to include Tower Duel to match what the games render.
I ran the serve, shell and tower-duel tests. The one failure was the committed-card check, which fails when og/home.png doesn't match the games, and it passes after regenerating. I re-ran only serve.test.mjs after that, which passes (63 tests). I didn't re-run the shell and tower-duel tests, though they hadn't failed. I didn't run the rest of the suite or tsc, and I left that to the forge's check on this push.
All four earlier asks are met in the diff, and /tower-duel/ answers 200 on the preview. I could not diff against 7e84d22 because the commit is not in this clone, so I checked each ask against the current page.
- Hand at 360px: the cards sit in a 2x2 grid, capped at 420px, with white-space: nowrap on each label. Met.
- Touch targets: .card has min-height 44px. Met.
- Keyboard focus: button:focus-visible draws a 2px accent outline. Met.
- No JavaScript: a <noscript> line says the game needs JavaScript, and the empty cards are hidden. Met.
The page is static, with no writes and no identity, and it uses textContent only. It is listed in GAMES, index.html, the README and the og cards, and the README credits Clash Royale as an idea-only homage.
Two things I would do next:
- Non-blocking: check the 2x2 hand against the field at 360x560. The grid is about 96px tall and may crowd the canvas on the shortest phones.
- Non-blocking: the end-of-match line in #status is long. Give it room to wrap, or shorten it, so it does not clip on a narrow screen.
Tower Duel is now a playable page at
/tower-duel/, listed in the catalogue and driven only throughtower-duel/duel.js.serve.test.mjs,shell.test.mjsandplaytest.test.mjspass (298 tests) after the rebase onto main.tower-duel/index.htmldraws the 360x280 field under the fixed camera. You tap a card then your half, or press 1–4, move the ring with the arrows and press Space. The HUD shows elixir, hand, clock and towers down. The end line shows the win, loss or draw the rules report. The canvas aria-label says how to play,#muteis there, and no.mp3is added. Ambient motion (river ripples, king-tower pennants) stops underprefers-reduced-motion.GAMESentry as specified and the matching<li>inindex.html. The README Games table, the no-music list and the ambient-motion list all name Tower Duel.bun scripts/og.mjshas been run, soog/tower-duel.pngandog/home.pngare new.rounds.mjshas a scripted round that defends with cards the elixir covers and idles to the clock. It ends on "You win on tower health".serve.test.mjsasserts that/tower-duel/and/tower-duel/duel.jsanswer 200.duel.jscallsstructuredClone, which the vm sandboxes inplaytest.mjsandscripts/og.mjsdid not provide. I added it to both contexts, which is why those two files are in the diff.scripts/gate.ts,scripts/fast.tsandscripts/design-lint.tsdon't exist in this clone, so I skipped them.bun x tsc --noEmitprinted only its help text because there is notsconfig.json, so it checked nothing. The playtest andserve.test.mjsruns take several minutes because of the 90-second match.To try it, run
bun serve.mjsand open/tower-duel/.Closes #131