AI learns to play Asteroids

  • Published: 24 February 2018
  • Using neuroevolution I trained an AI to play the game Asteroids and it nailed it.
    If you enjoy what I do and want more please consider supporting me on patreon

    Check out the source code

    music from flying tunes

    songs used

Comments • 1 745

  • Code Bullet
    Code Bullet   2 years back

    Source code is up
    check it out if ya want

    • Maceo Mobley
      Maceo Mobley  2 months back

      Code Bullet wut happened to voice

    • 3XSTER
      3XSTER  5 months back

      sorry for newbie question ,but who know name of intro music 0:00 - 4:12 ?

    • Prabhakar Dev
      Prabhakar Dev  6 months back

      hey i am working on a programming language would you like to join?
      you can code a library for ais or anything you like. it would be great if a respectable person like you joins. ty.

    • Bilakshan Purohit
      Bilakshan Purohit  7 months back


    • Andrew Long
      Andrew Long  8 months back

      Is there a better way of the rays
      For "sight"

  • Ive Harzing
    Ive Harzing  48 minutes back

    Try spinning, that's a good trick!

    • LeDerrick Kimbrough
      LeDerrick Kimbrough  14 hours back

      Why didn’t you have commentary on it that’s a big part of why I subscribed

      • Tim kov
        Tim kov  5 days back

        Don’t leave!!!

        • Elvin1337
          Elvin1337  1 weeks back

          Dude I loved it when you comment too. You sound hilarious! Your content is awesome! And fuck YouTube. If you move platforms, just let me know!

          • Cam Kong
            Cam Kong  2 weeks back

            Ai gets overwhelmed and commits suicide

            • Puggleboi
              Puggleboi  2 weeks back

              Legend says to this day the ai is *still spinning*

              • Eamin Yashed
                Eamin Yashed  2 weeks back

                How dare you assume the spaceship ai has a binary gender system

                • Math Machine
                  Math Machine  2 weeks back

                  Okay, R34L T4LK

                  • Walter Engler
                    Walter Engler  3 weeks back

                    What amazes me the most about this video is the computer is coming up with playing techniques that really only a computer could use. Could you imagine a human trying to create a rapidly spinning ship then moving at the precise times needed or firing at the precise moments needed? Nope. Yet imagine this continues to grow and evolve over more generations so the aiming and predictive ability on where the asteroids will go grows. Such near constant ability to target in all directions, fire and the needed time, and then move as needed to avoid could become nigh unbeatable. It doesn't play like a human, it plays like it is better than a human. Impressive.

                    • ChannelMath
                      ChannelMath  3 weeks back

                      it probably spins like crazy so it can see in all directions not just the six you gave it

                      • ChannelMath
                        ChannelMath  3 weeks back

                        I miss your hilarious voiceover!

                        • JoaKing 703
                          JoaKing 703  3 weeks back

                          Instead of he/she you could've put it

                          • Pi61
                            Pi61  1 months back

                            Next: AI learns to play steriods.

                            • Arkadeepto Majumder
                              Arkadeepto Majumder  1 months back

                              Gohan look a piece of code can DODGE......oops wrong channel

                              • Junior Levrone
                                Junior Levrone  1 months back

                                Joguei muito esse jogo nos anos 80 e nunca vi fazer isso ai , so q n sai do lugar rema rema e fica parado...kkkkk

                                • Lily Dailey
                                  Lily Dailey  1 months back

                                  a novel concept: please use the singular "they" when referring to your creations

                                  • Carter Hall
                                    Carter Hall  1 months back

                                    Try idle breakout

                                    • FaffyWaffles
                                      FaffyWaffles  2 months back

                                      *watches beyblades once

                                      • Dustin Eward
                                        Dustin Eward  2 months back

                                        Asteroids would be better to have f the ship stayed centered no matter what, and everything else moved relative to that. More perspective... It's even hard to watch like this.

                                        • Martin9172
                                          Martin9172  2 months back


                                          • Heru Setiawan
                                            Heru Setiawan  2 months back

                                            AI learns to do steroids

                                            • Xxsharkhunter Xxsharkhunter

                                              You would be munch better if you shut the fuck up and get to the point

                                              • Someone New
                                                Someone New  2 months back

                                                Ke meeee haaaaaaa meeeeewww *HAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA*

                                                • Milky
                                                  Milky  2 months back

                                                  Mouse at gen 30 lmao

                                                  • Dummys
                                                    Dummys  2 months back

                                                    Spinbot activated

                                                    • TrisT
                                                      TrisT  2 months back

                                                      stupid inputs again gr8

                                                      • eleriel
                                                        eleriel  2 months back

                                                        Dude, this is Death Blossom ver 1.0!

                                                        • Shining Plays
                                                          Shining Plays  2 months back

                                                          I dåre YOU to wait till gen 314159265359

                                                          • XcZ
                                                            XcZ  2 months back


                                                            • BroCraft
                                                              BroCraft  2 months back

                                                              MAKE AI PLAY WORLD OF WARCRAFT OR MINECRAFT

                                                              • Johnno Gaming
                                                                Johnno Gaming  2 months back

                                                                SPINBOT HACKS

                                                                • GameGod
                                                                  GameGod  2 months back

                                                                  Holy shit this was before you got your mic wow

                                                                  • Condensating Silence
                                                                    Condensating Silence  2 months back

                                                                    Kicked from session:
                                                                    Reason: aimbot

                                                                    • AJ Morris
                                                                      AJ Morris  2 months back

                                                                      Instead of going UI, it stayed AI.

                                                                      • REGER玄奈赤櫻
                                                                        REGER玄奈赤櫻  2 months back

                                                                        CS GO spin bot

                                                                        • spaciousflame7007
                                                                          spaciousflame7007  3 months back

                                                                          It's hard to keep track, spinning, shooting, aiming, dodging, ahhhhhhh....

                                                                          • D Scott
                                                                            D Scott  3 months back

                                                                            Instead of saying AI is he/she, just call AI “it”, lol. It’s amazing that even when this AI is spinning & shooting randomly, in early generations, it still does a remarkable job of avoiding getting hit by asteroids, even when it’s off screen! On Generation 45, it's amazing to watch & probably still better than mostly all human players ever to play this game! Generation 304 was wicked sick!

                                                                            • Backyaad
                                                                              Backyaad  3 months back

                                                                              7:40 You should have added a Touhou music here

                                                                              • Reese Ochoa
                                                                                Reese Ochoa  3 months back

                                                                                small question: i find this AI self training thing absolutely absurd and i have no idea whatsoever how to do it,

                                                                                but couldn't you just AI that would be programmed to beat the game instead of learning it?

                                                                                • Reese Ochoa
                                                                                  Reese Ochoa  2 months back

                                                                                  ​@The Worst Name that is true, but of course you'd give the bot free will so like if an asteroid is coming they you would tell the bot to move, if it doesn't have to and can kill the asteroid then tell it to shoot. You still are right because this would still limit the games you could put in on.

                                                                                • The Worst Name
                                                                                  The Worst Name  2 months back

                                                                                  Yes, but how would you program it to respond to every scenario?
                                                                                  Just programming something to complete the game is the end goal, yes, but if you simply hardcode responses, it won’t be able to deal with anything completely new, the next AI would do the same thing, and it may never actually complete the game.
                                                                                  But if it learns from itself, it essentially learns to adapt to new things, which is more efficient for us humans who have a limited lifespan

                                                                              • The Hurricane
                                                                                The Hurricane  3 months back


                                                                                • this is definitely a human

                                                                                  Cant talk huh. Ppfftt

                                                                                  • bananian
                                                                                    bananian  4 months back

                                                                                    Wow, spinning is a good trick.

                                                                                    • MajorKoenig156
                                                                                      MajorKoenig156  4 months back

                                                                                      let it play BF1

                                                                                      • Agent M
                                                                                        Agent M  5 months back

                                                                                        Are you making money yet on the videos?

                                                                                        • Tim Cummings
                                                                                          Tim Cummings  5 months back

                                                                                          Radial vision would equate to precision targeting, linear forces the AI to rotate to simulate radial vision.

                                                                                          • Greyson Ragsdale
                                                                                            Greyson Ragsdale  5 months back

                                                                                            This is before the -swearing- voice

                                                                                            • Justice and honor
                                                                                              Justice and honor  5 months back

                                                                                              Spin to win