Skip to content
/ ACRL Public

A reinforcement learning implementation for Assetto Corsa. (Bachelor project TCS 2023)

License

Notifications You must be signed in to change notification settings

Jurredr/ACRL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ACRL: Assetto Corsa Reinforcement Learning

Description

A Python project that uses the SAC algorithm to learn to drive autonomously in the racing simulator game Assetto Corsa through Reinforcement Learning.

This project is the bachelor assignment of Jurre de Ruiter (s2580160), Technical Computer Science student at the University of Twente.

Project overview

The project consists of two main components:

  1. The Assetto Corsa app (ACRL/), which is a Python script that runs inside Assetto Corsa and communicates real-time data with the Python project outside of Assetto Corsa.
  2. The standalone Python project (standalone/), which is a Python script that runs outside of Assetto Corsa and uses the real-time data from the Assetto Corsa app to train a model using the SAC algorithm. It sends the model's actions back to the Assetto Corsa app through a virtual controller from vgamepad.

Getting started

  1. Purchase and install Assetto Corsa on Steam, and download the free Content Manager extension software.
  2. Clone this repository to your local machine. (See here for instructions on how to clone a repository.
  3. Download and install the Microsoft Visual C++ 2015-2019 Redistributable from here.
  4. Download and install the Microsoft Messaging Passing Interface standard (MS-MPI) v10.1.3 here.
  5. Getting the Assetto Corsa app working:
    • Install the Python 3.3.5 interpreter. This is what Assetto Corsa uses and we need this locally for the socket import to not throw errors in AC.
    • Copy the ACRL folder to the apps/python folder in your Assetto Corsa installation directory. (e.g. C:\Program Files (x86)\Steam\steamapps\common\assettocorsa\apps\python)
    • Run Assetto Corsa and enable the ACRL app in the General tab of the Settings menu. (You can also enable it through the Content Manager settings, or in the Custom Shaders Patch tab if you have CSP installed).
  6. Getting the standalone Python project working:
    • Install a modern Python interpreter (tested on: Python 3.10.11). This is what we use for the part of the project that runs outside of AC. Make sure to add Python to your PATH environment variable.
    • Install the required Python packages by running pip install -r requirements.txt in the root of the /standalone directory.
  7. Set up a new session in Assetto Corsa through Content Manager:
    • Select Practice Mode and choose track "Silverstone 1967" and car "Ferrari 458 GT2"
    • Confirm tires are the default option
    • Set the number of AI opponents to 0
    • Turn on penalties and ideal conditions
    • Limit the framerate to 30 FPS
    • Set controls to Gamepad, with speed sensitivity set to 0, steering speed set to 100%, steering gamma set to 100%, and steering filter set to 0%
  8. Start the session and wait for the car to spawn on the track. Make sure automatic gear switching is enabled (ctrl + G).
  9. Change directory using cd standalone, and run the standalone/main.py file to start listening for an incoming connection from Assetto Corsa.
  10. Start training by clicking the Start Training button in the ACRL app window in Assetto Corsa. The car should start driving around the track and the model should start training. You can monitor the training progress in the console window where you started the main.py script.

About

A reinforcement learning implementation for Assetto Corsa. (Bachelor project TCS 2023)

Topics

Resources

License

Stars

Watchers

Forks

Languages