AI Learns How To Play The Chrome Dinosaur Game
HTML-код
- Опубликовано: 26 сен 2024
- Don't Click This: shorturl.at/pdYvW
I coded an AI that learns to play the Chrome Dino Game.
Twitter: / tyler_mommsen
Discord: / discord
• AI Learns How To BEAT ...
The equipment I use: amzn.to/4dSZ6i4
#ai #gamedev #artificialintelligence
If you're interested in the source code here ya go github.com/TylerMommsen/chrome-dino-game-ai
did you forget to put "inspired by code bullet? or have you never heard of him?
@@DRAMAnSkribblio watch my flappy bird video, i mentioned it at the beginning. He inspired me to do this channel
I was just about to ask for this, thanks!
Hi, When I clicked on this video, I belived that it was some randome 1 mil or 100k youtuber by just looking at the quality of the video, then I look down and to my surprise you have only 60 or what subscribers. That's not fair! You have realy good content. So happy that yt algorithm showed me this film. Keep up the good work!
Thank you I appreciate it!
I’ve seen this guy’s other videos and I could have sworn I was subscribed but apparently not ??
@@TylerMommsen WAIT WHAT ONLY 264?!??! NO WAY GG!!
I have more than that!
Same
bro that visualisation of the network was the first time i’ve actually understood it
i can really agree on that, first time actually seeing it working and on display
Electronic engineers use hardware like sensors and controllers to make it to 7000 but you just recreated the whole game with a neck down dino which jumps on its own 😭😭
Tbf not really a fair comparison considering AI has direct memory access
This is not ai, it just use sensors, i already made it
i can't believe you built the game from the ground up to make the AI lol,
good job man
Look up code bullet. He pretty much made this same video 6 years ago. This videos better than his verson but his newer videos are pretty cool
@@shadowkyber2510 CB's videos are more entertainment than education for sure lol. i still love them!
I was godsmacked when I saw you only have 180 subs and this ain't a 100k+ view video... Really, that's a damn good video!
Thanks I appreciate it!
Yeah I agree
Wanna viewbot this so bad.
Seems to have blown up. 1.63k subs deserved.
I once found an about 10-line script for the original chrome dino that could play it withoug a neural network and basically only failed when the game gave it an impossible combo of cacti (which sometimes happens in the original game, where two cacti are in the exact distance from eachother that you can neither jump inbetween them nor jump over both in one go. ).
10 line script??? Damn I need to get my coding skills up 😭😭😭
@@TylerMommsen
It wasn't ten lines, it was actually one line with 1164 characters. I'll try to post it here but cannot guarantee the comment won't get deleted:
function keyDown(e){Podium={};var n=document.createEvent("KeyboardEvent");Object.defineProperty(n,"keyCode",{get:function(){return this.keyCodeVal}}),n.initKeyboardEvent?n.initKeyboardEvent("keydown",!0,!0,document.defaultView,e,e,"","",!1,""):n.initKeyEvent("keydown",!0,!0,document.defaultView,!1,!1,!1,!1,e,0),n.keyCodeVal=e,document.body.dispatchEvent(n)}function keyUp(e){Podium={};var n=document.createEvent("KeyboardEvent");Object.defineProperty(n,"keyCode",{get:function(){return this.keyCodeVal}}),n.initKeyboardEvent?n.initKeyboardEvent("keyup",!0,!0,document.defaultView,e,e,"","",!1,""):n.initKeyEvent("keyup",!0,!0,document.defaultView,!1,!1,!1,!1,e,0),n.keyCodeVal=e,document.body.dispatchEvent(n)}setInterval(function(){Runner.instance_.horizon.obstacles.length>0&&(Runner.instance_.horizon.obstacles[0].xPos75&&(keyUp(40),keyDown(38)),Runner.instance_.horizon.obstacles[0].xPos
@@TylerMommsen
Try to look in your comments moderation tools for an autodeleted comment answer from me, as RUclips didn't like that I pasted that script in there (it's actually one line of 1164 characters). You can copy the line from that comment or maybe even undelete it for others to see.
@@Lampe2020 Ahhh 1164 characters thats why the script was 10 lines lol. Also, I couldn't find that comment for some reason idk why
It's because the AI was coded from ground up, not trained. Trained AIs or Deep Reinforcement Learning are more entertaining, and good for more complex tasks and finding glitches
0:48 Iconic Mario Fail
I was today years old when I learned you can crouch.
Same
Does anyone see any low flying birds? I thought there were supposed to be birds on the ground that you had to jump over
Yeah some other people mentioned that, but I completely forgot about those birds. It probably would have drove me insane lol
😂
This video will change the career of this RUclipsr
Yes
Waiting
6:33 Its like Dino's are skating on the snow😂
Damn bro, I thought you had over a million subscribers only to see you had 600+, this is some underrated content right here!
YT recommended me this for a whole day now and I decided to finally watch it. No regrets! I hope this will hit the algorithm soon!
Awesome video! We need more quality devs like you! 😅
hope you blow up! this type of content deserves 100’s of thousands of subs!!
That last dino from gen 57 was a menace
Great quality video. I can tell lots of effort went into it
I was here before 1k I’ll see you when you get huge cause this is some high quality content and editing
Thats so cool keep up the good work
Tbh i was expecting way more followers you deserve a lot more !
Man this work is awesome. I wish I reach your level one day.
i'm surprised you don't even have 1k subs, this video is amazing!
I love how the AI don't care about the obstacle height and width, they just cared about the distance
underrated, so much skill and effort is put into this video
After k saw the video i believed it is a youtuber with like 100k - 300k i was shocked its only 3k
Great quality wish you success more on this platform
This video taught me that there was a crouch option in the Dino game
Too but is till don't know how to do it
Hey i just discovered your channel a few days ago and it's really well made and consistent keep it up
It's not a bird.
It's multiple birds
Fun fact: At chrome://Dino you can play the dinosaur game without the internet
Pterodactyl
@@DJacoby-zc1ys no it's not
@@Sophloveswolves thank you
Ayooo this soo good. Keep it up bro and I'd suggest maybe making tutorials etc on the side cuz im sure people would find it intriguing to learn how to do these types of things. I can see your channel get a lot brighter in the future and i wish you best of luck ❤
The dino ducking everytime it touches the ground looks funny and cute (≧▽≦)
Full marks to the algorithm for bringing this video from a creator with only 3k subs to me
Great video man pls do more
Wow man, I really enjoyed this video, this really motivated me to look into AI myself, and maybe try and replicate your experiment, kudos!
Thank you! Definitely give it a try, it's real fun once you get it working
This is pretty awesome! :3 I understand that lots of people arent really interested in the technical side, but im sure a few people would probably enjoy a slightly more in depth analysis for how this stuff works and for example what frameworks you used to build a project, i eat programming and technical information for breakfast lol :3 otherwise amazing video! :3 P.S. i loved the sound design and music choice :3
I just recently found your channel (yesterday) and have now watched your latest three videos. At first I thought you had a lot more subscribers because the quality of the videos was very good.
Nonetheless I got a tip for your future videos: In the long run, the videos are all relatively the same. At first it was cool to see you recreate Doodle Jump and then watch how the AI evolved. After that I saw the dinosaur game (where I skipped some of the end) and now this one. The Flappy Bird and Chess video no longer appeals to me as the videos are all relatively similar and I know what's happening. Maybe you could add a certain aspect to the individual videos that makes watching them feel like added value. Otherwise, as already mentioned, the videos are of very good quality, but I'm missing a certain USP.
Oh wow, I thought you had a lot of subscribers because of the quality of the video, but I just realised that you only have around 600, you deserve a lot more!
This was really entertaining! You deserve way more subscribers
There’s no way this guys only got 4k sub keep up the good work ❤
your amazing not even 1 thousand subs and producing videos like this and just giving your fans the code like that. keep it up man
0:44 Dino: pfft, screw gravity * starts defying the laws of physics * 0:47 Dino: imma jump * starts going into the backrooms* AAA-
Wow near the end the ai is better than me
That entire last attempt (starting around 8:13) there was no connection to game speed until it died and Gen 58 spawned - it was lucky. I suggest a sequel aiming for 1 million points or 100,000 or something.
Would it have been better to let them master the jumping first then after that add the birds? I would assume that having anything learn one thing at a time would be easier. Good job by the way. I love watching these learning AI.
You're right, that actually would have been a lot better I don't know why I didn't do that. I'll make sure not to forget for future AI vids. And thanks for the support!
i love these types of coding videos :)
This is probably one of the best videos I've ever watched
Thank you man I appreciate it!
extreamly great content, you got your 800th sub! congrats
code bullet frfr
Thank you for dropping the source code! It's a great thing to study.
Great video, love the visualisation! Gonna check out some more videos.
Also an idea which came to my mind. If you have implemented the game on your own, maybe make a game speed change randomly for example, so it can depend on it more? Not sure if this is effective tho.
Thanks for the support! You're right, using different game speeds would definitely help the dinos learn that faster and it would be effective I just forgot to implement that kind of variation training for this video
Its me! The 100th subscriber!!!
No fr tho youre pretty underated.
Hey man! Great video. When watching the video I thought this channel had at least 300-400k subscribers! Do you have any ressources and tips to start learning AI? I know Python and JavaScript but I just don't know where to start learning AI.
Hey man thanks! You're already doing very good knowing both those languages. I responded to your other comment on the flappy bird video with some resources. Hope it helps!
you need more subs cause this video is epic
Glad to be here. Really lovin the content
That music with the jumping though
Dude make snake next!!!
Btw, SUPER UNDERRATED, you deserve 10 million subs
That's really good! You earned a sub👍🏻
really good video!! you deserve much more attention
great stuff, looking forward to the next one!
4k subs only wtf, lemme share it to ma frnds rn.
How is this guy not big yet? Very good videos
You have awesome content bro this is amazing
18 years and I just found out you could duck in the dinosaur game 😂( how did I miss that for so damn long )
I know you'll be famous one day 'cause of your content... Enjoyed watching your videos... Doing Great...
The bird is the word
Only 3k subs bro's definitely underrated af damnnnnn
Awesome work dude you might be become my inspiration
I saw this video on my youtube homepage after taking a break from making a neural network(AI) play the Dino game for a youtube video I'm working on and well I got to think of something else to make it do.
The algorithm blessed me with this video. Thanks man ❤
Two former Code Bullet projects in a row?
This is hella good bro.
RUclips must be glitching, there's no way you only have 286 subs
“I’m not a genius” (coded flappy bird and dinosaur game from scratch)
Holy shoot your underrated how do you only have 270 subs???
My internet is shit lol
There is no way this guy only has 3k subs he requires more!
Great! Now try the game called "stack"
i love how the ai gave no care a out width or height
funnily, the AI had reached 15k while ignoring 3 of the more important factors it receives
amazing video! you need more subs. I love development and stuff, what library are you using for the ai?
I used JavaScript for the whole game with the p5 library for the visuals. As for the AI, I didn't use a library, but I believe there are libraries for NEAT in js but I've never tried them
iirc, the birds don't spawn before 200 and speed tops out at around 700 (or was that day/night swap trigger)
Codebullet vibes. Keep it up
we definitely need the source code Great Job
this is the kind of video the google youtube channel should comment on
Big and small jump? Isn't there just "Jump" in chrome dino?
There may be different versions of the game but I believe there is a small and big jump
@@TylerMommsen
I just discovered that too through an autoplay script that I let loose on the ungoogled-chromium dino game XD
@@TylerMommsenIt depends on how long you hold the spacebar
I’m getting code bullet vibes 👀 good content tho
If you want the AI to get a connection to game speed faster and more reliably you should at the very beginning make the game speed it starts at random for the training purpose and later have it back to normal when the actual training is done and you're going for the score
Something interesting:
In this video, the AI learned, through brute force trial and error, how to play the game near perfectly in 58 generations. This game just includes two things: jumping over cacti and avoiding birds.
Let's assume there is a new generation of humans every 30 years (average age of mother at first childbirth is 27.3 years old). Equalizing AI's generational development to that of humans, it would take a population of 500 AIs, 1740 years (58 x 30) to master two things. Way too lenient of a timing for humans to master two things at the same time.
This highlights the human creativity. We learn much faster than AI. You don't see a toddler touching a hot stove 58 times before knowing that the stove is hot and dangerous. An AI toddler would have 58 counts of 3rd degree burns before it realizes that danger.
On the other hand, what AI lacks in intelligence, it compensates with sheer computing power and memory. Allowing it to use its brute force method, something humans don't have the luxury to do.
I never think that AI would takeover the world from humans. Just be wary if what you're doing is simple and repeatable. In short, capitalize on your human creativity and intelligence or else risk being replaced by AI.
Unfortunately, many humans lack the basic intelligence and creativity. 😢
Such a cool project, how do you make the AI? Any specific tutorials?
I'm like the dinos when I play this game.
I never care about the speed. Only how close the cacti is.
Although the day/night cycle has theown me off multiple rimes.
wow, thanks for video and source code!
Only 946 subscribers? What
In this game speed is a problem only for human players. Because we can't see the obstacles and judge the distance in time.
The AI has the distance as a given all the time. And if for some reason there is a big enough delay for the distance input, it will be at the level where the screen is all just a blurr anyway.
you can make dinosaur invisible by pressing ctrl + x
quick tip for training them faster, train them when the dinos when the game speed is standard and when the game speed is higher. this way it is faster to trian the dinos since they don't have to go for a long while to hit high game speed.
yeah that would have been smart, my dumbass chooses the hard way though for some reason
Yeah I'm also wondering how you got this good at making videos - this can't be your 4th video ever. Even when I poured a massive amount of time into a video 2 years ago it wasn't nearly this good and the end was better than the beginning because I got better while making it... I've tried only working on one thing at a time since then.
Keep making content man and improve 1 thing every single video. And you're right this isn't my 4th ever video. I have had 2 failed RUclips channels before this and made 100+ videos before this and they all flopped, but through those I learned video editing. But this is the first time i've tried making this style/type of content and it's still quite new for me and i'm still learning
9:12 best move by AI😅
0:56 this guy can say son of a bitch normally like he doesnt care xd
aight you didnt add low flying birds i think the speed increase is to slow in the origanil at a point mark the color switches sometimes and birds and cactuses cant be spawned at the same time here birds spawn too early and theres no short break at the beggining before cactuses spawn thats all the diffrences i noticed
bro is too underrated
respect to that one dino that just kept ducking all the time
681 subscriber? What? I believe you'll get thousands in a week or so