Clickety Clack! – a photo-real domino chain-reaction game in three.js (custom physics, mobile)

Hi everyone! I made a small domino game: draw a line of dominoes with your finger or mouse, flick the red starter, and watch the wave run through a real-looking home with a low “macro lens” camera.

:play_button: Play (free, desktop and mobile): Clickety Clack! – Play free online | Glowbit Games

There are 12 levels in 4 rooms (living room, kitchen, playroom, garden patio). You ring desk bells, knock down cup pyramids, launch toy cars, roll a boule across the lawn, outrun a robot vacuum and grow small dominoes into giant ones. There is also a Free Build sandbox for up to 2,000 dominoes, and you can share builds as text codes.

Some technical bits

  • Custom domino physics: I don’t use a general rigid-body engine. Each domino is a box that tips over one of its bottom edges and is integrated as a rigid pivot. Contacts are found by sampling its front face against nearby boxes (a uniform grid), and they are solved by bisecting the tilt angle. A leaning domino pushes the next one with its weight, and impacts share spin by moment of inertia. So the rules come out like on a real floor: a gap that is too big, a bend that is too sharp, or a jump of more than about 1.5x in domino size stops the chain. This is much cheaper than full rigid bodies with thousands of dominoes.

  • Render-free and deterministic: the world, physics, line drawing, levels and scoring are plain TypeScript with no three.js. Unit tests and a headless checker run in Node and play every level’s reference solution, so a physics tweak that breaks a level shows up right away.

  • One instanced mesh for all dominoes: pips, the centre groove and both face colours are drawn in the fragment shader of a MeshPhysicalMaterial (patched with onBeforeCompile). Each instance carries its front colour, back colour and pip code, so the dots stay crisp at any zoom with no textures.

  • Photo-real look: CC0 Poly Haven floor textures (wood, parquet, tiles, stone, rug, grass) and two small HDRIs for image-based lighting. The post stack is N8AO ambient occlusion plus postprocessing depth of field, bloom, AgX tone mapping and SMAA. The DOF focuses on the moving wave, which gives the tilt-shift miniature feeling, and the camera follows the wave at floor level. Tall props fade out when they block the camera.

  • Quality levels: Auto / High / Medium / Low. Auto steps down when the frame rate drops, and Low skips DOF and AO, so it also runs on phones.

  • Procedural sound: the domino clicks are pre-rendered with modal synthesis, with a different floor knock for

    each floor type. The bell, cups, toy motor, applause and a lo-fi electric piano soundtrack are all Web Audio.

Stack: three.js r186, TypeScript, Vite, postprocessing, N8AO. The JS is about 360 KB gzipped, plus about 3 MB of textures and HDRIs.

I’d love to hear how it runs on your devices, and what you build in Free Build!