Flappy Bird NEAT is a Python implementation of the popular Flappy Bird game, enhanced with the NEAT (NeuroEvolution of Augmenting Topologies) algorithm. This project showcases the application of evolutionary algorithms in training a population of virtual birds to navigate through challenging obstacles, demonstrating the power of machine learning in achieving intelligent and adaptive behavior.
-
NEAT Algorithm Integration: Utilizes the NEAT algorithm to evolve neural networks that control the behavior of virtual birds, allowing them to autonomously learn and adapt their strategies over successive generations.
-
Dynamic Obstacle Navigation: Birds are tasked with navigating through dynamically generated obstacles (pipes) by flapping their wings. The NEAT-trained neural networks determine the birds' actions, showcasing the emergence of intelligent decision-making.
-
Scoring System: Tracks the performance of each bird in terms of the distance traveled and awards fitness scores accordingly. The goal is to achieve the highest possible score by efficiently maneuvering through obstacles.
-
Clone the repository:
git clone https://github.com/ssspetrovic/flappy-bird-ga.git
-
Navigate to the project directory:
cd flappy-bird-neat
-
Create a virtual environment (optional but recommended):
python3.12 -m venv venv
-
Activate the virtual environment:
-
On Windows:
venv\Scripts\activate
-
On Unix or MacOS:
source venv/bin/activate
-
-
Install the required packages:
pip install -r requirements.txt
Run the NEAT algorithm with the provided configuration file:
python main.py
This command initiates the Flappy Bird game, where a population of birds undergoes training via the NEAT algorithm, showcasing the evolution of intelligent behaviors.
- Python version: 3.12.1
The NEAT configuration file used for training the birds is located at config/neat_cfg.txt
. Experiment with this file to fine-tune NEAT parameters and observe the impact on the learning process.
neat-python==0.92
pygame==2.5.2
This project draws inspiration from the classic Flappy Bird game and highlights the potential of the NEAT algorithm in creating adaptive and intelligent agents. The Flappy Bird assets are employed for educational purposes and are not owned by the creator of this project.
This project is licensed under the MIT License. Feel free to use and modify the code for your own projects.