# Wheel race

A canvas 2D top-down race for two phones. GAS advances the car around a short oval; steering changes its lane. Complete three laps, then press START to race again. The phone shows lap, speed and a short instruction on its LCD. Its shift lights use RPM calculated from the game's speed. Starting and completing a lap send a cue and rumble.

From the SDK root, with Node 22 or newer:

```sh
node examples/wheel-race/server.mjs
```

Open [the game and QR lobby](http://127.0.0.1:49701/). There is no graphics dependency or build step. For real phones, replace this example IP with the computer's reachable Wi-Fi address:

```sh
PUBLIC_ORIGIN=http://192.168.1.20:49701 node examples/wheel-race/server.mjs
```

Open that LAN URL on the display and scan its QR with both phones. Choose **Wheel** in MENU. Hold the right GAS pedal, use the left pedal to brake, and drag the wheel to steer. Gamepad fallback uses the left stick and right trigger or bottom face button.

For tilt, follow the [trusted local HTTPS setup](../local-common/README.md#motion-on-iphone). On the wheel itself, tap **TAP FOR TILT**, grant permission, gently move the phone to confirm the first reading, then tap **CENTER** while holding it straight. Turn tilt off in MENU to return to dragging. HTTP and denied motion permission both leave a complete touch-driving route.

```sh
node --test examples/wheel-race/test.mjs
```

The SDK driver opens two isolated phones in one headless Chrome. Real pedal and wheel touches change distance and lane, complete a lap, update RPM/shift instruments and deliver targeted feedback. It checks leave, reload/resume with lap retention, removal, QR rotation and cleanup. Real iPhone sensors and physical feedback remain [device checks](../local-common/README.md#scratch-files-and-captures).

`server.mjs` sends the control view on `join`, then updates LCD and RPM/shift readouts with `host.instruments`; the SDK merges and coalesces those patches. `client.mjs` draws the oval. Shared lifecycle handlers retain seats and reset departed input. Type `remove p1` in the terminal to free a seat; Ctrl+C stops the timer, sockets and server.
