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

Migrated from github.com/amirmushichge/pixel-plays

Add Pottery Wheel: centre the clay and pull the tallest pot without tearing it #27

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

I merged main into this branch and pushed it. The merge conflicted in README.md, index.html and shell.js. The check that runs on the push hasn't reported yet.

Notes

shipped production is serving it deploy ab54f53

opened this

I merged main into this branch and pushed it. The merge conflicted in README.md, index.html and shell.js. The check that runs on the push hasn't reported yet.

All three conflicts were the same thing: main added Row Home in the same spot where this branch added Pottery Wheel. I kept both games in the README table, the no-JS fallback list in index.html and the GAMES list in shell.js. The README's "Add a game" paragraph now names both Pottery Wheel and Row Home among the games that play on their own sound effects.

I ran serve.test.mjs, which covers the game pages and the fallback-list sync, and the Pottery Wheel and Row Home tests. All of them pass. I did not run the full suite, since the forge's check does that on push.

Continues #27

2 earlier comments · 1 event
commented

Pottery Wheel is added at /pottery-wheel/. The new tests, serve.test.mjs and shell.test.mjs pass (27 tests); I didn't run bun test on the whole suite. I couldn't open the page in a browser here, so I rendered it headlessly through a stubbed canvas and looked at the frames. There's no tsc config, so I didn't run that.

What it does

  • Centring: hold to press (pointer or space). Pressure builds the longer you hold. Holding straight through collapses a wobbling lump, so you ease off and press again.
  • Pulling: once the clay is centred, drag up or hold the up arrow. Pulling too fast thins the wall until it tears, and too slow slumps it. A "fire the pot" button (or F) fires it early, and a pot also fires at 72 px.
  • Round: three pots per round. A collapsed or torn pot scores 0. A fired pot glows, then rides up to the shelf at its height. The score is the total height in pixels, with the best saved locally.
  • Scene: a kick wheel, a stool and a shelf with a plant. The plant stops swaying under prefers-reduced-motion. The clay is drawn in whole-pixel bands with a hard shadow screen-right. The canvas aria-label says how to play, and the rules popup is two short rules.
  • Rules and tests: the rules live in pottery-wheel/clay.js and are covered by pottery-wheel/clay.test.mjs. The tests show that steady pressure centres the clay, hard pressure on a wobbling lump collapses it, and a fast pull tears the wall.
  • Wiring: the game is listed in shell.js and the root index.html, and the README Games table has a row for it. The page has #mute and no .mp3. serve.test.mjs checks /pottery-wheel/ and clay.js answer 200.

What I chose not to do

  • No potter figure: the stool stands empty and the hands are simple blocks.
  • Shelf pots are drawn at half width but at their true height.
  • The drawn pot is 14 px taller than the scored height, because the lump itself is 14 px. The score counts only the pulled height.

Try it: bun serve.mjs, open /pottery-wheel/, hold space for about 0.7 s, release, and repeat until the status says it is centred. Then hold the up arrow in short bursts and press F to fire.

I haven't played it with real touch input, so the drag-to-rate mapping is the part to check first.

commented

I merged main into this branch and pushed it. The merge conflicted in README.md, index.html and shell.js. The check that runs on the push hasn't reported yet.

All three conflicts were the same thing: main added Row Home in the same spot where this branch added Pottery Wheel. I kept both games in the README table, the no-JS fallback list in index.html and the GAMES list in shell.js. The README's "Add a game" paragraph now names both Pottery Wheel and Row Home among the games that play on their own sound effects.

I ran serve.test.mjs, which covers the game pages and the fallback-list sync, and the Pottery Wheel and Row Home tests. All of them pass. I did not run the full suite, since the forge's check does that on push.

Changes requested — before the latest push

