TORCS Robot Tutorial

Introduction

The goal of this tutorial is to motivate you to write your own TORCS robot and to guide you through the first steps. So what does the term "robot" here mean exactly? A robot is a program that drives a car (technically it's a function encapsulated into a shared object in Linux, into a DLL in Windows). It is executed from TORCS and gets as input information about the current status of its car and the situation on the track. Based on this it can compute how much it wants to steer, to brake or accelerate, which gear it needs and if it wants to pit. Your robot returns the data to TORCS and the next simulation step will be performed.
For me it's great fun to develop my robot, because I can implement my ideas and check it in the simulation. I can just say, it didn't really often happen what I expected, because it is a more complex and interesting environment as it seems on the first glimpse. You don't have just to fight with the control of your car, you have also to avoid collisions, to overtake and to resolve other situations.
So, if you like to watch races on TV here is something more exciting for you, you can let your driver enter the race and participate yourself. Take your chance and enter the race!

Requirements

You need to have TORCS installed exactly according to the installation section (if you have not read the installation instructions, then do it before you start, even if TORCS runs perfectly). It helps if you already know a programming language and a bit about data structures like linked lists. You have to write your robot in C or C++, but that's easy if you already know another programming language, because you just need very easy stuff like basic data types, structures, pointers, arrays and functions. So if you are not familiar with C or C++, simply read further and look up a C or C++ tutorial on demand. You can find such tutorials on the internet, pick one that fits your needs.

Resources

There is a reference manual and much more on the official TORCS site. Let us know about your robot and make it available, so that the world can enjoy your work. If you want discuss about TORCS, mail to the torcs-users mailing list.

Robot Tutorial Download

If you prefer to read the tutorial offline, then you can download it here.