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

Migrated from github.com/amirmushichge/pixel-plays

Add Carousel: the playable page and its place in the catalogue, on the rules in `carousel/ride.js` #212

Parked opened this
Closed without merging

quill/pixel-plays:quill/188-add-carousel-the-playable-page-and-its-p → main 1 commit fork

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
8 files changed +329 −2
README.md +3 −2
@@ -57,6 +57,7 @@ Concept by [abhi](https://x.com/awwbhi2). Game by [AmirMushich](https://x.com/Am
5757 | [Allotment](allotment/) | A five by five garden of raised beds with a bench holding the next seed packet: tap a bed to plant the packet there (or arrow keys to move and Space to plant); twelve packets in a season and every crop scores 1 plus its own rule for each touching bed (up, down, left, right): beans +3 per sweetcorn, sweetcorn -1 per sweetcorn, carrots -2 per onion, onion +2 per lettuce, lettuce +2 per carrots; 28 points by the last packet wins, against the best layout the rules could find (a seeded hand of eight seasons; forged by the crew on the engine and shell above, not by the original creators; rules in `allotment/plot.js`) | Tap a bed; arrows + Space |
5858 | [Shunting Yard](shunting-yard/) | A railway yard seen from above: a mixed-up train of numbered wagons waits on the arrival track, two sidings hold 3 wagons each, and the departure track takes the wagons only in order 1, 2, 3...; lift the end wagon of a track and set it down on another (nothing goes back to the arrival track), five levels of 3 to 7 wagons, each with a move target (5, 7, 9, 11, 13) that every yard solves within, and the game is won when all five are cleared within the targets' total; every wagon wears its number on a plate, so order never rests on colour (forged by the crew on the engine and shell above, not by the original creators; rules in `shunting-yard/yard.js`) | Tap a track to lift its end wagon, tap another to set it down; 1-4 pick the tracks, arrows move a ring, Space lifts or sets down |
5959 | [Ferris Wheel](ferris-wheel/) | A fairground Ferris wheel of 8 gondolas, 3 seats each, with a platform at the bottom and a queue of 20 riders of different weights and ride lengths: tap Board (or the canvas, or press B, Space or Enter) to seat the front rider in the gondola at the platform, or Skip (or S) to send them to the back of the queue, once each; the wheel steps one gondola on a steady beat, 24 steps in all, and riders step off when their ride is done; a balance needle under the hub shows the imbalance (weight times its lever arm about the hub, summed over every rider) with the jam limit marked as a line, and the wheel jams if it passes it; carry 12 riders without a jam to win, the HUD showing riders carried, steps left and the imbalance; rider weights read by size as well as colour (green, amber, red), the front rider's weight is on a plate, and the fairground lights blink (stopped under reduced motion) (forged by the crew on the engine and shell above, not by the original creators; rules in `ferris-wheel/wheel.js`) | Tap Board or Skip; B boards, S skips |
60 | [Carousel](carousel/) | A fairground carousel of eight horses rising and falling under a canopy of blinking lights, a rider on one and a ring dispenser at the front showing the next three rings (round brass, square iron): tap anywhere or press Space to grab as the rider passes the dispenser, once a turn; a grab inside the marked arc of the platform (20 degrees either side) takes the front ring, iron 1 point, brass 3, brass at the red centre mark (4 degrees) 5, and outside it is a miss; a ring nobody takes goes by, each of the 10 turns is faster than the last, and 14 points wins (forged by the crew on the engine and shell above, not by the original creators; rules in `carousel/ride.js`) | Tap; Space |
6061 | [Empire Age](empire/) | A real-time strategy game on a 44 by 44 map against a red bot (easy, normal or hard): four villagers and a town center each, gather food, wood, gold and stone, build houses, camps, farms and military buildings, climb the Dark, Feudal, Castle and Imperial Ages, research upgrades, train militia, spearmen, archers, knights and rams, and destroy every town center and castle of the enemy; fog of war, a minimap, attack alerts, pause, 1x/2x/4x speed, an autopilot, a save that survives a reload and a best time per level (forged by the crew on the engine and shell above, not by the original creators) | Tap or drag a box to select, tap to command, panel buttons to build and train; arrows move the view, Enter taps its centre cross, 1-9 press buttons |
6162 | [Hot Air Balloon](hot-air-balloon/) | Five flights over patchwork farm fields with hedgerows, a windsock and one field marked with a white cross: hold the burner and the balloon climbs slowly after a short lag, let go and it sinks; the air has three height bands that each blow their own way and a little differently each flight, shown by drifting cloud wisps, three arrows at the left and a pennant on the basket, so you steer only by choosing a height (the ready screen before each flight already shows that flight's winds, so read them first); touching the ground ends the flight and the landing scores by distance from the cross (on it 5, inside its field 3, a neighbouring field 1, trees or the pond 0), each flight from a new launch point; 15 or more of 25 wins; the balloon's shadow on the fields shows where it is over (forged by the crew on the engine and shell above, not by the original creators) | Press and hold the canvas; hold space or the up arrow |
6263 | [Go-Kart Fete](go-kart/) | Three races of three laps round a village track against three rivals: hold to drive, let go to brake, and a yellow board before each bend shows the fastest speed to enter it at; go in faster and you sit a second in the hay bales; first scores 3, second 2, third 1, and 6 points wins (forged by the crew on the engine and shell above, not by the original creators) | Hold; space |
@@ -83,7 +84,7 @@ On the forge, `forge.json` runs `bun serve.mjs` with health check `/`. State is
8384 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.
8485
8586 ## Add a game
86 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, Domino Run, Campfire, Beekeeper, Bread Oven, Ice Fishing, Tightrope, Tram Line, Archery, Bell Tower, Espresso Bar, Goalkeeper, Wood Split, Signal Box, Soapbox Derby, Sheepdog, Firefly Jar, Hot Air Balloon, Cloakroom, Go-Kart Fete, Empire Age, Egg Basket, Dinghy Race, Coconut Shy, Bowls Green, Seed Packets, Hoopla Stall, Lock Keeper, Ferryman, Tower Duel, Sandcastle Tide, Hedge Maze, Allotment, Lily Pond, Market Barrow, Shunting Yard and Ferris Wheel 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`.
87 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, Domino Run, Campfire, Beekeeper, Bread Oven, Ice Fishing, Tightrope, Tram Line, Archery, Bell Tower, Espresso Bar, Goalkeeper, Wood Split, Signal Box, Soapbox Derby, Sheepdog, Firefly Jar, Hot Air Balloon, Cloakroom, Go-Kart Fete, Empire Age, Egg Basket, Dinghy Race, Coconut Shy, Bowls Green, Seed Packets, Hoopla Stall, Lock Keeper, Ferryman, Tower Duel, Sandcastle Tide, Hedge Maze, Allotment, Lily Pond, Market Barrow, Shunting Yard, Ferris Wheel and Carousel 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`.
8788
8889 - `town.js` is the town's layout, pure data with no drawing: `window.PixelTown.layout(GAMES)` gives one isometric building per game (plot, screen position under the fixed 30-degree camera, accent, id) with trees in the spare plots, and `pick(town, x, y, filter)` gives the id of the front-most building under a screen point, or null. Nothing loads it yet; the drawing and the page are the second half of #99.
8990 - `shell.js` provides the game menu, the Rules popup, the credits and the background music. The menu lists the games grouped under their kind (the not-yet-made ones last, under Soon) and scrolls within the screen; type in its find box to narrow it by a word of the title, kind, input or blurb (keys typed there never reach the game), and press Escape to close it.
@@ -100,7 +101,7 @@ Create `<id>/index.html`, load `../shell.js`, call `PixelPlays.mount({ id, rules
100101 - Depth-buffer edges: darker where an object sits in front, a warm rim on upper-left edges.
101102 - Large flat surfaces use closely spaced tones; wide steps make the dither read as a checkerboard.
102103 - Characters stay sharp: flat bands with no dither, a dark silhouette on their own pixels, patterns at least 3px wide.
103 - Ambient motion only where the scene names it: grass and leaves sway in whole pixels at 8 fps, Tram Line's waiting passengers shift their weight, Espresso Bar's machine steam and awning fringe move, Sheepdog's crow on the wall shifts and dips its head, Hot Air Balloon's windsock and cloud wisps drift, Cloakroom's coats sway and the light under its door moves, Go-Kart Fete's chequered flags flutter and its spectators wave, Egg Basket's hens peck and the straw in its basket stirs (its rolling eggs are play, not ambience, and still move), Ferris Wheel's fairground lights blink, and Dinghy Race's water ripples come and go and its start-line flags flutter (the boats are play, and still sail), and Coconut Shy's bunting flutters and its stallholder shifts and waves (the thrown ball and wobbling coconuts are play, and still move), and Bowls Green's hedge leaves stir and a cloud shadow drifts across its green (the rolling woods are play, and still move), and Seed Packets' wall clock ticks its second hand and its watering can drips, and Hoopla Stall's bunting flutters (the tossed ring is play, and still moves), and Lock Keeper's water surface ripples (the boats, gates and rising water are play, and still move), and Ferryman's river ripples (the ferry and its passengers are play, and still move), and Tower Duel's river ripples shift and the king towers' pennants stir (the troops and the fireball are play, and still move), and Hedge Maze's fountain splashes (the walker is play, and still moves), and Allotment's planted crops sway (the planting is play), and Lily Pond's water glints shift (the frog, the sinking pads and their ripples are play, and still move), Market Barrow's stall awnings flutter (the barrow is play, and still moves) and Shunting Yard's engine puffs steam (the wagons are play, and still move); all of it stops under `prefers-reduced-motion`.
104 - Ambient motion only where the scene names it: grass and leaves sway in whole pixels at 8 fps, Tram Line's waiting passengers shift their weight, Espresso Bar's machine steam and awning fringe move, Sheepdog's crow on the wall shifts and dips its head, Hot Air Balloon's windsock and cloud wisps drift, Cloakroom's coats sway and the light under its door moves, Go-Kart Fete's chequered flags flutter and its spectators wave, Egg Basket's hens peck and the straw in its basket stirs (its rolling eggs are play, not ambience, and still move), Ferris Wheel's fairground lights blink, Carousel's canopy lights blink, and Dinghy Race's water ripples come and go and its start-line flags flutter (the boats are play, and still sail), and Coconut Shy's bunting flutters and its stallholder shifts and waves (the thrown ball and wobbling coconuts are play, and still move), and Bowls Green's hedge leaves stir and a cloud shadow drifts across its green (the rolling woods are play, and still move), and Seed Packets' wall clock ticks its second hand and its watering can drips, and Hoopla Stall's bunting flutters (the tossed ring is play, and still moves), and Lock Keeper's water surface ripples (the boats, gates and rising water are play, and still move), and Ferryman's river ripples (the ferry and its passengers are play, and still move), and Tower Duel's river ripples shift and the king towers' pennants stir (the troops and the fireball are play, and still move), and Hedge Maze's fountain splashes (the walker is play, and still moves), and Allotment's planted crops sway (the planting is play), and Lily Pond's water glints shift (the frog, the sinking pads and their ripples are play, and still move), Market Barrow's stall awnings flutter (the barrow is play, and still moves) and Shunting Yard's engine puffs steam (the wagons are play, and still move); all of it stops under `prefers-reduced-motion`.
104105
105106 ## Empire Age
106107
index.html +1
@@ -117,6 +117,7 @@ footer a::after { content: none; }
117117 <li data-kind="Puzzle" data-input="Keys" style="--accent:#2f7a6a"><a href="lily-pond/">Lily Pond</a><span>Hop the frog onto every lily pad once before they sink</span><span>Game forged by the crew</span><span class="tags">Puzzle · Keys</span></li>
118118 <li data-kind="Puzzle" data-input="Tap" style="--accent:#8a4b2f"><a href="shunting-yard/">Shunting Yard</a><span>Shunt the wagons through the sidings until the train leaves in order</span><span>Game forged by the crew</span><span class="tags">Puzzle · Tap</span></li>
119119 <li data-kind="Strategy" data-input="Tap" style="--accent:#b8475a"><a href="ferris-wheel/">Ferris Wheel</a><span>Seat the queue without tipping the wheel</span><span>Game forged by the crew</span><span class="tags">Strategy · Tap</span></li>
120 <li data-kind="Timing" data-input="Tap" style="--accent:#c4893a"><a href="carousel/">Carousel</a><span>Ride the horses and snatch the brass ring as you pass the dispenser</span><span>Game forged by the crew</span><span class="tags">Timing · Tap</span></li>
120121 <li data-kind="Puzzle" data-input="Keys" style="--accent:#3d6e4f"><a href="hedge-maze/">Hedge Maze</a><span>Find the way through the hedges to the fountain before the gardener rings the bell</span><span>Game forged by the crew</span><span class="tags">Puzzle · Keys</span></li>
121122 </ul>
122123 <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>
og/home.png
Binary file not shown.
rounds.mjs +6
@@ -159,6 +159,12 @@ export const ROUNDS = {
159159 if (g.read('P.status') === 'playing') for (const k of keys) g.press(k);
160160 while (g.read('P.step') === at && g.read('P.status') === 'playing') g.run(.2);
161161 } },
162 // grab whenever the rider is within a few degrees of the dispenser, one frame at a time, then wait for the next turn
163 'carousel': { over: /play again/, outcome: /Ride over: \d+ rings, \d+ points, a win/, beat: g => {
164 const [angle, spent, status] = g.read('[P.angle, P.spent, P.status]');
165 if (status === 'playing' && !spent && Math.abs(angle - 180) <= 6) g.tap(...MID);
166 g.run(.04);
167 } },
162168 // hop along the route the rules planned for this pond, one arrow key per pad
163169 'lily-pond': { over: /play again/, outcome: /Pond cleared: 6 levels, \d+ retries?/, beat: g => {
164170 const [a, b] = g.read('[P.route[P.hops], P.route[P.hops + 1]]');
serve.test.mjs +7
@@ -549,6 +549,13 @@ test('Ferris Wheel and its rules script are served without a track', async () =>
549549 expect((await fetch(base + '/ferris-wheel/wheel.js')).status).toBe(200);
550550 });
551551
552 test('Carousel and its rules script are served without a track', async () => {
553 const page = await fetch(base + '/carousel/');
554 expect(page.status).toBe(200);
555 expect(page.headers.get('content-type')).toBe('text/html; charset=utf-8');
556 expect((await fetch(base + '/carousel/ride.js')).status).toBe(200);
557 });
558
552559 test('Hedge Maze and its rules script are served without a track', async () => {
553560 const page = await fetch(base + '/hedge-maze/');
554561 expect(page.status).toBe(200);
shell.js +1
@@ -57,6 +57,7 @@ window.PixelPlays = (() => {
5757 { id: 'lily-pond', title: 'Lily Pond', blurb: 'Hop the frog onto every lily pad once before they sink', kind: 'Puzzle', input: 'Keys', accent: '#2f7a6a', music: false, forged: true },
5858 { id: 'shunting-yard', title: 'Shunting Yard', blurb: 'Shunt the wagons through the sidings until the train leaves in order', kind: 'Puzzle', input: 'Tap', accent: '#8a4b2f', music: false, forged: true },
5959 { id: 'ferris-wheel', title: 'Ferris Wheel', blurb: 'Seat the queue without tipping the wheel', kind: 'Strategy', input: 'Tap', accent: '#b8475a', music: false, forged: true },
60 { id: 'carousel', title: 'Carousel', blurb: 'Ride the horses and snatch the brass ring as you pass the dispenser', kind: 'Timing', input: 'Tap', accent: '#c4893a', music: false, forged: true },
6061 { id: 'hedge-maze', title: 'Hedge Maze', blurb: 'Find the way through the hedges to the fountain before the gardener rings the bell', kind: 'Puzzle', input: 'Keys', accent: '#3d6e4f', music: false, forged: true },
6162 ];
6263 const MUSIC_VOLUME = .4;

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs