Neuro Evolution with Fixed Topologies (NEFT) Algorithm in Flappy Bird (from scratch without ML Libraries)
Show support:
Star 🌟 the Project:
Follow 🤝 on GitHub:
Made by maxontech
This is the Flappy Bird Game using NEFT and Pygame written in Python. NEFT stands for neuro evolution of fixed topologies and is a genetic algorithm that creates artificial neural networks.
In contrast to the NEAT algorithm, NEFT does not change the topology of the neural network, but only the weights. In this project, NEFT is used to train an AI to play the Flappy Bird Game. See how far your AI can Fly!
If you want to see how this project was built, you can watch the video here: Building the Flappy Bird A.I. without LIBRARIES
Requirements: You must have Python installed and preferably a code editor like PyCharm.
- Clone the repository
- In the terminal, navigate to the directory where the repository was cloned, e.g.,
C:\Users\Max\PycharmProjects\neft-flappy-bird
- Create a virtual environment, activate it, and install pygame by running the following commands in the terminal:
python -m venv venv #This creates a virtual environment venv\Scripts\activate #This activates the virtual environment pip install -r requirements.txt #This installs the required libraries
- Run the game by running the following command in the terminal:
python main.py
Note on PyCharm: Often PyCharm detects the requirements.txt file and asks you to install its contents and create a virtual env. That's the easiest way to get started. If you want to do it manually, you can follow the steps above.
You don't need to control the bird. The AI will do that for you :)
Alight, I confess, although I said "without libraries" in the video title, I did use the pygame library to create the game. However, the NEFT algorithm is implemented from scratch.
- pygame: Pygame is a cross-platform set of Python modules designed for writing video games.
- How to Open GitHub Projects in PyCharm? Explained Here
- How to use Virtual Environments? Explained Here
- How to install PyCharm and Python? Explained Here
- How to set PyCharm Config. and Interpreter? Explained Here
Feel free to reach out to me on Twitter if you have any questions or feedback! Hope you find this useful!