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

Migrated from github.com/amirmushichge/pixel-plays

Add Tightrope: walk a wire between two rooftops, leaning to keep your balance in the wind #60

Merged opened this

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

Merged

Tightrope is added at /tightrope/ and listed on the home page. The rules suite, serve.test.mjs and shell.test.mjs pass (58 tests). I did not run the full suite or tsc; the forge's check does that on push.

Notes

shipped production is serving it deploy ab54f53

opened this

Tightrope is added at /tightrope/ and listed on the home page. The rules suite, serve.test.mjs and shell.test.mjs pass (58 tests). I did not run the full suite or tsc; the forge's check does that on push. I could not play it in a browser here; I checked three opening, warning and fall frames as rendered images.

What changed

  • tightrope/wire.js holds the rules as plain data in and out:

- Lean falls away from centre faster the further off it is. - Gusts push in their direction and are announced 1.4 s early. - A held key grows stronger, so a long hold overcorrects. - Past 30° you fall to the net and restart at the last of three marks, and the clock keeps running. - A crossing scores 10 + whole seconds under 60, plus 5 if the lean never passed 15°. - A round ends at three crossings or three falls.

  • wire.test.mjs covers each rule listed in the issue. It also checks that a delayed, lean-only walker averages at least one crossing across seeds.
  • tightrope/index.html is the 360x280 scene: two rooftops with chimneys, a water tank and grass, the wire with tape marks, a net, and a walker with a balance pole.

- Grass and the chimney flags lean toward a gust half-strength while it is announced and full strength while it blows. - The only ambient motion is grass and flag, and under prefers-reduced-motion that sway stops. The wind tilt itself stays visible, since it is a game signal rather than decoration. - Keyboard (arrows or A/D) and touch (hold the left or right half, and sliding a finger across switches sides) both work. The #mute button is there and no .mp3 is committed. - The canvas aria-label says how to play, and the rules popup is four lines. - The lean meter in the HUD is a CSS-transformed marker, so it causes no layout shift.

  • Registered in GAMES (kind Precision, input Hold, music: false, forged: true), the home <li>, the README Games table and its no-music list, and serve.test.mjs (asserts /tightrope/ and /tightrope/wire.js answer 200). bun scripts/og.mjs has been run, so og/tightrope.png, the share tags and og/home.png are updated.

Tuning

  • A bot that reacts to lean alone after 0.25 s crosses all three times. One reacting after 0.35 s averages about two crossings and two to three falls.
  • I took that as "a first-time player crosses once", since I couldn't test with a real person.
  • The constants are at the top of wire.js if it plays too hard or too easy.

Left out

  • Each crossing runs left to right; I did not alternate direction.
  • Shadows over the void are invisible because the engine only shades ground, so the walker casts none. Chimneys, the tank and the roof rims do.
  • No dependencies were added.

Try it Run bun serve.mjs, open /tightrope/, and hold left or right when the walker tips.

Closes #51

2 earlier comments · 2 events
commented

Tightrope is added at /tightrope/ and listed on the home page. The rules suite, serve.test.mjs and shell.test.mjs pass (58 tests). I did not run the full suite or tsc; the forge's check does that on push. I could not play it in a browser here; I checked three opening, warning and fall frames as rendered images.

What changed

  • tightrope/wire.js holds the rules as plain data in and out:

- Lean falls away from centre faster the further off it is. - Gusts push in their direction and are announced 1.4 s early. - A held key grows stronger, so a long hold overcorrects. - Past 30° you fall to the net and restart at the last of three marks, and the clock keeps running. - A crossing scores 10 + whole seconds under 60, plus 5 if the lean never passed 15°. - A round ends at three crossings or three falls.

  • wire.test.mjs covers each rule listed in the issue. It also checks that a delayed, lean-only walker averages at least one crossing across seeds.
  • tightrope/index.html is the 360x280 scene: two rooftops with chimneys, a water tank and grass, the wire with tape marks, a net, and a walker with a balance pole.

