PYGAME MENU LIBRARY FAILED AND/OR IS OUTDATED. FOR THIS REASON BY DEFAULT ONLY THE AI WILL RUN FOR SHOWCASE.
Using the NEAT Genetic Neural Network Architecture to train a set of birds to play the popular game Flappy Bird. Also playable by user.
This project was made using only the Python programming language.
Using the open-source NeuroEvolution of Augmenting Topologies (NEAT) library in python, we can train an Artificial Intelligence through a reward/punishement system to learn to play the popular game Flappy Bird.
The user can choose the population number of birds, to try different architectures of neural networks at the same time, and also the generation number, which determines how many times the AI plays the game, training itself after each generation to play better. (Generation and population option is saved after one game is played using these options)
The user can also play the game. The high-score of the user is also saved, even after the game is closed and reopened.
- Requirements: Python 3.5+ (64-bit)
- Run below lines in your terminal
| Terminal | Demo |
|---|---|
$ cd ../FlappyBirdAI-master$ pip3 install -r requirements.txt$ python3 flappy_bird.py |
![]() |
| User | AI | |
|---|---|---|
![]() |
![]() |
|
| Options | None |
|
| User | AI |
|---|---|
|
|
Output will be in the same folder ../FlappyBirdAI-master. For explanation on used terms, refer to Neural Network Architecture
- The Neural Network only starts with connected input and output layers as shown below.
- Hidden layers, bias neurons, and weights are then added. substracted, and modified as needed, (hence the Augmenting Topologies in NEAT).
- Each bird is different from the other. Bird species is defined when birds possess different base architectures of nodes connected to one another. Birds of the same species only have different values for their weight connections.
- Bird fitness is measured by score and distance. By trying to maximize fitness, the neural network changes it's architecture each generation to fulfill that goal.
The used activation function in this neural network is the TanH, where if an output of more than 0.5 is calculated, the bird jumps
- Jad Haddad : jadhaddad01@protonmail.com
This project is licensed under the GPL-3.0 License. License Details





