https://github.com/vivek3141/super-mario-neat
This program evolves an AI using the NEAT algorithm to play Super Mario Bros.
https://github.com/vivek3141/super-mario-neat
genetic-algorithm gym gym-super-mario-bros machine-learning mario neat neat-python neural-network neuroevolution super-mario super-mario-bros
Last synced: about 2 months ago
JSON representation
This program evolves an AI using the NEAT algorithm to play Super Mario Bros.
- Host: GitHub
- URL: https://github.com/vivek3141/super-mario-neat
- Owner: vivek3141
- License: mit
- Created: 2018-08-05T05:04:49.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-08-01T22:44:35.000Z (almost 3 years ago)
- Last Synced: 2023-03-02T04:25:50.851Z (over 2 years ago)
- Topics: genetic-algorithm, gym, gym-super-mario-bros, machine-learning, mario, neat, neat-python, neural-network, neuroevolution, super-mario, super-mario-bros
- Language: Python
- Homepage:
- Size: 16.6 MB
- Stars: 79
- Watchers: 7
- Forks: 17
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Super Mario NEAT
This program uses the NEAT algorithm to evolve a
Neural Network to play the original Super Mario Bros.## Requirements
You can install the requirements by running
```bash
sudo apt install fceux
python3 -m pip install -r requirements.txt
```Or if on windows, run
```bash
python3 -m pip install -r requirements.txt
```
* Make sure you have FCEUX downloaded and added to PATH## Training
The finisher.pkl file contains the best genome on generation 2284.
In ./Files, you can find the backup for generation 2284, and the backup for generation 2492,
which is where I stopped training.
You can continue training by running
```bash
python3 main.py cont_train --gen --file
```## Running
To run the finisher.pkl file, run
```bash
python3 main.py run
```or run
```bash
python3 run.py
```
If you want to run a different file, run
```bash
python3 main.py run --file
```## Config
For debugging values, you can change any of the values in the config file. Note that you have to train from the 1st generation for some to take effect.
To use a different config file when training, specify `--config ` when running `main.py`.
## Multiprocessing
This program uses the build in python module multiprocessing, which is used for parallel computing. You can adjust the amount of genomes
to run at once by specifying `--parallel ` when running `main.py`.
## Levels
The default level is World 1, Level 1. This can be changed by specifying `--level ` when running `main.py`. For example,
`python3 main.py train --gen 100 --level "1-1"` will use 1-1.
## Result
The `finisher.pkl` file is trained to complete 1-1. It can complete it around 50% of the time. The `run.py` file keeps running the
simulation until it completes the level. `Ctrl + C` will stop it.
![]()
## Additional Information
The [Wiki](https://github.com/vivek3141/super-mario-neat/wiki) contains more information regarding the specifics of implementing certain parts.