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

Migrated from github.com/amirmushichge/pixel-plays

better game browser. right now the list is kinda lame. i would love to see mo… #47

Merged opened this in answer to

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

Merged

quill/pixel-plays:quill/44-better-game-browser-right-now-the-list-i → main 3 commits fork 5 threads · 5 unresolved

  • Merged. quill/44-better-game-browser-right-now-the-list-i was merged into main as cd10642.

Review

Sign in to review this change.
4 files changed +192 −56
README.md +1 −1
@@ -47,7 +47,7 @@ On the forge, `forge.json` runs `bun serve.mjs` with health check `/`. State is
4747 Every page carries Open Graph and Twitter tags (between `og:begin` and `og:end`), and `og/<id>.png` is a 1200x630 card: the game's own opening frame, scaled 2x on white; `og/home.png` is a grid of all of them. Because the games are static, `bun scripts/og.mjs` makes them without a browser: it runs each page's scripts in a `vm` against a stub DOM, captures the canvas pixels and writes the PNG (zlib only, no dependency) and the tags. Run it after adding a game or changing a scene; `serve.test.mjs` fails when a card or its tags are missing or stale. Scenes are rendered with a seeded `Math.random`, so the cards are byte-for-byte reproducible. Absolute URLs use `ORIGIN` at the top of the script (the forge production site), so change it there if the site moves.
4848
4949 ## Add a game
50 Create `<id>/index.html`, load `../shell.js`, call `PixelPlays.mount({ id, rules })`, set `window.PP_SCENE`, load `../engine.js`, then add the game to `GAMES` in `shell.js` with a one-line `blurb`; the home page lists every `GAMES` entry (a static fallback list for no-JS is kept in sync by `serve.test.mjs`, so add the matching `<li>` to `index.html` too). Then run `bun scripts/og.mjs` to make its share card and tags. The page needs a `#mute` button. Put its background track at `<id>/<id>.mp3`, or set `music: false` on its `GAMES` entry when it has none (Stone Skip, Kite Hill, Paper Route, Harbour Crane, Pizza Toss, Sled Run, Pottery Wheel, Row Home, Orchard, Lighthouse, Market Scale, Window Washer and Domino Run play on their own sound effects). Rules that need testing go in a plain script with a `.test.mjs` beside it, as in `kite-hill/model.js`.
50 Create `<id>/index.html`, load `../shell.js`, call `PixelPlays.mount({ id, rules })`, set `window.PP_SCENE`, load `../engine.js`, then add the game to `GAMES` in `shell.js` with a one-line `blurb`; the home page lists every `GAMES` entry as a card with its `kind`, `input` and `accent`, searchable and filterable by kind (a static fallback list for no-JS is kept in sync by `serve.test.mjs`, so add the matching `<li>` to `index.html` too, with the same `data-kind`, `data-input`, `--accent` and tags line). Then run `bun scripts/og.mjs` to make its share card and tags. The page needs a `#mute` button. Put its background track at `<id>/<id>.mp3`, or set `music: false` on its `GAMES` entry when it has none (Stone Skip, Kite Hill, Paper Route, Harbour Crane, Pizza Toss, Sled Run, Pottery Wheel, Row Home, Orchard, Lighthouse, Market Scale, Window Washer and Domino Run play on their own sound effects). Rules that need testing go in a plain script with a `.test.mjs` beside it, as in `kite-hill/model.js`.
5151
5252 - `shell.js` provides the game menu, the Rules popup, the credits and the background music.
5353 - `engine.js` provides the camera, depth buffer, colour ramps, shadows, edges, figures, trees and wind as globals.
index.html +77 −34
@@ -3,6 +3,7 @@
33 <head>
44 <meta charset="utf-8">
55 <meta name="viewport" content="width=device-width, initial-scale=1">
6 <script>document.documentElement.classList.add('js')</script>
67 <title>Pixel Plays</title>
78 <!-- og:begin -->
89 <meta name="description" content="Small browser games shown as isometric pixel dioramas. Pick one.">
@@ -21,62 +22,104 @@
2122 <!-- og:end -->
2223 <style>
2324 body { margin: 0; background: #fff; color: #1c1b19; font: 16px/1.5 system-ui, sans-serif; }
24 main { max-width: 36rem; margin: 0 auto; padding: 8vh 20px 48px; }
25 main { max-width: 64rem; margin: 0 auto; padding: 8vh 20px 48px; }
2526 h1 { font-size: 1.5rem; margin: 0 0 .25em; }
26 p { margin: 0 0 2rem; color: #8b877f; }
27 ul { list-style: none; margin: 0; padding: 0; }
28 li { border-top: 1px solid #e6e3dc; }
29 a { display: block; padding: 14px 0 0; font-weight: 600; color: inherit; text-decoration: none; }
30 a:hover, a:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
31 li span { display: block; color: #8b877f; }
32 li span:last-child { padding-bottom: 14px; }
27 p { margin: 0 0 1.5rem; color: #8b877f; }
28 .tools { display: none; margin: 0 0 1.5rem; gap: 12px; flex-direction: column; }
29 .js .tools { display: flex; }
30 #q { font: inherit; padding: 10px 12px; border: 1px solid #1c1b19; border-radius: 0; background: #fff; color: inherit; width: 100%; box-sizing: border-box; max-width: 22rem; }
31 #kinds { min-height: 2.25rem; display: flex; flex-wrap: wrap; gap: 8px; }
32 #kinds button { font: inherit; font-size: .875rem; padding: 6px 12px; background: #fff; color: #8b877f; border: 1px solid #e6e3dc; cursor: pointer; }
33 #kinds button:hover, #kinds button:focus-visible { color: #1c1b19; border-color: #1c1b19; }
34 #kinds button[aria-pressed="true"] { background: #1c1b19; color: #fff; border-color: #1c1b19; }
35 ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 16px; }
36 li { border: 1px solid #e6e3dc; border-top: 6px solid var(--accent, #1c1b19); position: relative; padding: 14px 16px 14px; display: flex; flex-direction: column; gap: 4px; }
37 li:hover, li:focus-within { border-color: #1c1b19; border-top-color: var(--accent, #1c1b19); }
38 a { font-weight: 600; color: inherit; text-decoration: none; }
39 a::after { content: ""; position: absolute; inset: 0; }
40 a:focus-visible { outline: 2px solid #1c1b19; outline-offset: 2px; }
41 li span { color: #8b877f; font-size: .9375rem; }
42 li .tags { order: -1; font-size: .75rem; letter-spacing: .06em; text-transform: uppercase; color: #1c1b19; }
outdated

aria-live on the whole list re-reads every card on each keystroke. Use one role=status line with the count instead.

43 li a { order: 0; }
44 #status { margin: 0 0 1rem; min-height: 1.5em; }
45 #status { visibility: hidden; }
46 .js #status { visibility: visible; }
3347 footer { margin-top: 2rem; color: #8b877f; font-size: .875rem; }
34 footer a { display: inline; padding: 0; font-weight: inherit; text-decoration: underline; text-underline-offset: 2px; }
48 footer a { font-weight: inherit; text-decoration: underline; text-underline-offset: 2px; position: static; }
49 footer a::after { content: none; }
3550 </style>
3651 </head>
3752 <body>
3853 <main>
3954 <h1>Pixel Plays</h1>
4055 <p>Small browser games. Pick one.</p>
outdated

Free Throw is hold-and-release (its blurb says so), so this should be Hold, not Tap.

56 <form class="tools" method="get" action="./">
57 <input id="q" name="q" type="search" placeholder="Search games" aria-label="Search games" autocomplete="off">
58 <div id="kinds" role="group" aria-label="Filter by kind"></div>
59 </form>
60 <p id="status" role="status"></p>
4161 <ul id="games">
42 <li><a href="balote/">Balote</a><span>Bocce against a bot, first to 5</span></li>
43 <li><a href="stari-most/">Stari Most</a><span>Five dives off the old bridge, flip and enter the water vertically</span></li>
44 <li><a href="laundry/">Rooftop Laundry</a><span>Get the washing into the basket before the storm</span></li>
45 <li><a href="tie-break/">Tie-Break</a><span>Clay-court tie-break against a bot, the moment you hit decides where the ball lands</span></li>
46 <li><a href="mini-ramp/">Mini Ramp</a><span>60 seconds on a skateboard ramp, pump for height and grab in the air</span></li>
47 <li><a href="kite-hill/">Kite Hill</a><span>Keep a kite in the air through 60 seconds of gusts: pull to climb, let out line when the grass bends</span><span>Game forged by the crew</span></li>
48 <li><a href="stone-skip/">Stone Skip</a><span>Skim a flat stone across a lake, five throws, count the bounces</span><span>Game forged by the crew</span></li>
49 <li><a href="paper-route/">Paper Route</a><span>Ten newspapers thrown from a passing bike: porch 3, lawn 1, a window costs 2</span><span>Game forged by the crew</span></li>
50 <li><a href="pizza-toss/">Pizza Toss</a><span>Five tosses of pizza dough: hold to spin, catch it before it drops, too much spin tears it</span><span>Game forged by the crew</span></li>
51 <li><a href="harbour-crane/">Harbour Crane</a><span>Stack ten crates onto a bobbing fishing boat from a swinging crane hook</span><span>Game forged by the crew</span></li>
52 <li><a href="sled-run/">Sled Run</a><span>Ride a sledge down a snowy hill: tuck for speed, release on a kicker to jump, land flat</span><span>Game forged by the crew</span></li>
53 <li><a href="pottery-wheel/">Pottery Wheel</a><span>Shape a pot on a kick wheel: hold to centre the clay without collapsing it, then pull the wall as tall as you can before it tears</span><span>Game forged by the crew</span></li>
54 <li><a href="free-throw/">Free Throw</a><span>Ten shots on a rooftop court: hold to crouch and build power, release to jump, then shoot at the top of the jump</span><span>Game forged by the crew</span></li>
55 <li><a href="row-home/">Row Home</a><span>Race a rowing boat across the river against a bot: stroke in rhythm with the glide, too early catches a crab</span><span>Game forged by the crew</span></li>
56 <li><a href="orchard/">Orchard</a><span>Catch falling apples in a basket: ripe 1, golden 3, a wasp-bitten brown one costs a life</span><span>Game forged by the crew</span></li>
57 <li><a href="lighthouse/">Lighthouse</a><span>Sweep the lighthouse beam to turn boats away from the rocks: hold one in the light for a second, three wrecks end the night</span><span>Game forged by the crew</span></li>
58 <li><a href="window-washer/">Window Washer</a><span>Squeegee a grimy window clean before the cradle drops a floor: drag across it, bird droppings need two passes</span><span>Game forged by the crew</span></li>
59 <li><a href="market-scale/">Market Scale</a><span>Weigh fruit onto a hanging pan scale to match each order: exact scores 3, within 50 g scores 1</span><span>Game forged by the crew</span></li>
60 <li><a href="domino-run/">Domino Run</a><span>Set out a line of 20 dominoes along a chalk path and tip the first: a gap too wide stops the chain, too close topples one early, ring the bell for 10 plus 1 per domino left</span><span>Game forged by the crew</span></li>
62 <li data-kind="Throwing" data-input="Drag" style="--accent:#d9a441"><a href="balote/">Balote</a><span>Bocce against a bot, first to 5</span><span class="tags">Throwing · Drag</span></li>
63 <li data-kind="Timing" data-input="Hold" style="--accent:#3f8fb5"><a href="stari-most/">Stari Most</a><span>Five dives off the old bridge, flip and enter the water vertically</span><span class="tags">Timing · Hold</span></li>
64 <li data-kind="Catching" data-input="Drag" style="--accent:#c8604a"><a href="laundry/">Rooftop Laundry</a><span>Get the washing into the basket before the storm</span><span class="tags">Catching · Drag</span></li>
65 <li data-kind="Sport" data-input="Tap" style="--accent:#c9683a"><a href="tie-break/">Tie-Break</a><span>Clay-court tie-break against a bot, the moment you hit decides where the ball lands</span><span class="tags">Sport · Tap</span></li>
66 <li data-kind="Timing" data-input="Hold" style="--accent:#7a6bb0"><a href="mini-ramp/">Mini Ramp</a><span>60 seconds on a skateboard ramp, pump for height and grab in the air</span><span class="tags">Timing · Hold</span></li>
67 <li data-kind="Timing" data-input="Hold" style="--accent:#5aa05a"><a href="kite-hill/">Kite Hill</a><span>Keep a kite in the air through 60 seconds of gusts: pull to climb, let out line when the grass bends</span><span>Game forged by the crew</span><span class="tags">Timing · Hold</span></li>
68 <li data-kind="Throwing" data-input="Drag" style="--accent:#4a8aa8"><a href="stone-skip/">Stone Skip</a><span>Skim a flat stone across a lake, five throws, count the bounces</span><span>Game forged by the crew</span><span class="tags">Throwing · Drag</span></li>
69 <li data-kind="Throwing" data-input="Tap" style="--accent:#b8554a"><a href="paper-route/">Paper Route</a><span>Ten newspapers thrown from a passing bike: porch 3, lawn 1, a window costs 2</span><span>Game forged by the crew</span><span class="tags">Throwing · Tap</span></li>
outdated

This runs after the static list has painted, so the tools row appears late and pushes the grid down. Move it into <head>, and reserve the chips' height.

70 <li data-kind="Timing" data-input="Hold" style="--accent:#d4893a"><a href="pizza-toss/">Pizza Toss</a><span>Five tosses of pizza dough: hold to spin, catch it before it drops, too much spin tears it</span><span>Game forged by the crew</span><span class="tags">Timing · Hold</span></li>
71 <li data-kind="Precision" data-input="Tap" style="--accent:#4a6f9a"><a href="harbour-crane/">Harbour Crane</a><span>Stack ten crates onto a bobbing fishing boat from a swinging crane hook</span><span>Game forged by the crew</span><span class="tags">Precision · Tap</span></li>
72 <li data-kind="Timing" data-input="Hold" style="--accent:#8fb4cf"><a href="sled-run/">Sled Run</a><span>Ride a sledge down a snowy hill: tuck for speed, release on a kicker to jump, land flat</span><span>Game forged by the crew</span><span class="tags">Timing · Hold</span></li>
73 <li data-kind="Precision" data-input="Drag" style="--accent:#b0714f"><a href="pottery-wheel/">Pottery Wheel</a><span>Shape a pot on a kick wheel: hold to centre the clay without collapsing it, then pull the wall as tall as you can before it tears</span><span>Game forged by the crew</span><span class="tags">Precision · Drag</span></li>
74 <li data-kind="Sport" data-input="Hold" style="--accent:#d1722f"><a href="free-throw/">Free Throw</a><span>Ten shots on a rooftop court: hold to crouch and build power, release to jump, then shoot at the top of the jump</span><span>Game forged by the crew</span><span class="tags">Sport · Hold</span></li>
75 <li data-kind="Racing" data-input="Tap" style="--accent:#3a7d8c"><a href="row-home/">Row Home</a><span>Race a rowing boat across the river against a bot: stroke in rhythm with the glide, too early catches a crab</span><span>Game forged by the crew</span><span class="tags">Racing · Tap</span></li>
76 <li data-kind="Catching" data-input="Drag" style="--accent:#6a9a3c"><a href="orchard/">Orchard</a><span>Catch falling apples in a basket: ripe 1, golden 3, a wasp-bitten brown one costs a life</span><span>Game forged by the crew</span><span class="tags">Catching · Drag</span></li>
77 <li data-kind="Precision" data-input="Drag" style="--accent:#2f4a73"><a href="lighthouse/">Lighthouse</a><span>Sweep the lighthouse beam to turn boats away from the rocks: hold one in the light for a second, three wrecks end the night</span><span>Game forged by the crew</span><span class="tags">Precision · Drag</span></li>
78 <li data-kind="Precision" data-input="Drag" style="--accent:#5fa3c4"><a href="window-washer/">Window Washer</a><span>Squeegee a grimy window clean before the cradle drops a floor: drag across it, bird droppings need two passes</span><span>Game forged by the crew</span><span class="tags">Precision · Drag</span></li>
79 <li data-kind="Precision" data-input="Drag" style="--accent:#c4503f"><a href="market-scale/">Market Scale</a><span>Weigh fruit onto a hanging pan scale to match each order: exact scores 3, within 50 g scores 1</span><span>Game forged by the crew</span><span class="tags">Precision · Drag</span></li>
80 <li data-kind="Precision" data-input="Tap" style="--accent:#8a5ea8"><a href="domino-run/">Domino Run</a><span>Set out a line of 20 dominoes along a chalk path and tip the first: a gap too wide stops the chain, too close topples one early, ring the bell for 10 plus 1 per domino left</span><span>Game forged by the crew</span><span class="tags">Precision · Tap</span></li>
6181 </ul>
6282 <footer>Concept by <a href="https://x.com/awwbhi2">abhi</a>. Game by <a href="https://x.com/AmirMushich">AmirMushich</a>. Visual reference for the style: shawn.'s <a href="https://x.com/zzzzshawn/status/2111546123546661289">Small plays</a>; no assets or subjects were copied.<br><a href="stats/">Most played</a></footer>
6383 </main>
6484 <script src="shell.js"></script>
6585 <script>
66 // the list above works without scripts and must list the same games (serve.test.mjs checks); with scripts it is rebuilt from GAMES
86 // the list above works without scripts and must list the same games (serve.test.mjs checks); with scripts it is rebuilt from GAMES, with search and a kind filter
6787 (() => {
68 const ul = document.getElementById('games');
69 ul.replaceChildren(...PixelPlays.GAMES.filter(g => !g.soon).map(g => {
70 const li = document.createElement('li'), a = document.createElement('a'), d = document.createElement('span');
88 const ul = document.getElementById('games'), q = document.getElementById('q'), kinds = document.getElementById('kinds');
89 const status = document.getElementById('status');
90 let { query, kind } = PixelPlays.parseBrowse(location.search);
91 q.value = query;
92 const card = g => {
93 const li = document.createElement('li'), a = document.createElement('a'), d = document.createElement('span'), t = document.createElement('span');
94 li.style.setProperty('--accent', g.accent);
7195 a.href = g.id + '/'; a.textContent = g.title; d.textContent = g.blurb;
72 li.append(a, d);
96 t.className = 'tags'; t.textContent = g.kind + ' · ' + g.input;
97 li.append(a, d, t);
7398 if (g.forged) {
7499 const n = document.createElement('span');
75100 n.textContent = PixelPlays.FORGED_NOTE;
76101 li.append(n);
77102 }
78103 return li;
79 }));
104 };
105 const render = () => {
106 query = q.value;
107 const found = PixelPlays.filterGames(PixelPlays.GAMES, { query, kind });
108 ul.replaceChildren(...found.map(card));
109 status.textContent = found.length ? found.length + (found.length === 1 ? ' game' : ' games') : 'No game matches.';
110 history.replaceState(null, '', PixelPlays.browseUrl({ query, kind }));
111 for (const b of kinds.children) b.setAttribute('aria-pressed', String(b.dataset.kind === kind));
112 };
113 for (const k of ['', ...PixelPlays.kindsOf(PixelPlays.GAMES)]) {
114 const b = document.createElement('button');
115 b.type = 'button'; b.name = 'kind'; b.value = k; b.dataset.kind = k; b.textContent = k || 'All';
116 b.addEventListener('click', () => { kind = k; render(); });
117 kinds.append(b);
118 }
119 kinds.addEventListener('click', e => { if (e.target.closest('button')) e.preventDefault(); });
120 q.addEventListener('input', render);
121 document.querySelector('.tools').addEventListener('submit', e => { e.preventDefault(); render(); });
122 render();
80123 })();
81124 </script>
82125 </body>
serve.test.mjs +73
@@ -258,3 +258,76 @@ test('a client that posts too often gets 429', async () => {
258258 for (let i = 0; i < 70 && last !== 429; i++) last = (await post({ game: 'orchard', event: 'open' })).status;
259259 expect(last).toBe(429);
260260 });
261
262
263 test('every game has a kind, input and accent, and the static list carries them', async () => {
264 const html = await (await fetch(base + '/')).text();
265 globalThis.window = globalThis;
266 let games;
267 try {
268 await import('./shell.js?browse');
269 games = window.PixelPlays.GAMES.filter(g => !g.soon);
270 } finally {
271 delete globalThis.window;
272 delete globalThis.PixelPlays;
273 }
274 for (const g of games) {
275 expect(['Sport', 'Throwing', 'Timing', 'Catching', 'Precision', 'Racing']).toContain(g.kind);
276 expect(['Tap', 'Hold', 'Drag']).toContain(g.input);
277 expect(g.accent).toMatch(/^#[0-9a-f]{6}$/i);
278 expect(html).toContain(`<li data-kind="${g.kind}" data-input="${g.input}" style="--accent:${g.accent}"><a href="${g.id}/">`);
279 expect(html).toContain(`<span class="tags">${g.kind} · ${g.input}</span>`);
280 }
281 expect(html).toContain('id="q"');
282 });
283
284 test('filterGames narrows by search words and by kind', async () => {
285 globalThis.window = globalThis;
286 let P;
287 try {
288 await import('./shell.js?filter');
289 P = window.PixelPlays;
290 } finally {
291 delete globalThis.window;
292 delete globalThis.PixelPlays;
293 }
294 const all = P.GAMES.filter(g => !g.soon);
295 expect(P.filterGames(P.GAMES).length).toBe(all.length);
296 expect(P.filterGames(P.GAMES, { query: ' DOMINO ' }).map(g => g.id)).toEqual(['domino-run']);
297 expect(P.filterGames(P.GAMES, { query: 'bocce bot' }).map(g => g.id)).toEqual(['balote']);
298 expect(P.filterGames(P.GAMES, { query: 'zzzz' })).toEqual([]);
299 const catching = P.filterGames(P.GAMES, { kind: 'Catching' });
300 expect(catching.length).toBeGreaterThan(0);
301 expect(catching.every(g => g.kind === 'Catching')).toBe(true);
302 expect(P.filterGames(P.GAMES, { kind: 'Catching', query: 'apples' }).map(g => g.id)).toEqual(['orchard']);
303 expect(P.kindsOf(P.GAMES)).toContain('Precision');
304 });
305
306 test('parseBrowse reads q and kind from the address and drops what is unknown', async () => {
307 globalThis.window = globalThis;
308 let P;
309 try {
310 await import('./shell.js?parse');
311 P = window.PixelPlays;
312 } finally {
313 delete globalThis.window;
314 delete globalThis.PixelPlays;
315 }
316 expect(P.parseBrowse('?kind=Precision')).toEqual({ query: '', kind: 'Precision' });
317 expect(P.parseBrowse('?q=%20apple%20&kind=Catching')).toEqual({ query: 'apple', kind: 'Catching' });
318 expect(P.parseBrowse('?kind=Precison&q=x')).toEqual({ query: 'x', kind: '' });
319 expect(P.parseBrowse('')).toEqual({ query: '', kind: '' });
320 expect(P.parseBrowse('?q=' + 'a'.repeat(200)).query.length).toBe(80);
321 const view = P.parseBrowse('?kind=Precision');
322 expect(P.filterGames(P.GAMES, view).every(g => g.kind === 'Precision')).toBe(true);
323 expect(P.filterGames(P.GAMES, view).length).toBeGreaterThan(0);
324 });
325
326 test('the home page sets the js class in the head, uses a get form and one status line', async () => {
327 const html = await (await fetch(base + '/')).text();
328 const head = html.slice(0, html.indexOf('</head>'));
329 expect(head).toContain("classList.add('js')");
330 expect(html).toContain('<form class="tools" method="get"');
331 expect(html).toContain('role="status"');
332 expect(html).not.toContain('aria-live');
333 });
shell.js +41 −21
@@ -1,27 +1,27 @@
11 'use strict';
22 // Shared chrome for every game: game menu (top centre) and rules popup (top right).
33 window.PixelPlays = (() => {
4 // add a game here and give it a folder and a one-line `blurb` (the home page lists it from here) (`music: false` when it has no track, `forged: true` when it was made on the forge rather than by the original creators); `soon` entries show in the menu but do not link
4 // add a game here and give it a folder, a one-line `blurb`, a `kind` (Sport, Throwing, Timing, Catching, Precision, Racing), an `input` (Tap, Hold, Drag) and an `accent` colour for its card (the home page lists it from here) (`music: false` when it has no track, `forged: true` when it was made on the forge rather than by the original creators); `soon` entries show in the menu but do not link
55 const GAMES = [
6 { id: 'balote', title: 'Balote', blurb: 'Bocce against a bot, first to 5' },
7 { id: 'stari-most', title: 'Stari Most', blurb: 'Five dives off the old bridge, flip and enter the water vertically' },
8 { id: 'laundry', title: 'Rooftop Laundry', blurb: 'Get the washing into the basket before the storm' },
9 { id: 'tie-break', title: 'Tie-Break', blurb: 'Clay-court tie-break against a bot, the moment you hit decides where the ball lands' },
10 { id: 'mini-ramp', title: 'Mini Ramp', blurb: '60 seconds on a skateboard ramp, pump for height and grab in the air' },
11 { id: 'kite-hill', title: 'Kite Hill', blurb: 'Keep a kite in the air through 60 seconds of gusts: pull to climb, let out line when the grass bends', music: false, forged: true },
12 { id: 'stone-skip', title: 'Stone Skip', blurb: 'Skim a flat stone across a lake, five throws, count the bounces', music: false, forged: true },
13 { id: 'paper-route', title: 'Paper Route', blurb: 'Ten newspapers thrown from a passing bike: porch 3, lawn 1, a window costs 2', music: false, forged: true },
14 { id: 'pizza-toss', title: 'Pizza Toss', blurb: 'Five tosses of pizza dough: hold to spin, catch it before it drops, too much spin tears it', music: false, forged: true },
15 { id: 'harbour-crane', title: 'Harbour Crane', blurb: 'Stack ten crates onto a bobbing fishing boat from a swinging crane hook', music: false, forged: true },
16 { id: 'sled-run', title: 'Sled Run', blurb: 'Ride a sledge down a snowy hill: tuck for speed, release on a kicker to jump, land flat', music: false, forged: true },
17 { id: 'pottery-wheel', title: 'Pottery Wheel', blurb: 'Shape a pot on a kick wheel: hold to centre the clay without collapsing it, then pull the wall as tall as you can before it tears', music: false, forged: true },
18 { id: 'free-throw', title: 'Free Throw', blurb: 'Ten shots on a rooftop court: hold to crouch and build power, release to jump, then shoot at the top of the jump', music: false, forged: true },
19 { id: 'row-home', title: 'Row Home', blurb: 'Race a rowing boat across the river against a bot: stroke in rhythm with the glide, too early catches a crab', music: false, forged: true },
20 { id: 'orchard', title: 'Orchard', blurb: 'Catch falling apples in a basket: ripe 1, golden 3, a wasp-bitten brown one costs a life', music: false, forged: true },
21 { id: 'lighthouse', title: 'Lighthouse', blurb: 'Sweep the lighthouse beam to turn boats away from the rocks: hold one in the light for a second, three wrecks end the night', music: false, forged: true },
22 { id: 'window-washer', title: 'Window Washer', blurb: 'Squeegee a grimy window clean before the cradle drops a floor: drag across it, bird droppings need two passes', music: false, forged: true },
23 { id: 'market-scale', title: 'Market Scale', blurb: 'Weigh fruit onto a hanging pan scale to match each order: exact scores 3, within 50 g scores 1', music: false, forged: true },
24 { id: 'domino-run', title: 'Domino Run', blurb: 'Set out a line of 20 dominoes along a chalk path and tip the first: a gap too wide stops the chain, too close topples one early, ring the bell for 10 plus 1 per domino left', music: false, forged: true },
6 { id: 'balote', title: 'Balote', blurb: 'Bocce against a bot, first to 5', kind: 'Throwing', input: 'Drag', accent: '#d9a441' },
7 { id: 'stari-most', title: 'Stari Most', blurb: 'Five dives off the old bridge, flip and enter the water vertically', kind: 'Timing', input: 'Hold', accent: '#3f8fb5' },
8 { id: 'laundry', title: 'Rooftop Laundry', blurb: 'Get the washing into the basket before the storm', kind: 'Catching', input: 'Drag', accent: '#c8604a' },
9 { id: 'tie-break', title: 'Tie-Break', blurb: 'Clay-court tie-break against a bot, the moment you hit decides where the ball lands', kind: 'Sport', input: 'Tap', accent: '#c9683a' },
10 { id: 'mini-ramp', title: 'Mini Ramp', blurb: '60 seconds on a skateboard ramp, pump for height and grab in the air', kind: 'Timing', input: 'Hold', accent: '#7a6bb0' },
11 { id: 'kite-hill', title: 'Kite Hill', blurb: 'Keep a kite in the air through 60 seconds of gusts: pull to climb, let out line when the grass bends', kind: 'Timing', input: 'Hold', accent: '#5aa05a', music: false, forged: true },
12 { id: 'stone-skip', title: 'Stone Skip', blurb: 'Skim a flat stone across a lake, five throws, count the bounces', kind: 'Throwing', input: 'Drag', accent: '#4a8aa8', music: false, forged: true },
13 { id: 'paper-route', title: 'Paper Route', blurb: 'Ten newspapers thrown from a passing bike: porch 3, lawn 1, a window costs 2', kind: 'Throwing', input: 'Tap', accent: '#b8554a', music: false, forged: true },
14 { id: 'pizza-toss', title: 'Pizza Toss', blurb: 'Five tosses of pizza dough: hold to spin, catch it before it drops, too much spin tears it', kind: 'Timing', input: 'Hold', accent: '#d4893a', music: false, forged: true },
15 { id: 'harbour-crane', title: 'Harbour Crane', blurb: 'Stack ten crates onto a bobbing fishing boat from a swinging crane hook', kind: 'Precision', input: 'Tap', accent: '#4a6f9a', music: false, forged: true },
16 { id: 'sled-run', title: 'Sled Run', blurb: 'Ride a sledge down a snowy hill: tuck for speed, release on a kicker to jump, land flat', kind: 'Timing', input: 'Hold', accent: '#8fb4cf', music: false, forged: true },
17 { id: 'pottery-wheel', title: 'Pottery Wheel', blurb: 'Shape a pot on a kick wheel: hold to centre the clay without collapsing it, then pull the wall as tall as you can before it tears', kind: 'Precision', input: 'Drag', accent: '#b0714f', music: false, forged: true },
18 { id: 'free-throw', title: 'Free Throw', blurb: 'Ten shots on a rooftop court: hold to crouch and build power, release to jump, then shoot at the top of the jump', kind: 'Sport', input: 'Hold', accent: '#d1722f', music: false, forged: true },
outdated

input: 'Hold'. The game uses pointerdown/pointerup to crouch and release.

19 { id: 'row-home', title: 'Row Home', blurb: 'Race a rowing boat across the river against a bot: stroke in rhythm with the glide, too early catches a crab', kind: 'Racing', input: 'Tap', accent: '#3a7d8c', music: false, forged: true },
20 { id: 'orchard', title: 'Orchard', blurb: 'Catch falling apples in a basket: ripe 1, golden 3, a wasp-bitten brown one costs a life', kind: 'Catching', input: 'Drag', accent: '#6a9a3c', music: false, forged: true },
21 { id: 'lighthouse', title: 'Lighthouse', blurb: 'Sweep the lighthouse beam to turn boats away from the rocks: hold one in the light for a second, three wrecks end the night', kind: 'Precision', input: 'Drag', accent: '#2f4a73', music: false, forged: true },
22 { id: 'window-washer', title: 'Window Washer', blurb: 'Squeegee a grimy window clean before the cradle drops a floor: drag across it, bird droppings need two passes', kind: 'Precision', input: 'Drag', accent: '#5fa3c4', music: false, forged: true },
23 { id: 'market-scale', title: 'Market Scale', blurb: 'Weigh fruit onto a hanging pan scale to match each order: exact scores 3, within 50 g scores 1', kind: 'Precision', input: 'Drag', accent: '#c4503f', music: false, forged: true },
24 { id: 'domino-run', title: 'Domino Run', blurb: 'Set out a line of 20 dominoes along a chalk path and tip the first: a gap too wide stops the chain, too close topples one early, ring the bell for 10 plus 1 per domino left', kind: 'Precision', input: 'Tap', accent: '#8a5ea8', music: false, forged: true },
2525 ];
2626 const MUSIC_VOLUME = .4;
2727 const CREDITS = [
@@ -195,5 +195,25 @@ window.PixelPlays = (() => {
195195 });
196196 PixelPlays.music = music;
197197 }
198 return { mount, GAMES, FORGED_NOTE };
198 // the games a visitor's search words and kind choice leave: every word must appear in the title, blurb, kind or input
199 function filterGames(games, { query = '', kind = '' } = {}) {
200 const words = String(query).toLowerCase().split(/\s+/).filter(Boolean);
201 return games.filter(g => !g.soon && (!kind || g.kind === kind) && words.every(w => [g.title, g.blurb, g.kind, g.input].join(' ').toLowerCase().includes(w)));
202 }
203 // `?q=...&kind=...` from the address bar: a kind not in GAMES is dropped and the query is trimmed to 80 characters
204 function parseBrowse(search, games = GAMES) {
205 const p = new URLSearchParams(String(search));
206 const kind = p.get('kind') || '';
207 return { query: (p.get('q') || '').trim().slice(0, 80), kind: kindsOf(games).includes(kind) ? kind : '' };
208 }
209 // the address that reproduces a view; the bare path when nothing is chosen
210 function browseUrl({ query = '', kind = '' }) {
211 const p = new URLSearchParams();
212 if (query.trim()) p.set('q', query.trim().slice(0, 80));
213 if (kind) p.set('kind', kind);
214 const s = p.toString();
215 return s ? '?' + s : location.pathname;
216 }
217 const kindsOf = games => [...new Set(games.filter(g => !g.soon).map(g => g.kind))];
218 return { mount, GAMES, FORGED_NOTE, filterGames, kindsOf, parseBrowse, browseUrl };
199219 })();

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs