Skip to content

A Game AI implementation using Reinforcement Learning via ML-Agents in Unity.

Notifications You must be signed in to change notification settings

rob1997/kart-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kart AI

GitHub release Made with Unity GitHub license

A Game AI implementation using Reinforcement Learning via ML-Agents in Unity.

Unity Version: 6000.0.31f1

demo

Usage (Training)

You can open up Heuristic scene under Assets/Scenes to test the AI. However, if you'd like to train your own AI you can follow the steps below.

1. Set up your own Agent

To do this you can look at Jeep.prefab under Assets/Prefabs, you'll need to set up your Agent in a similar way (hierarchy matters). Once you've your Agent set up, you can take a look at PlayerJeep.prefab and AiJeep_Training.prefab in the same directory to set up prefab variants for Player and AI respectively.

2. Set up your Environment

To do this you can look at Training scene under Assets/Scenes, you'll need to set up your Environments in a similar way. Each Environment has a Simulation script and a RandomTrackGenerator script attached to it, moreover it has a plane with a MeshCollider and a trainable Agent as child objects. The number of Environments you have will determine the number of Agents you can train simultaneously.

3. Set up your Training Config File

You can find the training config file under configs/ppo/kart-ai.yaml. You can change the values to suit your needs based on the ML-Agents documentation.

4. Train your AI

If you don't already have ML-Agents installed you can do so by following the instructions here. Once you've ML-Agents installed you can train your AI by running the following command in the terminal.

mlagents-learn <path-to-config-file> --run-id=<run-identifier>

You can also find more information on training your Agent here.

Configuration

Every configurable property for the Environment, Agent and Training has a tooltip you can access by hovering over it on the inspector.

How it Works

If you would like to know how it works, I've a dev-log entry on it here

Contributing

If you'd like to contribute to the project, you can fork the repository and create a pull request. You can also create an issue if you find any bugs or have any feature requests.

About

A Game AI implementation using Reinforcement Learning via ML-Agents in Unity.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published