Skip to content

Repository files navigation

PromptRacers

PromptRacers key art: night highway race, tagline Build anything. Race everyone.

Live demo: https://prompt-racers.vercel.app/

Describe a car or motorcycle, then street-race friends on a shared night highway. Everyone joins with a room code from their own phone or laptop. Nobody signs in and nobody installs a game.

The server owns the race. Browsers send steering, brake, and nitro. Positions, traffic hits, and the finish order come back from the server.

Stack

  • Runtime: Node.js 18+
  • Realtime: WebSockets with a 20 Hz authoritative server tick
  • Client: Three.js night-highway scene in public/
  • Shared rules: prompt-to-vehicle interpreter + race logic in shared/race.js

Run it

Requires Node.js 18 or newer.

npm install
npm start

Open http://localhost:3080.

The terminal also prints a network address, for example http://192.168.x.x:3080. Friends on the same Wi-Fi open that address. If their browser cannot connect, allow Node through the Windows firewall.

Set PORT to use another port:

set PORT=4000
npm start

npm run sim runs a headless race check and does not start the server.

How to play

  1. Enter your name and describe the vehicle. The garage turns that sentence into a body, an engine, and the numbers you actually drive.
  2. Press Create room. Share the 4-character code or the join link.
  3. Friends build a car and press Join room.
  4. Pick a mode and press Start race. One driver can practice alone. A room holds up to 8 drivers.

The car accelerates by itself.

Input Action
Left / Right arrows, or A / D Steer
Space Brake
Shift Nitro
On-screen buttons Same controls on a phone

A gamepad left stick steers. Face buttons and triggers brake or fire nitro.

Rules

  • Street Race — 2.6 km. First across the line wins. Drift points break a tie.
  • Traffic Rush — shorter highway, denser traffic, same finish rule.
  • Survival — 75 seconds. The farthest car that is still in one piece wins.

Traffic is slower than you. A hit costs speed and integrity. About five solid hits wreck a normal car. Trucks take more. Motorcycles take less. Brake to drop into a gap. Nitro is a short burst, then it recharges. Sit behind another player in the same lane for a slipstream.

Architecture

Browser (Three.js HUD + input)
        |  WebSocket: steer / brake / nitro
        v
server.js  -- 20 Hz tick --> shared/race.js rules
        |
        v
Broadcast positions, collisions, finish order

The garage reads the prompt on the device and builds a 3D car from that spec. It does not call an image model.

Project layout

Path Role
server.js Rooms, WebSockets, and the 20 Hz authoritative tick
shared/race.js Prompt interpreter, track, and race rules shared by the server and the browser
public/ Garage, HUD, and the Three.js night highway
scripts/sim.js Headless race check

License

MIT — see LICENSE.