Autonomous Car Racing AI

Overview

This honours project focused on training reinforcement-learning agents to drive a physics-based racing car and complete clean, collision-free laps within the Unity engine. Using Unity Machine Learning Agents (ML-Agents), continuous-control algorithms were applied to a vehicle simulated with Wheel Collider dynamics, providing realistic traction, steering, slip, and braking behaviour. The agent operated on a compact observation space comprising the directional vector to the next waypoint, local and global velocity vectors, and ray-based proximity measurements for wall and track-edge detection. Its continuous action space controlled steering angle, throttle, and brake force, mapped directly to the Wheel Collider inputs. During training, the reward structure encouraged forward progress and stable cornering while penalising collisions and off-track deviations. The resulting policy was able to reliably complete laps on the training circuit and exhibited strong generalization, transferring successfully to previously unseen track layouts while maintaining effective wall avoidance and corner-control performance.

Features

  • Curriculum Learning: Training progresses from a simple looped track to increasingly complex curves and geometries.
  • Reward Function: Positive rewards for forward progress and vehicle stability. Penalties applied for collisions, off-track events, and unstable driving behavior.
  • Generalization Evaluation: Policy performance validated on previously unseen track configurations to assess robustness.
  • Telemetry & Metrics: Lap time, collision count, lateral deviation and other stability indicators.