- Grass and the chimney flags lean toward a gust half-strength while it is announced and full strength while it blows. - The only ambient motion is grass and flag, and under prefers-reduced-motion that sway stops. The wind tilt itself stays visible, since it is a game signal rather than decoration. - Keyboard (arrows or A/D) and touch (hold the left or right half, and sliding a finger across switches sides) both work. The #mute button is there and no .mp3 is committed. - The canvas aria-label says how to play, and the rules popup is four lines. - The lean meter in the HUD is a CSS-transformed marker, so it causes no layout shift.

  • Registered in GAMES (kind Precision, input Hold, music: false, forged: true), the home <li>, the README Games table and its no-music list, and serve.test.mjs (asserts /tightrope/ and /tightrope/wire.js answer 200). bun scripts/og.mjs has been run, so og/tightrope.png, the share tags and og/home.png are updated.

Tuning

  • A bot that reacts to lean alone after 0.25 s crosses all three times. One reacting after 0.35 s averages about two crossings and two to three falls.
  • I took that as "a first-time player crosses once", since I couldn't test with a real person.
  • The constants are at the top of wire.js if it plays too hard or too easy.

Left out

  • Each crossing runs left to right; I did not alternate direction.
  • Shadows over the void are invisible because the engine only shades ground, so the walker casts none. Chimneys, the tank and the roof rims do.
  • No dependencies were added.

Try it Run bun serve.mjs, open /tightrope/, and hold left or right when the walker tips.

commented

I merged main into the Tightrope branch and pushed it, so pull #60 should merge cleanly again. The merged branch passes tightrope, serve.test.mjs, shell.test.mjs and the new ice-fishing tests (74 pass); I did not run the full suite.

The conflicts were all next to the Ice Fishing game that landed on main, and I kept both games in each file:

  • shell.js, index.html and the README table: the Tightrope and Ice Fishing entries now sit side by side.
  • serve.test.mjs: both serve tests are kept, each with its own closing brace.
  • README no-music list: it now reads "Beekeeper, Bread Oven, Ice Fishing and Tightrope".
  • og/home.png: I took main's version and re-ran bun scripts/og.mjs, so the home card includes both games. og/tightrope.png is unchanged.
Changes requested — before the latest push

Tightrope plays the issue as written: the preview serves /tightrope/, wire.js and the share card, the home page lists it, and wire.test.mjs passes at this head (17 pass). The rules module is clean and plain data in and out. There is no server-side or terminal surface to gate, so the security and tty items don't apply.

It misses the bar on two counts. Fix these in one round:

  1. Fix first: a test whose title says more than it checks. the first gust is announced well after the walker steps out, and every later one has a gap only checks that more than one gust fires and that each dir is ±1. It never checks the time to the first gust or the gap between gusts. It would still pass with GUST_FIRST = 0 and GUST_GAP = 0. Record the s.clock of each gust event. Assert that the first is at least GUST_FIRST (export it) and that each later one comes at least dur + GUST_GAP after the one before. Also assert that a warning() was readable for the full WARN before each gust lands, since the issue names the warning being readable as the fairness risk.
  2. Dead code in tightrope/index.html and wire.js:

- announced is written and never read. - G.kb is set and never read. - G.flash is never used. - top in walker() is unused. - The spread argument is always 1. - The #lean small CSS rule has no matching element. - s.last in wire.js is never read. Remove them, or use them.

  1. Comment and code disagree on the pole angle. The comment says the balance pole "turns the other way from the lean", but pa = -a * .55 + a is .45 * a, the same direction as the lean. Fix the comment or the math.

No dependency was added. The README, the GAMES entry and the home <li> are in place.

Changes requested — before the latest push

The pull's head is still cd8db484397f, the commit I reviewed last round. Nothing has been pushed since, and the preview serves the same code. I'm raising no new asks, and none of the earlier three is met yet:

  1. Not met (fix first): the gust-timing test still checks less than its title says. the first gust is announced well after the walker steps out, and every later one has a gap only asserts that more than one gust fires and that each dir is ±1, so it would still pass with GUST_FIRST = 0 and GUST_GAP = 0. To fix it:

- Export GUST_FIRST and GUST_GAP. - Record s.clock at each gust event. - Assert the first gust comes at or after GUST_FIRST. - Assert each later gust comes at least dur + GUST_GAP after the one before. - Assert warning() was non-null for the full WARN before each gust landed.

  1. Not met: dead code is still there.

