F40
I am teaching a car to drive in Assetto Corsa. I do not draw the racing line for it. The car tries a lap. If it stays on the road and keeps moving, it gets a higher score. If it leaves the track, the lap ends and it starts again. Over many tries the program changes how it steers and uses the pedals. That is how it learns.
The project is called OpenChamber. I use a Ferrari F40 at Monza. The training runs on the graphics card in my computer. It is built on AssettoCorsaGym. I am training the model myself, from the start.
How it works
AC hotlap
→ sensors @ 25 Hz
→ gym env
→ PPO (CUDA)
→ vJoy controller → AC
- The game sends the car’s speed and position
- The program steers and uses the pedals through a virtual controller
- If the car leaves the track, it is placed back on the road
Setup
First pass
The first training run reached about 101,000 steps out of a planned 300,000. The average score started near zero and later sat around 77. The best single run scored 404. Top speed was about 62. The pictures below are from that run.
Episode reward, first pass
Training again
I have started again with the same car and track. This time the plan is 500,000 steps. It is still at the beginning. I wanted a model that I trained myself, on this computer, all the way through.
Track
Learning
Run it
.\.venv\Scripts\python src\train.py \
--car ferrari_f40 \
--track monza \
--timesteps 500000 \
--run runs\ppo_f40_monza
I later went back to the Mazda on this track. That note is here.
The pictures are from the first F40 run.
← Teaching a model to drive