# RCWeb Racer App

The **RCWeb Racer App** (`app/racer`) is a top-down multiplayer circuit racer built with the **Asymmetric Pattern**. A shared viewer renders a glowing figure-eight track while phones act as personal steering controls.

![icon](pwa-512x512.png "Racer App Icon")

## Screenshot
![screenshot](screenshot.png "Racer App")

## What it does

- **Five-lap racing**: Players race brightly colored cars around a large figure-eight circuit. The first car to finish five laps wins.
- **Track-vs-grass handling**: Cars accelerate hardest on the tarmac. Grass allows shortcuts in small doses, but it sharply reduces top speed and traction.
- **Shortcut protection**: If a driver skips a large section of the course, the game triggers an explosion, plays a warning effect, and rewinds that car to the point where it left the track.
- **Attract mode**: When nobody has joined yet, four demo cars loop around the course so the screen still feels alive and inviting.

## How it works

- **Sampled track math**: `script.js` builds a procedural figure-eight centerline, measures cumulative lap distance, and projects each car to the nearest point on that path to handle ranking, lap progress, and off-track checks.
- **Analog driving model**: Cars use continuous speed, steering, acceleration, braking, drag, and surface grip values rather than tile steps, which makes the controller feel closer to a cartoon racing game than an arcade shooter.
- **Asymmetric RCWeb messaging**: The viewer listens for `racer.remoteControl(...)` calls from `app/racer-c`, then sends back player registration, lap, place, and status updates targeted at each phone.
