Drift
Top-down arcade racer with procedurally generated tracks, AI opponents, and a physics-driven drift mechanic
Drift is an arcade racer built around a momentum-preserving drift system where sacrificing stability for speed is the point - the tighter you hug a corner, the more speed you carry out. Tracks are procedurally generated from seed values using a grammar-based approach that guarantees valid circuits by constraining curvature against the vehicle's physics.
- Momentum-preserving drift physics where tighter cornering yields higher exit velocity through a weighted traction curve
- Grammar-based procedural track generation producing closed-loop circuits from seed values without runtime asset streaming
- AI opponents using a look-ahead racing line optimizer that adapts to track segments in real-time with configurable aggression
- Four vehicle classes with distinct mass, traction, and inertia profiles affecting drift behavior and optimal racing lines
- Split-screen local multiplayer supporting up to four players with dynamic camera that zooms based on speed differential
- Replay system that records full physics state snapshots for rewinding, reviewing, and exporting ghost data as shareable strings
Physics engine built on a simplified bicycle model with separate longitudinal and lateral friction coefficients. The drift state machine transitions through grip, slip, and full slide phases, each with interpolated friction values. The key innovation is a momentum-banking system - angular velocity during a slide is partially converted to linear velocity on exit, rewarding controlled oversteer.
Track generation uses a context-free grammar operating on a canvas of quadratic Bézier segments. The generator first lays a coarse path, then subdivides with constrained random perturbations. Validation checks ensure minimum turning radius, maximum banking angle, and collision-free bounds against a bounding box. The entire generation completes in under 50ms, allowing real-time preview during track selection.