Skip to content

Created a clone of the popular game Flappy Bird using pygame and then implemented the neuro evolution of augmenting technologies (NEAT) to train an agent to play the game.

License

aryanbh11/AI-Flappy-Bird

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI-Flappy-Bird

About

Created the popular game Flappy Bird using pygame and then implemented the NEAT algorithm to create an AI that learns how to play the game.

Libraries Required:

pygame, neat

How to run?

Clone this project and then from the project directory run the following commands:

>> pip install -r requirements.txt
>> python3 flappy_bird.py

How it works?

Neural Network Setup:

  • Inputs: Bird Y, Top Pipe, Bottom Pipe
  • Outputs: Jump or not
  • Activation Function: tanh
  • Population Size (To start with): 20
  • Fitness Function: How far the bird goes
  • Max generations: 30

The first generation is a set of 20 birds acting randomly. Future generations keep getting better as they are made from the best performing birds from the previous generations. From my testing of the program, a bird which can play the game indefinitely without losing can usually be found by the 4th Generation. Since this is a rather simple game, one can actually find a "winner" bird in the first generation itself if the Population Size is increased but then you never see the algorithm in action on your console so I decided to reduce the Population size.

About

Created a clone of the popular game Flappy Bird using pygame and then implemented the neuro evolution of augmenting technologies (NEAT) to train an agent to play the game.

Topics

Resources

License

Stars

Watchers

Forks

Languages