Coding Challenge #100: Neuroevolution Flappy Bird - Part 5

preview_player
Показать описание


Other Parts of this Challenge:

References:

Videos:

Live Stream Archive:

Related Coding Challenges:

Timestamps:
0:00 Part 5 of Flappy Bird--Save/Load a Bird
6:42 Use SaveJSON to save the weights of the neural network
9:39 Save the weights of the best bird
10:41 Remove genetic algorithm and load the neural network of the best bird
15:23 Load a "good" and a "bad" bird and compare their collisions
17:28 Conclusion and possibilities for refinements

Editing by Mathieu Blanchette
Animations by Jason Heglund
Music from Epidemic Sound

#neuralnetwork #reinforcementlearning #geneticalgorithm #evolution #flappybird #javascript #p5js
Рекомендации по теме
Комментарии
Автор

I hear you say a lot that you'll just randomly pick a number of hidden nodes to use for your network. In my class in A.I., when learning about Neural Networks, we were taught a great heuristic is to use one hidden layer with nodes equal to the average of the input and output nodes (i.e. #inputs + #outputs / 2). Then you can start experimenting with more layers and/or nodes to fine tune the network.
Love the videos!

kingezikiel
Автор

Can you code a Rubik's cube solver for the next CC ?

shaharmontekyo
Автор

One thing you can implement is the distance between the pipes to decrease after every, say, 20 pipes so that the "Best bird" isn't just the first bird that can play at that specific pipe gap forever without dying.

sadhlife
Автор

I am a civil engineer and i am learning programming because of you man, you are cool teacher.

Dpksh
Автор

Loved this series! I actually made a flappy bird clone based on this (without the neural network). I ended up doing some geometry to calculate collisions based on the perimeter of the circle. A nice little enhancement to make to this 🙂

dave
Автор

Excellent series on neuroevolution 8-)

phillipneal
Автор

U r the world's best programmer and teacher

wolfisraging
Автор

i love how you said there might be a part 6 hahaha

xLoxLoLex
Автор

You can do as many parts of this challenge as you like! Haha
I'm also looking forward for some TensorFlow.js tutorials! It looks like it is very powerfull, and there's not much on the internet for folks like me, who doesn't know much about programming.
Thanks for the content you make!

xThomasMarcelo
Автор

Can you do a coding challenge with a neural network that takes in an image one day? Something like that seems like magic to me

frey
Автор

I'd like to add that u could decrease the value of randomGaussian() as the score increases. It helps a lot if u make the game "harder" with smaller space between the pipes and bigger value of bird's "jump" f.e. -18 instead of -12. It should look something like:

mutate(rate, score) {
function mutate(val) {
if(random(1)<rate) {
return val+randomGaussian()*Math.pow(1.00001, -score);
}
else {
return val;
}
}
then u map this function to weights and biases

edit.
after many fails i think I found the best function.. :D
return val+randomGaussian()*pow(1.3, -0.00001*score)*0.7

likeyou
Автор

There is one more thing that could be done, you could add 3 more inputs for the second upcoming pipe : his distance from the bird, and his top and bottom part height. It's relevant informations because when the holes of pipes next to each others don't have the same level at all, there are some strategies to take that situation into considerations. I've tried it myself and the birds actually changes their positions inside the current pipe so that the bird's level is the closest to the next pipe level. The downside of course is that it takes much longer for the bird to learn how to behave properly.

Anyway that serie was really interesting, i'm wondering something now, in this game there was only one thing to do for the bird, going up or not. But what about a game where differents actions could be done by the player, going up or not, and going on the left or on the right ?

vioufviaf
Автор

Maybe I missed something, but I don't see any actual training (backpropagation) done in the code?
Doesn't this defeat some of a NN's purpose and reduce it to a simple "if input then output" function that doesn't learn, but rather gets picked and changed randomly rather then through a learning process? I mean, this works fine, but for me the genetic algorithm does the most part here, and the NN's role is pretty passive.

MattRose
Автор

As someone that don’t know anyting about coding yet this look hard to learn and be comfortable with but it looks so much fun to do !!!

bulittix
Автор

i love if you make some series for electron app development!

tusharmaurya
Автор

Hey, id really appreciate if you could do some videos on creating a decentralyzed app with ethereum!!

uplife
Автор

To make it a bit harder and a bit more like the original flappy Bird you should make the bird a more oval shape you could use the train from your original challenge and now the thing that makes this harder is that now that it isn't a circle you should make it so the bird when it jumps its nose or what you would call it the front of the bird would go up and the bottom of the bird would go down making it harder for it to just shimmy through the hole like it does now.
Hope you'll take this into consideration and if you need to see what I mean search on Google for flappy Bird gif and you should start to see what I mean, and maybe make the gravity a bit stronger as well, I mean if you wanna make it harder for the bird and probably also yourself but at least we'll get a kick out of it.

lassenrbjerg
Автор

I've noticed that in the original flappy bird the mechanics are a bit different in sense that when the bird touches the ground it dies, isn't it?

andrewkosenko
Автор

Hey man, I loved following this whole set of videos!
Freaking Awesome Stuff!!

But I have 1 itsy bitsy thing I'd like to do....

I need an image parser, so you know, training a neural network to recognise
(Or trains?)

Either or... - PLEASE see if you can make a quick sketch that parses jpg's or png's - IN Javascript.

Without using the canvas if possible.

- Again... Awesome Awesome Videos!

synju
Автор

Hey Dan, is it possible to make population of best Bird ?

ara