Skip to content

ollycassidy13/RL-Racetrack-Solver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RL Racetrack Solver

demo

Draw a track, watch 8 cars learn to drive it from scratch using reinforcement learning. Takes ~5–10 minutes to start seeing clean laps depending on track complexity.

How it works

  • Draw a closed loop by clicking waypoints on screen. The track is built from a cubic spline fit to your points, 80px wide.
  • Training starts immediately with 8 parallel environments running PPO (via Stable Baselines 3). Each car gets a 21-dimensional observation: 9 raycasts, speed, angular velocity, and 5 lookahead points along the centreline.
  • Reward is simply forward progress along the track (+0.005 per pixel), with a -5 penalty for crashing and +10 bonus for completing a lap.
  • Hit Space during training to watch the current model, R to resume training, D to redraw.

Setup

pip install stable-baselines3 pygame scipy numpy gymnasium
python main.py

Developed on WSL2/Ubuntu with WSLg for the display. Should work natively on Linux; Windows/Mac may need minor pygame tweaks.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages