Giter VIP home page Giter VIP logo

deep-rl-supertux-race's Introduction

TransformerKart: A Full SuperTuxKart AI Controller

Deep Reinforcement Learning AI controller that plays the SuperTuxKart race using only inputs available to the user (images, velocity, and rotation). The controller is based on a Decision Transformer. The SuperTuxKart race game has been wrapped using a gym environment.

Full report pdf

5-minute summary video (also available youtube):

video_summary.mp4

Results

The results obtained by the different models can be found in evaluate.xlsx. Some sample videos and a chart summarizing the results can be found in the evaluate folder.

Summary chart

Full model (steer, drift, and acceleration):

lighthouse_trans_drift_acc_0.mp4

Steer and drift model:

lighthouse_trans_drift_0.mp4

Training Process

The following steps have to be done to train a model:

Once the model has been trained and saved, we can evaluate the models by specifying the models to be evaluated in run.py.

Get Data

It runs the baseline model (with and without noise) on the environment to obtain a dataset of episodes that are used for training our models.

To change the way data is gathered or more information check run.py.

python -m run -t

CNN Autoencoder

The CNN autoencoder that is later used by the controller models can be found in agents/cnn.py.

To train the CNN autoencoder on the available data:

python -m agents.cnn

Full Model

Learns to steer, drift, and accelerate.

It can be trained from scratch. However, we have first pretrained a CNN autoencoder and used the encoder for the image embedding layer. To modify this behavior or more information check agents/decision_transformer.py.

The following command trains this model with the autoencoder and data already available:

python -m agents.decision_transformer 

Steer Model

Learns to steer and has fixed acceleration and drift disabled.

It can be trained from scratch. However, we have first pretrained a CNN autoencoder and used the encoder for the image embedding layer. To modify this behavior or more information check agents/decision_transformer.py.

The following command trains this model with the autoencoder and data already available:

python -m agents.decision_transformer --no_drift 

Drift Model

Learns to drift and steer, and has fixed acceleration.

It can be trained from scratch. However, we have used the steer model with the best validation loss as our starting model for training. To modify this behavior or more information check agents/decision_transformer.py.

The following command trains this model with the steer model and data already available:

python -m agents.decision_transformer --fixed_velocity 

Evaluate Models

It runs the set of given models, the baseline, and the game AI for a certain number of episodes to evaluate their performance.

The models being evaluated are preset and need to be unziped before being used (the models are available in the saved folder). To change the models being evaluated or more information check run.py.

To evaluate the models on the lighthouse track:

python -m run --evaluate_lighthouse

To evaluate the models on all selected tracks (models given have not been trained in other tracks than lighthouse):

python -m run --evaluate

Environment

Gym environment that wraps the PySuperTuxKart game environment.

To check the environment options or select which tracks to use check environments/pytux.py.

deep-rl-supertux-race's People

Contributors

vibalcam avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.