Read the complete tutorial about how to implement a machine learning algorithm for the Flappy Bird video game here:
Machine Learning Algorithm for Flappy Bird using Neural Network and Genetic Algorithm
This video shows a creation of an artificial intelligence controller for the Flappy Bird game using neural networks and a genetic algorithm.
The program is written in HTML5 using Phaser framework (http://phaser.io/). There is also used Synaptic Neural Network library (https://synaptic.juancazala.com/) to implement entire artificial neural network instead of making a new one from the scratch.
Download source code here:
https://github.com/ssusnic/Machine-Learning-Flappy-Bird
—————————————————————–
According to Arthur Samuel, machine learning is the science of getting computers to act without being explicitly programmed. It is a fine tuning process of learning that incrementally improves an initial random system.
The form of machine learning implemented in this program uses a genetic algorithm to train artificial neural networks.
The birds are learning how to flap optimally in order to fly safely through barriers as long as possible.
The main concept is based on these 3 steps:
1. creating the initial population of 10 birds randomly
2. learning as the game is being played
3. applying natural evolution to form the next improved population
—————————————————————–
To play the game, each bird has its own neural network consisted of the next 3 layers:
1. an input layer with 2 neurons representing what a bird sees:
– horizontal distance to the closest gap
– height difference to the closest gap
2. a hidden layer with 6 neurons
3. an output layer with 1 neuron to perform flap if its value is greater than 0.5
—————————————————————–
To measure the quality of birds and select the best ones, for each bird is calculated its fitness function in this way:
– reward a bird by its total traveled distance
– penalize a bird by its current distance to the closest gap
When the entire population is dead, the fittest four birds are selected to breed a new population by using genetic algorithm operators: selection, crossover and mutation.
—————————————————————–
Visit us:
http://www.askforgametask.com
Like us:
https://www.facebook.com/askforgametask
Follow us:
Tweets by ssusnic
Music:
“Bedtime Tune” by Jay Man
http://www.ourmusicbox.com
UCj51CLgyTsILVHbGL6wvQeg
source