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

Migrated from github.com/amirmushichge/pixel-plays

Add Espresso Bar: pour each coffee to the line as cups slide past under the spout #71

Merged opened this

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

Merged

Espresso Bar is added under /espresso-bar/, and the pour/score/lives rules are in espresso-bar/pour.js with no DOM. bun test espresso-bar serve.test.mjs shell.test.mjs passes, and the playtest suite's four Espresso Bar tests pass (boot, idle, pointer play, keyboard play).

Notes

shipped production is serving it deploy ab54f53

opened this

Espresso Bar is added under /espresso-bar/, and the pour/score/lives rules are in espresso-bar/pour.js with no DOM. bun test espresso-bar serve.test.mjs shell.test.mjs passes, and the playtest suite's four Espresso Bar tests pass (boot, idle, pointer play, keyboard play). I didn't run the full suite, bun x tsc --noEmit or scripts/design-lint.ts. Nobody has played it in a browser. I only looked at rendered frames, so the feel of the 0.25 s delay is untested by hand.

How it plays

  • Twenty glass cups slide along a belt under the spout, one at a time, in a repeating espresso/latte order.
  • Each cup has a red fill line and a small order card (ESP or LAT) with a bar as long as its line. Espresso's line is at 30% of the cup and latte's at 60%.
  • Hold Space, or press and hold anywhere on the canvas, to pour. The stream keeps falling for 0.25 s after release.
  • A cup within 3% of its line scores 3, within 10% scores 1, otherwise 0. Going over the brim spills and costs a life. A cup that passes untouched costs a life.
  • Belt speed rises 2% per cup. Three lost lives or twenty cups end the round.
  • The HUD shows score, cup n of 20, lives and best (best kept in localStorage).
  • The scene is drawn on the shared engine, with the machine, awning and belt baked once. Steam and the awning fringe move at 8 fps in whole pixels and stop under prefers-reduced-motion.
  • The page has a #mute button, no .mp3, a canvas aria-label that says how to play, and a three-line rules popup.

Wiring

  • Added to GAMES in shell.js with the exact entry from the issue. Also added: the matching <li> in index.html, the README Games table row, the no-music list, and the ambient-motion note.
  • serve.test.mjs asserts /espresso-bar/ and /espresso-bar/pour.js return 200.
  • bun scripts/og.mjs was run, so og/espresso-bar.png, the share tags and og/home.png exist.
  • pour.test.mjs covers each rule you listed, plus the 20-cup end and restart.

Choices to check

  • "Within 3%" is measured as 3 points of cup height from the line, not 3% of the line's own height.
  • At the top rate of 0.55 cups/s, 3% is about 55 ms of release timing, so a score of 3 is tight by design.
  • The 3% and 10% bands are only about 1 px and 3 px tall on a 3.4-unit cup. The band is mostly learned from the red ring against the coffee level.
  • Latte timing is tightest by cup 19, where a latte needs about 1.1 s of pour inside a window of roughly 1.45 s. If that proves too hard in play, SPEED_UP and RATE in pour.js are the knobs.
  • I added no dependencies and no HUD pour meter.

To try it, run bun serve.mjs and open /espresso-bar/, or use this pull's preview.

🤖 Generated with Claude Code

Closes #61

5 earlier comments · 1 event
commented

Espresso Bar is added under /espresso-bar/, and the pour/score/lives rules are in espresso-bar/pour.js with no DOM. bun test espresso-bar serve.test.mjs shell.test.mjs passes, and the playtest suite's four Espresso Bar tests pass (boot, idle, pointer play, keyboard play). I didn't run the full suite, bun x tsc --noEmit or scripts/design-lint.ts. Nobody has played it in a browser. I only looked at rendered frames, so the feel of the 0.25 s delay is untested by hand.

How it plays

  • Twenty glass cups slide along a belt under the spout, one at a time, in a repeating espresso/latte order.
  • Each cup has a red fill line and a small order card (ESP or LAT) with a bar as long as its line. Espresso's line is at 30% of the cup and latte's at 60%.
  • Hold Space, or press and hold anywhere on the canvas, to pour. The stream keeps falling for 0.25 s after release.
  • A cup within 3% of its line scores 3, within 10% scores 1, otherwise 0. Going over the brim spills and costs a life. A cup that passes untouched costs a life.
  • Belt speed rises 2% per cup. Three lost lives or twenty cups end the round.
  • The HUD shows score, cup n of 20, lives and best (best kept in localStorage).
  • The scene is drawn on the shared engine, with the machine, awning and belt baked once. Steam and the awning fringe move at 8 fps in whole pixels and stop under prefers-reduced-motion.
  • The page has a #mute button, no .mp3, a canvas aria-label that says how to play, and a three-line rules popup.

Wiring

  • Added to GAMES in shell.js with the exact entry from the issue. Also added: the matching <li> in index.html, the README Games table row, the no-music list, and the ambient-motion note.
  • serve.test.mjs asserts /espresso-bar/ and /espresso-bar/pour.js return 200.
  • bun scripts/og.mjs was run, so og/espresso-bar.png, the share tags and og/home.png exist.
  • pour.test.mjs covers each rule you listed, plus the 20-cup end and restart.

Choices to check

  • "Within 3%" is measured as 3 points of cup height from the line, not 3% of the line's own height.
  • At the top rate of 0.55 cups/s, 3% is about 55 ms of release timing, so a score of 3 is tight by design.
  • The 3% and 10% bands are only about 1 px and 3 px tall on a 3.4-unit cup. The band is mostly learned from the red ring against the coffee level.
  • Latte timing is tightest by cup 19, where a latte needs about 1.1 s of pour inside a window of roughly 1.45 s. If that proves too hard in play, SPEED_UP and RATE in pour.js are the knobs.
  • I added no dependencies and no HUD pour meter.

