Towards the Autonomous Racing Driver in TORCS
Let's dive deep into the very basics of AI race driving and how to approach this non-trivial problem of "teaching" your own driver
Towards the Autonomous Racer
Hey there! It's been quite a short time since the introductory post about us. We are slowly but surely getting know each other with our simulation foundation — the TORCS simulator. Even though the game was initially released back in 1997, I need to say that the overall experience is very detailed and I feel that the TORCS cannot be ashamed in competition of modern racing games.
The actual “racing” is done via so-called scr-server — locally run interface through which Python-written computer code communicated with the game — game sends back tellemetry data and actual state of the car on track and script sends back controlling prompts which control the racing car.
The actual magic is done via more than 15 various sensors which nearly-perfectly reflect the state of the car on track.

Overview of the front sensors of the racing car (S. Mohammed et. al., 2019)
Presumably correctly written script is able to evaluate (with certain frequency) what is car experiencing and output right decision — whether to accelerate or brake, turn right or go straight…
The actual AI magic lies between receiving the data and outputting the decision. For us, humas, it seems easy to decide when turn and when hit the pedal. With few tries on the track I am more than sure that vast majority of you would be able to achieve above-average lap times; however, PC acts a little different.
For instance — we know what are corners on track and know how act — PC does not natively, it is needed to let it know what corner is and how to act. For us it is natural to maintain speed on straight roads — for PC it is not, it is again needed to let it know about it!
And that is the thing where creativity and outside-the-box thinking of every single competitor roots. How to “teach” the computer?
In general, the most straight-forward and widely used approach incorporates output from the sensors and relies on defining so-called reward function which reflects the progress of the car on track.
What progress? Distance? Speed? The amount of times wheels of the car slipped? … as I said, creativity has no bounds here ;)
The function should be defined properly — higher results of the function yields better performance — thus making the as maximal as possible is one of the main goals of the training!
What definition would make the car be both smooth and speedy enough? And how to search for the optimum? Those of you who know something about calculus — making the derivative equal 0 and find the solution of the equation is not the way…

Laguna Seca Track (USA) a.k.a. Corkscrew — AI Driving nightmare and threshold
Be with us and follow our journey through the Laguna Seca Track! Next week we will dive deep into possible reward functions and our first results so-far!
메타데이터
- post_id
- d71cda8f8e65
- slug
- towards-the-autonomous-racing-driver-in-torcs-d71cda8f8e65
- url
- https://medium.com/@whitemonsterracing/towards-the-autonomous-racing-driver-in-torcs-d71cda8f8e65
- canonical_url
- https://medium.com/@whitemonsterracing/towards-the-autonomous-racing-driver-in-torcs-d71cda8f8e65
- author_url
- https://medium.com/@whitemonsterracing
- status
- ok
- fetched_at
- 2026-06-22 12:55:45