Flappy Bird AI πŸ₯

Date: 13.02.2020

My goal was to develop an AI that can fly through the pipelines. This project uses Evolutionary Algorithms to improve the performance of agents over time.

The development of the AI was quita a fun project. Contrary to using Q-learning where the agents are trained in a β€˜classic’ fashion (using Stochastic Gradient Descent), evolutionary algorithms are purely random: they can have success in evolving an agent that has a good performance, they can fail as well.

Nonetheless, it was fun to see the agents improve over time and to see that from a completely random set of weights, evolutionary and biological principles were able to evolve an agent that performs well in the Flappy Birds environment:

And it works! After 50 generations, agents had evolved that were able to steer perfectly through the pipes! 🀩

Best generation

In just 50 generations, evolution was able to create an AI that scores perfectly in the environment. It feels like order from chaos: we started with 100 agents with randomly chosen weights. By just following the principles of survival of the fittest πŸ’ͺ and biologically-inspired transmission of encoded information from parent generations to their children πŸ‘¨β€πŸ‘©β€πŸ‘§β€πŸ‘¦, we were able to get better and better agents (although we were lucky that we randomly chose those weights from parents that created a good behavior of the agent). 🀯

Performance evolution

You can find more detail in the projects documentation, where I explains more about the approach that I have followed while developing the Game framework and the AI itself: Github: brakid/FlappyBirdAi