MindPuck.Web
MindPuck
Move the puck into the goal with your eyes.
There are three control schemes, and F1 steps through them at any time. The one in use is always named at the bottom centre of the screen.
- Magnetic (the default): the puck is pulled to the point you look at. Look where you want it to go and lead it round the obstacles.
- Steer: keep your eyes on the puck. It travels toward the side of it you look at: look at its right edge and it goes right. Look at its centre and it is left alone.
- Repulsor: a reverse black hole. The puck is pushed away from where you look, harder the closer you look. Look behind it to send it forward; look far away and it glides on its own.
Whichever you use, it moves like a puck on an air-hockey table, bounces off everything, and has to come to rest on the amber pad.
This is the web version, drawn with three.js. Eye tracking comes from MindAttic.Webcam, using the webcam of the computer you play on or the camera of a phone. A mouse or a finger can stand in for your eyes.
The same game exists for Unity (MindPuck.Unity) and Unreal (MindPuck.Unreal), with the same rules, physics numbers and level generator.
Run it
MindPuck expects the Webcam repo checked out beside it:
D:\Projects\MindAttic\MindAttic.Webcam D:\Projects\MindAttic\MindPuck.Web
PowerShell:
cd D:\Projects\MindAttic\MindAttic.Webcam npm install npm run build cd D:\Projects\MindAttic\MindPuck.Web npm install npm start
npm start builds the game and serves it from the Webcam bridge, then opens http://localhost:8787/play/. You should see the title card with three ways to play:
- Use this camera: asks for the webcam, then runs a nine-dot calibration. Press Space (or click) to begin, look at each dot until it fills, then follow the moving dot.
- Use my phone: the phone's camera watches your eyes while you look at this screen. The status line at the bottom shows the address to open on the phone (same Wi-Fi; accept the certificate warning once). Prop the phone at the bottom or top of the screen, facing you, start its camera, then press C here to calibrate.
- Use the pointer: no camera. The mouse or your finger is the gaze point.
To check that real eye tracking is good enough (the MS-1 sign-off), follow REAL-EYE-CHECK.md: webcam, then phone, the gaze lab's accuracy report, and a level won in each scheme.
For development with live reload, npm run dev serves the game alone on http://localhost:5183. The webcam and pointer work there. For a phone, run the bridge as well (cd D:\Projects\MindAttic\MindAttic.Webcam; npm run bridge).
Controls
| Key | Button | Does |
|---|---|---|
| F1 | Magnetic / Steer / Repulsor | Step to the next control scheme |
| R | Restart | Put the puck back at the start |
| N | Skip | Go to the next level |
| B | Show me | The solver plays the level, showing where it looks |
| C | Calibrate | Run the eye tracking calibration again |
| Esc | Input | Change how you play |
| F | Fullscreen |
The run's seed and level are remembered between visits. To share or replay a run, add them to the address: ?seed=1234&level=5.
How it works
src/core/holds the rules and nothing else: the physics (physics.ts), the level generator (levelgen.ts), route finding (navgrid.ts) and the solver (bot.ts). It has no browser or three.js dependency.src/game/draws the table with three.js and makes the sounds.src/main.tswires the gaze sources, the menu and the game loop together.
Every level is generated from the seed, then played by a solver before you see it. The solver steers the puck with a simulated gaze point that wobbles and lags the way a real eye tracker does. The solver must win in all three modes, or the level is thrown away and another is generated. The solver's time in the mode you are playing is the par shown in the corner. docs/DESIGN.md has the details and every tuning number.
npm run levels prints a run of levels and how the solver did:
level 9 cup obstacles 11 par 7.0s candidates 1 reruns won 5/5 2 ms
Build and test
npm run buildtypechecks and builds todist/.npm testruns the unit tests (vitest) for the physics, collisions, route finding, level generation and the solver.npm run smoke, withnpm startrunning in another window, drives/play/in headless Chrome with a recorded face clip as the webcam: "Use this camera", the nine-dot calibration, then each control scheme, checking the puck moves. It proves the camera path, not the accuracy (that is REAL-EYE-CHECK.md). It needs Chrome and ffmpeg, and makes its clip from MindAttic.Avatar's portrait (--clip <file.mjpeg>uses your own).
Scope
The complete product, every epic, feature and story built or still to build, is written down in SPEC.md; the current finish line is RELEASE.md.
Pages in this repository
- MindPuck — Project Bible — Move a puck into the goal with your eyes: an air-hockey puck on a table of obstacles, pushed or pulled by where you look, tracked through…
- Code ledger: MindPuck.Web — Every tracked source file and the ticket in this repo's tree that accounts for it (MAT-T484; method:…
- MindPuck design — This is the reference for the rules. The web, Unity and Unreal versions implement the same thing; src/core/ in this repo is the original…
- Real-eye check (MS-1 sign-off) — MS-1 is reached when a real person, with their own camera, moves the puck to the goal in all three control schemes and finds the accuracy…
- MindPuck.Web — Release charter — MindPuck, the canonical web version (TypeScript, three.js): move an air-hockey puck into the goal with your eyes, through a webcam, a…
- MindPuck.Web — Product specification — A product in docs/ECOSYSTEM.md (Games): the canonical MindPuck, played with the face through the platform's webcam library. MindPuck moves…