# Rocket Car Arena

A small rocket-car soccer game for the browser, built with Three.js (`WebGLRenderer`). The physics is simple arcade physics written by hand, with no physics engine.

## Run

There is no build step, but ES modules need to be served over HTTP:

```sh
python3 -m http.server 8000
# open http://localhost:8000/index.html
```

Files: `index.html` (page + HUD), `game.js` (game), `lib/three.module.js` (Three.js r160, vendored locally).

## Controls

| Key | Action |
| --- | --- |
| **W / ↑** | Throttle (in the air: pitch nose down) |
| **S / ↓** | Brake / reverse (in the air: pitch nose up) |
| **A D / ← →** | Steer (in the air: yaw) |
| **Space** | Jump. Press again in the air to flip toward your input direction, or with no direction for a double jump. Also skips a replay. |
| **Shift** | Boost (leaves a flame-and-smoke particle trail) |
| **C** | Toggle ball cam / car cam |
| **Enter** | Play again after full time |

**Touch devices:** on-screen ◀ ▲ ▼ ▶ buttons for steering and throttle, plus **JUMP**, **BOOST** and **CAM** buttons.

## Gameplay

- You drive the **blue** car, defend the blue goal (−z) and attack the orange goal. An orange AI bot plays against you.
- Matches last **2 minutes**. Each goal triggers a white flash and a "GOAL!" banner with an explosion, followed by a slow-motion **replay** and a 3-2-1 kickoff.
- Drive over the yellow pads to refill boost. Large pads give 100 boost, small pads give 15.
- The curved ramps let you drive up the walls if you're fast enough. Slow down and you fall off.

## Auto-play

With no input, an AI drives the blue car: it chases the ball, lines up shots, boosts, jumps and flips, and scores, while the chase camera follows. As soon as you press a key or touch a button, you take control. After 10 seconds without input, the AI takes over again. When a match ends in auto-play, a new one starts automatically.

## Notes

- The arena collision is a signed distance field: a rounded box (which gives the ramps and rounded corners) joined with the two goal boxes. The ball and cars collide against it analytically.
- Resolution adapts automatically on slow (e.g. software-rendered) devices.
- `?speed=2` speeds up the simulation (debug).
