Skip to content

A Neuroevolution simulation that combines both Neural Networks and Genetic Algorithms to play the game Flappy Bird.

Notifications You must be signed in to change notification settings

Belhoussine/Boid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Boid

- This is a Neuroevolution simulation that combines both Neural Networks and Genetic Algorithms to play the game Flappy Bird.
- It takes about 20 generations for the boid to become good at the game, and about 50 to master it.
- The simulation speed and birds per generation can be adjusted using the sliders at the bottom left of the page.
- Well performing boids can be saved and loaded into the game.

Link: Boid


Boid GIF

Implement a Flappy Bird clone

  • Boid class:

    • Gravity
    • Y-velocity
    • Jump on Key Pressed
    • Die on collision
    • Boid image
    • Change head pointing position while flying
  • Pipe class:

    • Two Rectangles
    • X-velocity
    • Spacing
    • Pipe Image
  • Create Environment:

    • Create World
    • Create Boid
    • Create Pipes
    • Handle collisions
    • Background Image
    • Make a Scoreboard
    • Track generations

Implement a Neural Network

  • Design NN Architecture (10/10/2 vs 6/10/2)
  • Create Layers
  • Randomize weights
  • Add activation functions
  • Copy Neural Network function
  • Predict / Think function
  • Save NN of boid with Best Fitness in JSON format
  • Load NN from JSON and assign it to a boid

Implement a Genetic Algorithm

  • Create a Generation of Boids
  • Implement Mutate function
  • Implement a Crossover function
  • Copy NN with best fitness
  • Create a generation of mutated boids from best NN
  • Create a slider for learning speed
  • Store boids with best Fitness from every generation

NOTE: It is recommended to have at least 100 boids per generation for a faster training.

About

A Neuroevolution simulation that combines both Neural Networks and Genetic Algorithms to play the game Flappy Bird.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published