To try it, run bun serve.mjs and open /espresso-bar/, or use this pull's preview.

🤖 Generated with Claude Code

commented

I merged main into the branch and pushed it (705e3fd..1987c50). It now merges cleanly.

  • README.md: main's no-music list gained Archery. I kept that list and added Espresso Bar to it. The Games table already had both rows, and the ambient-motion note is unchanged.
  • og/home.png: I regenerated it with bun scripts/og.mjs, so the grid has both Archery and Espresso Bar. No other og/ files changed.

bun test espresso-bar serve.test.mjs shell.test.mjs passes, as do the four Espresso Bar playtests and the Archery tests. I did not run the full suite here; the forge's check runs it on this push.

commented

I merged main into the branch again and pushed it (1987c50..81ff243). It merges cleanly now.

  • README.md: main added Bell Tower to the list of games without music. I kept that list and added Espresso Bar, so it now reads "Tram Line, Archery, Bell Tower and Espresso Bar play on their own sound effects". The Games table rows from both sides are intact.
  • og/home.png: I regenerated it with bun scripts/og.mjs, so the grid now includes Bell Tower and Espresso Bar.

bun test espresso-bar serve.test.mjs shell.test.mjs passes (58 tests), as do the four Espresso Bar playtests. I did not run the full suite or the Bell Tower tests here; the forge's check runs them on this push.

commented

I merged main into the Espresso Bar branch and pushed it. The branch now has both Espresso Bar and the newly landed Goalkeeper.

  • Conflicts: README.md, index.html and shell.js each conflicted at the end of the game list. I kept both games' entries in all three files.
  • README music list: the "play on their own sound effects" sentence now names Bell Tower, Espresso Bar and Goalkeeper.
  • og/home.png: this is binary, so I took main's copy and then regenerated it with bun scripts/og.mjs. The grid now shows both games, and the cards for the other games were re-rendered by the same run.
  • Checks: serve.test.mjs and the Espresso Bar and Goalkeeper tests pass (71 tests, 0 failures). I didn't run bun test on the whole suite, since the forge runs it on the push. This repo has no scripts/gate.ts or scripts/fast.ts, so I skipped both. bun x tsc --noEmit printed only its usage text, so the type check didn't actually run and I can't call it green. I didn't touch src/web/, so I didn't run the design lint.
Changes requested — before the latest push

The game works in the preview (/, /espresso-bar/, pour.js and the og card all answer 200), the rules are tested, and the wiring is complete. Two cleanliness misses to fix in one round:

  1. Dead state in espresso-bar/pour.js. seed is set in newRound(best, seed), fed by Date.now() & 0xffff in index.html, and bumped in again(), but nothing ever reads it. The game has no randomness (cups follow the fixed ORDERS list). Remove the seed field and parameter, the Date.now argument, and the s.seed + 1 in again(). Also drop time from the state if nothing uses it, and do not export constants nothing uses (SCORES, RESTART_AFTER) unless a test needs them.
  1. Duplicated code in espresso-bar/index.html cup(). The two consecutive loops that plot the red fill line at lineZ and lineZ + .05 are the same loop twice. Make it one loop over [0, .05] offsets.

Also, the author said bun x tsc --noEmit did not actually run. Please run it and confirm. No other findings.

commented

Both findings are fixed and pushed. bun x tsc --noEmit still can't type-check this repo, so I couldn't confirm a clean result there. The Espresso Bar and serve.test.mjs tests pass, 53 tests with no failures.

  • Dead state in espresso-bar/pour.js: I removed seed (the field, the newRound parameter and the s.seed + 1 in again()) and the unused time field with its increment. The Date.now() & 0xffff argument is gone from index.html. SCORES and RESTART_AFTER are no longer exported. They stay as internal constants, and no test used them.
  • Duplicated loop in espresso-bar/index.html cup(): the two red fill-line loops are now one loop over [0, .05] offsets.
  • tsc: the repo has no tsconfig.json or package.json, so bun x tsc --noEmit prints tsc's usage text and exits 1. It isn't checking anything, which is why it showed no errors earlier. I didn't add a tsconfig, because that would change the repo's shape beyond this fix.

I also skipped scripts/gate.ts and scripts/fast.ts, since neither exists in this repo.

commented

I merged main into the Espresso Bar branch, resolved both conflicts, and pushed. bun test passes (516 tests, 0 failures). I ran only bun test here, not bun x tsc --noEmit or bun scripts/design-lint.ts, and this repo has no scripts/gate.ts or scripts/fast.ts.

  • README.md: the list of games that play on their own sound effects now names Espresso Bar alongside Goalkeeper and Wood Split. Both sides had edited that same line.
  • og/home.png: I took main's version, then regenerated it with bun scripts/og.mjs so the home collage includes both Wood Split and Espresso Bar.

To try it, open / on the preview at https://pixel-plays--71--forge-trevato-apps.open-platform.sh and find Espresso Bar and Wood Split in the game list.

Approved

Both earlier asks are met. The dead seed and time state is gone from pour.js, and the two fill-line loops in cup() are now one loop over the [0, .05] offsets. The preview serves /espresso-bar/ with 200. The game is wired into shell.js, the home list, the README (table row, no-music list, motion note) and the og cards. pour.test.mjs covers the rules, and serve.test.mjs checks the page and pour.js are served. It is static, so there is no auth, body or SQL surface. Non-blocking: tsc cannot run in this repo (there is no tsconfig), so the type check was not run.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs