Public: anyone can read this; the crew can change it.

Migrated from github.com/amirmushichge/pixel-plays

clash royale #112

Parked opened this in answer to
Closed without merging

Issue #102 was empty apart from the title, so I read "clash royale" as a request for a two-lane card-battle game. I added it as a new game, Tower Duel, at tower-duel/. It has its own names, cards and pixel art and copies nothing from Supercell.

Notes

stopped parked by the crew deploy 3f01261

opened this

Issue #102 was empty apart from the title, so I read "clash royale" as a request for a two-lane card-battle game. I added it as a new game, Tower Duel, at tower-duel/. It has its own names, cards and pixel art and copies nothing from Supercell. I only ran the Tower Duel tests, not the whole suite. The two failures in the playtest and serve suites that I saw are listed below as already on main. I didn't run bun scripts/design-lint.ts, and bun x tsc --noEmit prints only its usage text because the repo has no tsconfig. I also didn't try the game in a real browser.

How it plays

  • The match lasts 90 seconds, with a river in the middle and two bridges.
  • You hold a hand of four cards from six: Knight, Archers, Giant (only hunts towers), Goblins, Brute and a Fireball that lands anywhere.
  • Each card costs elixir, which refills over time and twice as fast in the last 30 seconds.
  • Troops go on your half only. They cross at a bridge, fight what they meet, and towers shoot back.
  • If the king tower falls, that side loses at once. Otherwise the clock ends it: more towers down wins, then more tower health, then a draw.
  • The rival picks a random card it can afford and plays a fireball only where troops are bunched.
  • Wins are kept in localStorage.
  • Input is tap a card, then tap your half; or 1–4 or Tab to pick, arrows to move a ring, space to play.

Where it lives

  • tower-duel/duel.js holds the rules as plain numbers with no DOM, like firefly-jar/night.js.
  • tower-duel/index.html holds the page. It draws straight to the pixel buffer and doesn't load engine.js, because the engine is isometric 3D and this is a flat top-down arena.
  • I registered it in shell.js and index.html, and scripts/og.mjs made og/tower-duel.png and the home collage. The README has the row and the "no soundtrack" note.
  • I added a new Strategy kind, and serve.test.mjs now allows it.
  • I added no dependencies.

Tests

  • duel.test.mjs has 14 tests: elixir, card cycling, refusals, bad input, bridge crossing, the Giant, fireball radius, towers, crowns, tie-breaks, restart and seed replay. Left alone you lose every time, and a simple bot that just keeps sending troops wins most matches.
  • page.test.mjs covers tapping a card then the field, the rival-half refusal, the keyboard, and the end line.
  • rounds.mjs has a scripted round. The shared playtests for tower-duel pass.

Already failing on main, not touched

  • playtest.test.mjs "every game has a scripted round" fails because espresso-bar, firefly-jar, signal-box and soapbox-derby have no entry in rounds.mjs.
  • serve.test.mjs "turns off text selection and the iOS touch callout" fails for firefly-jar and others that lack the CSS line. Tower Duel has it.

To try it Run bun serve.mjs and open /tower-duel/, or use the preview once the forge builds this push.

Not done

  • No music; it plays on its own sound effects.
  • No unit collision, no elixir-drain or overtime rules, and the deck is fixed at six cards.

🤖 Generated with Claude Code

Closes #102

3 earlier comments
commented

Issue #102 was empty apart from the title, so I read "clash royale" as a request for a two-lane card-battle game. I added it as a new game, Tower Duel, at tower-duel/. It has its own names, cards and pixel art and copies nothing from Supercell. I only ran the Tower Duel tests, not the whole suite. The two failures in the playtest and serve suites that I saw are listed below as already on main. I didn't run bun scripts/design-lint.ts, and bun x tsc --noEmit prints only its usage text because the repo has no tsconfig. I also didn't try the game in a real browser.

How it plays

  • The match lasts 90 seconds, with a river in the middle and two bridges.
  • You hold a hand of four cards from six: Knight, Archers, Giant (only hunts towers), Goblins, Brute and a Fireball that lands anywhere.
  • Each card costs elixir, which refills over time and twice as fast in the last 30 seconds.
  • Troops go on your half only. They cross at a bridge, fight what they meet, and towers shoot back.
  • If the king tower falls, that side loses at once. Otherwise the clock ends it: more towers down wins, then more tower health, then a draw.
  • The rival picks a random card it can afford and plays a fireball only where troops are bunched.
  • Wins are kept in localStorage.
  • Input is tap a card, then tap your half; or 1–4 or Tab to pick, arrows to move a ring, space to play.

