Autonomous TORCS driver
TORCS (the open race car simulator) has a server-side patch allowing driver AI to be programmed into clients that control drivers in a simulated race. The server provides clients mainly with 32 track distance sensors, 19 opponent sensors, track middle offset, engine RPM, gear, and XYZ velocity.
The below video shows the server-side view of TORCS with a fixed camera on the main driver, and the client-side implementation debug renderer of the sensor inputs and outputs. The algorithm calculates the furthest sensor after being filtered, and then steers towards it using a PID (proportional-integral-derivative) controller.
The 32 combined sensor inputs are represented as white lines, with the green line being the calculated steering direction. The running graph shows the outputs, with the steering in blue (-1 to 1), acceleration in purple (0 to 1), and braking in yellow (0 to 1). The race shown is a test for opponent avoidance running 4 of the same driver algorithm.
The implementation also includes a custom client connector to allow for multiple drivers to connect on different threads, seen here.
Runs on a patched version of TORCS 1.3.4 (patch included in the Win32 download), running a race of 4 scr_server drivers.
Requires Visual C++ redistributable 2015.