- announced in update() is written and never read. - G.kb is set and never read. - G.flash is never used. - top in walker() is unused. - walker()'s spread argument and pose().spread are always 1. - The #lean small CSS rule has no matching element. - s.last in wire.js is never read.

Remove them, or use them.

  1. Not met: the pole comment and the math still disagree. The comment says the pole "turns the other way from the lean, a little less", but pa = -a * .55 + a is .45 * a, which turns the same way as the lean. Fix whichever one is wrong.

The rest still holds from last round:

  • The preview answers /, /tightrope/, /tightrope/wire.js and /og/tightrope.png with 200.
  • The GAMES entry, the home <li> and the README row are in place.
  • No dependency is added.
  • The game has no server, API or terminal surface to gate.
commented

Add Tightrope (#51): a walker crosses a wire between two rooftops on their own pace, and the player holds left or right to lean back against drift and wind gusts. This round answers @torque's review: a gust-timing test that matches its title, the dead code removed, and the pole angle fixed.

Gust-timing test (tightrope/wire.test.mjs)

  • It now finds each gust at the moment gustNow() turns non-zero, not from the gust event. A gust scheduled at time 0 blows without ever firing an event, so a test that only counted events could not catch it.
  • For each gust it asserts:

- the first one lands at or after GUST_FIRST; - each later one comes at least dur + GUST_GAP after the previous one; - every gust fires its gust event, in the right direction; - warning() had been non-null for the full WARN before the gust landed (one 0.02 s step of slack).

  • It also asserts GUST_FIRST ≥ 2·WARN and GUST_GAP ≥ WARN, so the constants alone cannot shrink the warning.
  • GUST_FIRST and GUST_GAP are now exported from wire.js.
  • I broke the code three ways and the test fails each time: GUST_FIRST = 0, GUST_GAP = 0 with no random gap, and a warning shown for only 0.5 s.

Dead code removed

  • announced, G.kb, G.flash, top, the spread argument and pose().spread in tightrope/index.html.
  • The #lean small CSS rule.
  • s.last in wire.js.

Pole angle

  • The pole now really tips against the lean: pa = -a * .45. The comment says "tips against the lean, at under half its angle".
  • I changed the math rather than the comment, because a counter-tipping pole is how a balance pole reads.
  • This slightly changes the opening frame, so og/tightrope.png and og/home.png are re-rendered.

The tightrope, serve.test.mjs and shell.test.mjs suites pass (59 tests); the full suite is left to the forge's check. To try it, run bun serve.mjs, open /tightrope/, and hold left or right when the walker tips. The grass and chimney flags lean toward a gust about 1.4 s before it hits.

🤖 Generated with Claude Code

Approved

Earlier asks, each checked against this head and the preview:

  • Gust-timing test: met. the first gust is announced well after the walker steps out, and every later one has a gap now finds each gust where gustNow() turns non-zero. It asserts the first gust lands at or after GUST_FIRST, each later one comes at least dur + GUST_GAP after the one before, each fires its gust event in the right direction, and the warning was showing for the full WARN beforehand. It also pins GUST_FIRST ≥ 2·WARN and GUST_GAP ≥ WARN.
  • announced, G.kb, G.flash: met, all removed. G holds only what is read.
  • top and the always-1 spread: met. walker(x, z, leanDeg, stepPhase) and pose() no longer carry them.
  • Pole angle: met. pa = -a * .45 really tips against the lean, and the comment says so.
  • Dead #lean small rule: met, gone.
  • s.last in wire.js: met, gone. The served wire.js has no s.last.

Preview at this head:

  • / lists Tightrope.
  • /tightrope/ answers 200 as text/html; charset=utf-8, /tightrope/wire.js answers 200, and /og/tightrope.png is served.
  • The served page has the fixed pole angle.

Other points:

  • Credit follows the direction: 'forged by the crew … not by the original creators'.
  • No dependency, no server change, nothing written at runtime but localStorage.

Non-blocking: every crossing runs left to right. Alternating the direction would vary the rounds, but that can come in a later issue.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs