https://github.com/rob1997/kart-ai
A Game AI implementation using Reinforcement Learning via ML-Agents in Unity.
https://github.com/rob1997/kart-ai
kart ml-agents procedural-generation racing reinforcement-learning unity
Last synced: 3 months ago
JSON representation
A Game AI implementation using Reinforcement Learning via ML-Agents in Unity.
- Host: GitHub
- URL: https://github.com/rob1997/kart-ai
- Owner: rob1997
- Created: 2021-01-05T12:52:30.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2025-01-12T08:42:02.000Z (over 1 year ago)
- Last Synced: 2025-08-24T19:47:32.943Z (10 months ago)
- Topics: kart, ml-agents, procedural-generation, racing, reinforcement-learning, unity
- Language: ShaderLab
- Homepage:
- Size: 146 MB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Kart AI
[](https://rob1997.github.io/kart-ai/)
[](https://unity3d.com)
[](https://opensource.org/licenses/MIT)
A Game AI implementation using Reinforcement Learning via [ML-Agents]() in Unity.
Unity Version: `6000.0.31f1`

## 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](https://unity-technologies.github.io/ml-agents/Training-Configuration-File/).
### 4. Train your AI
If you don't already have ML-Agents installed you can do so by following the instructions [here](https://unity-technologies.github.io/ml-agents/Installation/). Once you've ML-Agents installed you can train your AI by running the following command in the terminal.
```bash
mlagents-learn --run-id=
```
You can also find more information on training your Agent [here](https://unity-technologies.github.io/ml-agents/Training-ML-Agents/).
## 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](https://rob1997.github.io/devlog/log-4.html)
## 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.