A.I. Learns to play Flappy Bird

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

Finally something AI is better at

👍︎︎ 2 👤︎︎ u/Jetidera 📅︎︎ Dec 22 2018 🗫︎ replies
Captions
hey guys welcome to today's video today we're going to do some flappy bird action and I know I am hardly the first person to do this on YouTube and that's because it's kind of pretty easy so today we're going to be doing this as a one day challenge I've got a day to make a fully functioning version of flappy bird and at the AI to learn how to play it so the day before I knew this was going to be a big day and thus I set my alarm to wake me up right nearly at 6 a.m. the next morning I jumped out of bed ready to begin my day and only press the snooze button 12 times so um yeah it's like 8 a.m. now that could have gone better probably um but I'm ready now I just need to check YouTube for a while it is my job after all and oh my god it's 10 o'clock okay okay deep breaths okay let's just get started okay so let's just start off playing some flappy bird for a while so get a feel of what we're doing and as you can see I'm really not fantastic at this game but that is what my computers for so let's start coding so to begin with let's just get a circle on the screen which is affected by gravity it's beautiful okay so I'm yet that's great no but we need that bird to fly so when I hit spacebar we need to apply a force pushing the bird upwards this took some adjustments to get the flap just right but I'm happy enough with the movement for now okay let's start on the putt the pipes are just gonna be rectangles which move from the right side of the screen to the left not nice um you'd think by now that I'd be capable of drawing rectangles to a screen but nope you'd be wrong you'd be wrong okay there we go now we just need to add some collision detection beautiful instead of dying I just had the bird teleport to the top of the screen when hit because I haven't implemented the dying mechanism yet so on the everyone pipe makes this game ridiculously easy we need to add a pipe on top to make a pipe pass this requires tweaking the collision system a bit but it's really not too bad here we go very nice yeah we're getting close now although the game is still a little too easy so I made a bunch of small changes to make it more difficult including but not limited to once again twerking the jumping mechanics changing the thickness of the pipes I made the player actually die when hitting the putt and decrease the distance between putt pairs and here she and I added the ground and here she is okay so the game is functional now and I could just add the AI to this but I want to make it look actually like flappy bird and we got time right what's the time it's 1:00 p.m. [Applause] we got time we got time so it is time to dust off my pixel art skills and let's get drawing first out let's draw the bird [Music] okay now we're going to need to draw the pipes I'm actually really happy with how the pipes look but that's mainly because I pretty much just copied the pipes in the game pixel for pixel I told you I had skills oh no Evan the pipe is too short you ready for this boom pipe four days bought okay now we need a background and unfortunately my screen capture software apparently went on lunch break during this part because it forgot to record most of it but you get it it's sky clouds building grass yeah so anyway let's Shang the pics in we got background we got pipes we got birdie so yeah I'm pretty happy with how everything looks however the bird looks really stiff and kind of weird so let's make the bird tell up when it's flapping and tilt down while it's falling okay beautiful now the game is done and what is the timer I it's 5:00 p.m. okay that's okay I didn't think I was that slow at drawing but that's okay I did have a nap in the middle of drawing so that probably didn't help but yeah that's okay we're just gonna need to add the AI quickly luckily I've done this before so I've coded a pretty good library which you can just Shang in and change a few details it's not quite that easy but close enough for the a I am using an algorithm calls neat which teaches neural networks to play the game to the process similar to evolution in nature hook up the neuro networks to the game we need to specify what the players can see what the players can do and how to tell if a player is doing well so the players can see the distance to the next pipe the birds vertical velocity the vertical distance to the top pipe and the vertical distance to the bottom pipe the actions players can take is actually really simple it can either jump or not jump and for the fitness function which tells us how well is player did so we can choose the best players to pass their genes on to the next generation we can simply use how long each bird survives so if a bird survives longer and it will do better simple stuff with that done it's 9:00 p.m. and I'm going to bed because I've got to get my twelve hours of beauty sleep so enjoy [Music] [Applause] yeah I was gonna do a Christmas special episode but I didn't have the time so here we go Merry Christmas [Music] hey guys guess what it's Christmas and that means gifts are a thing which I kind of hate because I had so much stress like do I get my grandma and eighty seven hundred or eighty seven hundred K core i7 processor I mean I can't just ask her straight up if she was to overclock her rig because that would spoil the surprise it's just a mess so if you can't decide what you're getting someone for Christmas then get them the greatest gift of all knowledge spread the love of math science and computer science to your loved ones by gifting them brilliant this really excites me because it's such a fun way to nurture curiosity build confidence and develop problem-solving skills crucial to everything in life school job interviews and their career it's really just a top-tier gear bruinz thought-provoking content breaks up really complicated issues into bite-sized understandable chunks which will lead your loved ones from curiosity to mastery so go to boon dog slash code bullit and grab a gift subscription to help your loved ones finish their day a little smarter now thanks for watching and yeah Merry Christmas thanks for a great year honestly it's been awesome we just hit 500,000 subscribers which is insane I should probably do like a 500 subscribers special five hundred thousand subscribers special sorry but I really can't be bothered and I don't know what I do maybe q-and-a something I'll be yeah anyway so thanks heaps I'm actually going on break for like a week or two because Christmas and family and stuff but I will also be spending some of that time learning about some better techniques to train a ice-like deep Q learning and PPO which is what open AI used to beat dota 2 which is some pretty next-level stuff so um if anyone knows any good resources for learning those hit me up on Twitter but anyway have a good Christmas ever now
Info
Channel: Code Bullet
Views: 13,320,853
Rating: 4.9059696 out of 5
Keywords: artificial, intelligence, coding, processing, java, machine, learning, genetic, algorithm, evolution, computer, science, programming, comedy, educational, flappy bird, rage, challange, javascript, p5.js, deep learning
Id: WSW-5m8lRMs
Channel Id: undefined
Length: 7min 45sec (465 seconds)
Published: Fri Dec 21 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.