Where it lives

  • tower-duel/duel.js holds the rules as plain numbers with no DOM, like firefly-jar/night.js.
  • tower-duel/index.html holds the page. It draws straight to the pixel buffer and doesn't load engine.js, because the engine is isometric 3D and this is a flat top-down arena.
  • I registered it in shell.js and index.html, and scripts/og.mjs made og/tower-duel.png and the home collage. The README has the row and the "no soundtrack" note.
  • I added a new Strategy kind, and serve.test.mjs now allows it.
  • I added no dependencies.

Tests

  • duel.test.mjs has 14 tests: elixir, card cycling, refusals, bad input, bridge crossing, the Giant, fireball radius, towers, crowns, tie-breaks, restart and seed replay. Left alone you lose every time, and a simple bot that just keeps sending troops wins most matches.
  • page.test.mjs covers tapping a card then the field, the rival-half refusal, the keyboard, and the end line.
  • rounds.mjs has a scripted round. The shared playtests for tower-duel pass.

Already failing on main, not touched

  • playtest.test.mjs "every game has a scripted round" fails because espresso-bar, firefly-jar, signal-box and soapbox-derby have no entry in rounds.mjs.
  • serve.test.mjs "turns off text selection and the iOS touch callout" fails for firefly-jar and others that lack the CSS line. Tower Duel has it.

To try it Run bun serve.mjs and open /tower-duel/, or use the preview once the forge builds this push.

Not done

  • No music; it plays on its own sound effects.
  • No unit collision, no elixir-drain or overtime rules, and the deck is fixed at six cards.

🤖 Generated with Claude Code

commented

All 10 failing tests should pass now, but I haven't re-run the full suite. I ran the scripted rounds for the four games without one plus tower-duel, and the signal-box, soapbox-derby and serve.test.mjs suites, which passed (80 tests). I didn't re-run playtest.test.mjs end to end, because it takes longer than the shell's two-minute limit. I also didn't run bun x tsc --noEmit or scripts/gate.ts, and I touched no src/web/, so design-lint doesn't apply. The forge's check runs the full suite on this push.

None of the failures came from Tower Duel. They were gaps in the games merged to main just before it (Espresso Bar, Firefly Jar, Signal Box, Soapbox Derby) and a test helper that changed under them.

  • Scripted rounds: rounds.mjs had no entry for espresso-bar, firefly-jar, signal-box or soapbox-derby, which failed the "every game has a scripted round" check and each game's own round test. I added one per game, each ending in a loss:

- Espresso Bar: leave the cups unpoured. - Firefly Jar: idle until the third moth reaches the lantern. - Signal Box: pull a wrong lever on purpose. - Soapbox Derby: idle until the cart wrecks.

  • Firefly Jar: its index.html was missing the no-text-selection and no-touch-callout CSS that every game page must have. I added it, copying Soapbox Derby's line.
  • Page tests: signal-box/page.test.mjs and soapbox-derby/page.test.mjs read game state with vm.runInContext, but playtest.mjs now keeps the page's variables out of the global scope. I switched them to g.read(...). These tests were wrong and needed the change; the games were fine.

Behaviour is unchanged and no dependencies were added.

commented

I merged main into mason/102-clash-royale and pushed it. The scripted rounds for the games both sides touched pass, as do serve.test.mjs and the Tower Duel tests (66). I didn't run the full playtest.test.mjs or bun x tsc --noEmit; the forge's check runs the full suite on this push.

How I resolved the four conflicts:

  • rounds.mjs: I kept main's rounds for Espresso Bar, Firefly Jar, Signal Box and Soapbox Derby, plus its new Sheepdog round. They play each game properly, and mine only let the round run out. I dropped my four stand-in rounds. I kept the Tower Duel round, which main doesn't have.
  • firefly-jar/index.html: I took main's version of the no-text-selection CSS, which is the same fix as mine in one line.
  • README.md: I started from my side so the Tower Duel row stayed. I added main's Sheepdog row, main's updated "Ambient motion" bullet and main's "Add a game" paragraph, with Tower Duel added to the list of games that play on sound effects alone.
  • og/home.png: I took main's copy and regenerated it with bun scripts/og.mjs, so it includes Sheepdog and Tower Duel. The script also re-rendered the other cards. I committed only og/home.png and og/sheepdog.png.
commented

Parked by the crew: the check stayed red through 2 automatic tries

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs