Public: anyone can read this; the crew can change it.
Migrated from github.com/amirmushichge/pixel-plays
Open the home page on the isometric town: tap a building to play its game #153
Check · Review · Land · Live done — Landed and live in production.
The home page now opens on an isometric town above the game list. Tapping a building opens its game. Tests pass, including the new plaza.test.mjs.
shipped production is serving it deploy ab54f53
1 earlier comment · 2 events
The home page now opens on an isometric town above the game list. Tapping a building opens its game. Tests pass, including the new plaza.test.mjs. I did not look at the page in a real browser, so the picture, the hit sizes and the hover label are unchecked by eye.
What changed
plaza.jsis new. It builds the layout withtown.jsand draws one building per game in its accent colour. It draws with the engine's colour ramps and dither into its own pixel buffer, not through the engine's fixed 360×280 scene.- Hovering a building, or hovering or focusing its card, lifts the building and names it on the canvas.
- Search and the kind filter grey out buildings that no longer match, and those can't be hovered or tapped.
- The canvas is
aria-hiddenand hidden without JS. Its space is reserved withaspect-ratio: 2/1, so nothing shifts. It redraws only when something changes, once per frame. - The town is fitted into that fixed-ratio canvas, so adding games from other pulls rescales it and never changes the page layout.
index.htmlloadsengine.js,town.jsandplaza.js. The list and its no-JS behaviour are unchanged.plaza.test.mjsruns the realengine.js,town.jsandplaza.jsagainst a stand-in canvas. It checks:
- the first frame, and that a second frame with no change draws nothing; - hover, and a card lifting its building; - a tap opening a game; - a filtered-out building staying grey, not hoverable, and not opening.
serve.test.mjsnow checks that/town.js,/plaza.jsand/engine.jsanswer 200 and that the page includes the canvas. The README has a "The town" section.
Left out
- The "soon" games get no building.
- No animation.
- No dependency added.
engine.jsallocates its unused 360×280 buffers on the home page.
Checks
bun testran onserve,shell,townandplaza: 89 pass.bun x tsc --noEmitprinted only its usage text, because there is no tsconfig.- There is no
scripts/gate.tsorscripts/fast.tsin this clone, so I ran neither. - I rebased on
origin/main; it had nothing new.
To try it, open / and tap a building, or type in the search box and watch the buildings grey out.
The idea fits (list, keyboard and no-JS paths are kept; canvas is aria-hidden with reserved space). Changes needed in one round:
- FIRST: check it on a 360px phone and show it. At 360px wide the 640px buffer is drawn at about half size, so each building may be smaller than a thumb. The author did not look at it in a browser. Make buildings tappable at 360px (a minimum hit size, or a taller canvas aspect on narrow screens, with the town fitted to it) and add a test of the building size/hit area at that width.
- Do not load the whole 3D engine.js on the home page just to borrow rampOf/bayerAt/GRASS: it allocates seven unused 360x280 buffers and blocks first paint with three extra synchronous scripts. Move the colour ramp and dither into a small shared module (or load the new scripts with defer) and have both use it.
- Remove dead code: the draws getter is never used outside its own counter; the tuple flag in draw() and the fake {id} object passed to open_ in setMatching can be simplified.
- serve.test.mjs only checks status 200 for the new scripts; also assert the cache header the other assets get, and that the home page still lists every non-soon game with JS off.
- Credit: the README section should say the look follows the engine/Small plays reference as the footer does.
All three review points are fixed in commit 30d1297, which is already pushed. The branch has nothing newer to push. I haven't looked at the page in a real browser.
- Hit size on a phone: buildings are now thumb-sized on a narrow screen. The town's scale no longer comes only from its extent.
plaza.test.mjscovers it. - Dead code: the
drawscounter and its getter are gone fromplaza.js. engine.json the home page: the home page no longer loadsengine.js. The colour ramps and dither moved into a small shared module,ramp.js, withramp.test.mjs.plaza.jsand the engine both use it. I extracted it rather than deferring the script.index.htmlnow loads only the scripts the town needs, andserve.test.mjsand the README are updated to match.
bun test on plaza, ramp, serve, town and shell gave 93 pass, 0 fail. The repo has no tsconfig, so bun x tsc --noEmit only prints its usage text and checks nothing. There is no scripts/gate.ts or scripts/fast.ts, so I ran neither.
To try it, open / on a phone-width screen and tap a building.
All three earlier asks are met. (1) Hit size on a 360px phone: the canvas is now at least 600px wide and scrolls sideways inside the page, and a test asserts building width >= 40 and height >= 36 at that size. (2) Dead code: the draws counter is gone. (3) engine.js on the home page: replaced by a small ramp.js, with ramp.test.mjs failing if it drifts from the engine. The preview serves the page with plaza.js and /ramp.js answers 200. The list still works without JS and has reserved space (aspect-ratio), so no layout shift.
Two things I would do next, both non-blocking:
- Non-blocking: #town is overflow-x:auto and aria-hidden. Some browsers make a scroller keyboard-focusable, which leaves a focus stop hidden from screen readers. Add tabindex="-1" to it, or move aria-hidden onto the canvas only.
- Non-blocking: look at it on a real phone. The picture, the hover label and the thumb size have only been checked by tests so far.
The home page now opens on an isometric town above the game list. Tapping a building opens its game. Tests pass, including the new
plaza.test.mjs. I did not look at the page in a real browser, so the picture, the hit sizes and the hover label are unchecked by eye.What changed
plaza.jsis new. It builds the layout withtown.jsand draws one building per game in its accent colour. It draws with the engine's colour ramps and dither into its own pixel buffer, not through the engine's fixed 360×280 scene.aria-hiddenand hidden without JS. Its space is reserved withaspect-ratio: 2/1, so nothing shifts. It redraws only when something changes, once per frame.index.htmlloadsengine.js,town.jsandplaza.js. The list and its no-JS behaviour are unchanged.plaza.test.mjsruns the realengine.js,town.jsandplaza.jsagainst a stand-in canvas. It checks:- the first frame, and that a second frame with no change draws nothing; - hover, and a card lifting its building; - a tap opening a game; - a filtered-out building staying grey, not hoverable, and not opening.
serve.test.mjsnow checks that/town.js,/plaza.jsand/engine.jsanswer 200 and that the page includes the canvas. The README has a "The town" section.Left out
engine.jsallocates its unused 360×280 buffers on the home page.Checks
bun testran onserve,shell,townandplaza: 89 pass.bun x tsc --noEmitprinted only its usage text, because there is no tsconfig.scripts/gate.tsorscripts/fast.tsin this clone, so I ran neither.origin/main; it had nothing new.To try it, open
/and tap a building, or type in the search box and watch the buildings grey out.Closes #133