Skip to content

NEAT is neat! Neuroevolution of augmenting topologies is a genetic algorithm.

License

Notifications You must be signed in to change notification settings

kapi0okapi/NEATactics

 
 

Repository files navigation

NEATtactics

GitHub Workflow Status (with event) GitHub top language GitHub language count License: MIT Project Version

Cogito Project Logo
📋 Table of contents

Description

NEATtactics is a project that aims to implement the NEAT (NeuroEvolution of Augmenting Topologies) algorithm to train a neural network to play a classic platformer game inspired by Super Mario. The idea is to evolve a neural network using NEAT, allowing an AI agent to learn and improve its gameplay strategies over time, starting from scratch and evolving through generations.

Our project takes inspiration from SethBling's MarI/O video, where he demonstrates a neural network learning to play Super Mario World using the NEAT algorithm. You can watch the video here [here] (https://www.youtube.com/watch?v=CI3FRsSAa_U&t=468s) to get a better understanding of the principles behind our approach.

To implement this, we are basing our work on the research paper "Evolving Neural Networks through Augmenting Topologies" by Kenneth O. Stanley and Risto Miikkulainen. This paper introduces the NEAT algorithm, which evolves neural network topologies along with weights to create more efficient and sophisticated solutions.

In this project, we will:

  • Implement the NEAT algorithm from scratch, following the guidelines from the original research paper.
  • Use a simulation environment based on a classic Super Mario platformer where our AI agent will learn to navigate and play the game.
  • Continuously evolve the agent's neural network to enhance its performance, aiming for progressively better gameplay as it learns from experience.

Join us in exploring the fascinating world of neuroevolution and AI-driven gameplay!

Getting started

Start off by cloning the repository to your local machine.

git clone https://github.com/CogitoNTNU/NEATactics

Next, navigate to the project directory:

cd NEATtactics

Create a virtual environment to manage the project dependencies:

python -m venv venv

Activate the virtual environment on Mac/Linux:

source venv/bin/activate

Alternatively use this command on windows:

venv\Scripts\activate

Install the project dependencies:

pip install -r requirements.txt

Now you are ready to run the project!

Note on venv

You will need to activate the virtual environment for each new shell session. If you want to deactivate the virtual environment, you can do so by either closing the terminal or running the following command:

deactivate

Prerequisites

Usage

To run the project, run the following command from the root directory of the project:

python main.py

Testing

To run the test suite, run the following command from the root directory of the project:

pytest

To get a detailed report of the test coverage, run the following commands:

coverage run --source=src -m pytest
coverage html

Next, open the htmlcov/index.html file in your browser to view the detailed coverage report. In linux and Mac, you can use the following command:

open htmlcov/index.html

You might want to clean up the coverage files before running the tests again. To do this, run the following commands:

coverage erase
rm -rf htmlcov

Test execution environment

When first installing the project, it is advised to run the following tests:

pytest -m "environment"

Which will check for CUDA compatibility and the current OS. Specifically, if you are running on Windows, you might have troubles installing the gym_super_mario_bros package.

Team

This project would not have been possible without the hard work and dedication of all of the contributors. Thank you for the time and effort you have put into making this project a reality.

Christian Fredrik
Christian Fredrik
Brage
Brage
Kristian
Kristian
Ludvig
Ludvig
Kacper
Kacper
Vetle
Vetle
Håkon
Håkon

Group picture

License


Distributed under the MIT License. See LICENSE for more information.

About

NEAT is neat! Neuroevolution of augmenting topologies is a genetic algorithm.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%