Bash.tv → GitHub → itch.io

Racing and driving games for the browser (top-down racers, pseudo-3D road racers, 3D kart racers). Car handling (acceleration, braking, steering by speed, drift and grip), tracks with checkpoints and laps, AI racers following racing lines with rubber-banding, collisions with walls and cars, boosts and items, time trials and ghosts, cameras, touch and tilt controls, and a starter plan. Use for "...

Download skill (.zip) Files on GitHub

Racing game development

Core: take corners well, find the racing line, beat the clock or the rivals.

Starter template

A playable starter for the game-scaffolding template is in assets/starter/. A smooth looping track (spline), an arcade car with speed-based steering, grip vs drift and grass slowdown, three AI rivals on the racing line, laps with timing and a saved best lap, positions, a countdown, a look-ahead camera and a minimap.

python3 <game-scaffolding>/scripts/scaffold.py my-game --title "My Game" --starter <this skill>/assets/starter

Controls: Up/Space gas, Down brake, Left/Right steer, Shift drift. Touch: steer buttons with auto-gas and a brake pad. Esc pauses. All numbers to tune are in src/config.js; the gameplay is in src/scenes/play.js. A full three-lap race was simulated, and lap times are correct.

Car model (arcade, top-down or 3D ground plane)

// per step: forward speed v, heading a; grip blends velocity toward the heading (drift when grip is low)
const steer = input.x * cfg.steer * Math.min(1, Math.abs(car.v) / cfg.fullSteerAt);      // can't turn standing still
car.a += steer * dt * Math.sign(car.v || 1);
car.v += ((input.gas ?? 0) * cfg.accel - (input.brake ?? 0) * cfg.brake - car.v * cfg.drag) * dt;
const fx = Math.cos(car.a), fy = Math.sin(car.a);
const grip = input.drift ? cfg.driftGrip : cfg.grip;                                    // e.g. 4 vs 12 (per second)
car.vx += (fx * car.v - car.vx) * (1 - Math.exp(-grip * dt)); car.vy += (fy * car.v - car.vy) * (1 - Math.exp(-grip * dt));
car.x += car.vx * dt; car.y += car.vy * dt;

Tracks

AI racers

Follow a racing line (waypoints with target speeds per corner) using enemy-ai steer.followPath; vary their skill (line offset, max speed). Rubber-banding (difficulty-scaling rubberBand) keeps races close, subtly.

Modes and feel

Time trial with a ghost (record positions every 0.1 s, replay), best laps saved. Camera: top-down rotates with the car or not (choice), 3D chase camera with speed-based FOV. Speed lines and skid marks sell speed; engine pitch follows speed (game-sound-design).

Controls

Keyboard: arrows/WASD, Space drift. Touch: left/right halves to steer + auto-gas, or a stick; optional tilt (DeviceOrientationEvent, needs a permission tap on iOS). Gamepad: stick + triggers.

Pitfalls

Steering that’s too sharp at speed, cars that stick to walls, AI that cheats visibly, and laps counted by crossing the line backwards.