Skip to content

mariolpantunes/flappy-bird

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Learn to fly using neural evolution

In this work, we will learn to fly using neural evolution. That means teaching a neural network to play a simplified version of the well-known flappy bird. Given the nature of the game itself, it is not easy to train a neural network in a conventional way (using a curated dataset, and a guided optimization based on the gradient). We will instead on different methods that explore the usage of reinforcement learning and genetic optimization to train consecutive improved versions of our model.

The slide for the project can be found here.

Arquitecture

The game is manage by a backend process, the web pages only draw the world, show training data and implement the user input. There are two other processes: train and play. The train process can be used to train a neural network to play the game using population based optimization. The play process loads a neural network and plays the game. There are a webpage dedicated for each phase.

The arquitecture can be found on the following image:

arquitecture

The training should look something like this:

training

And the fully trained agent should look like this:

playing

Usage

Setup

git clone https://github.com/mariolpantunes/flappy-bird.git
cd flappy-bird
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Backend

In a terminal run:

source venv/bin/activate
python -m src.backend [--pipes] -n <number_of_players> -l <limit>

Training

In a terminal run:

source venv/bin/activate
python -m src.train -n <number_of_players> -e <number_of_epochs> -a [ga|gwo|egwo|de|pso]

Playing

In a terminal run:

source venv/bin/activate
python -m src.play -l <model.json>

Documentation

This library was documented using the google style docstring, it can be accessed here. Run the following commands to produce the documentation for this library.

pdoc --math -d google -o docs src 

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published