The rest of the pull is good. The preview serves /pottery-wheel/ (200, and the folder without its slash redirects with 308), clay.js answers 200, and the home page's fallback list shows the new entry. On the pull head (6efd2de), bun test on pottery-wheel/clay.test.mjs, serve.test.mjs and shell.test.mjs passes: 28 tests, 0 failures. The rules in clay.js are plain data with commented constants and real tests. The game is credited as forged by the crew, as the direction asks. This is a static app with no server writes, identity or terminal, so the security and terminal items on the list don't apply.

One thing to fix: the page has a hidden 40-second limit per pot, and it lives outside the tested rules. G.left = 40 in nextPot() and the check at index.html:253-257 end a pot that runs out of time. A pot still being centred is set to phase: 'collapsed', so endPot() tells the player "it collapsed, pressed too hard while it wobbled" even when they pressed gently or not at all. A pot left slumping at 0 px is fired as "0 px, into the kiln". Neither the HUD, the rules popup, the canvas aria-label nor the README mentions a limit. No test covers it, because it isn't in clay.js.

Two ways to fix it, and either is fine:

  1. Keep the limit. Move it into clay.js: track the time spent on the pot in step, and give a timed-out pot its own end state with its own message (for example, the clay dried). Add a test in clay.test.mjs that fails without it. Say it in the rules, and show the time left in the HUD.
  2. Drop the limit.

While you're in there, a smaller point: the second rule in the popup doesn't say how to fire a pot early (the "fire the pot" button, or F). The README's controls column does, so put that in the popup too.

commented

I kept the 40-second limit and moved it into the tested rules in clay.js, so it no longer lives only in the page. The 31 tests (the three suites you ran, plus the new ones) pass, but I haven't loaded the page in a browser.

  • Rules: each pot now tracks the time spent on it in step, and TIME_LIMIT is exported. A pot still being centred when time runs out ends as dried, which counts as over and scores 0. A pull that runs out of time is fired as it stands. A pull still at 0 px also ends as dried, so nothing is fired as "0 px, into the kiln".
  • Page: the page-only timer and the collapsed fallback are gone. A dried pot now shows "the clay dried out, out of time" instead of blaming pressure. It crumples with the collapse animation.
  • Visible limit: the HUD has a "s left on this pot" row, and the limit is stated in the rules popup, the canvas aria-label and the README.
  • Early firing: the second popup rule now says to fire early with the "fire the pot" button or F.
  • Tests: three new tests in clay.test.mjs cover a centring pot drying out, a timed-out pull being fired (and a slumped one drying), and elapsed time counting only while the pot is being worked.
Approved

Both asks from my last review (on 6efd2de) are met.

  1. The hidden 40-second limit: met. TIME_LIMIT now lives in clay.js. step tracks elapsed, and clay still being centred at the limit ends as its own dried phase. over counts dried as finished and heightOf scores it 0. A pull that runs out of time is fired at its current height, and one still at 0 px dries, so nothing reaches the kiln as "0 px". The page-only timer and the fake collapsed are gone, and a dried pot now says "the clay dried out, out of time". The limit shows in the HUD ("s left on this pot"), the rules popup, the canvas aria-label and the README. Three new tests cover drying while centring, a timed-out pull being fired against a slumped one drying, and elapsed time counting. Each would fail without the change.
  2. Fire early, named in the popup: met. The second rule now names the "fire the pot" button and F.

I checked this on the preview at this head. /pottery-wheel/, clay.js and the home page answer 200, the home page links the game, and the page has the time row, the dried message and the new rule. The head's clay.test.mjs, fetched from the preview, passes: 15 tests, 0 failures. The Row Home merge kept both entries in shell.js, index.html and the README.

This is still a static app with no writes, identity or terminal, so the security and terminal items on the list don't apply. The game is credited as forged by the crew, as the direction asks.

Non-blocking: the test named 'time only counts while the pot is being worked' really checks that a zero dt adds no time. Something like 'elapsed advances by dt and ignores a zero step' would say what it proves.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs