Teaching A.I. to Play my Game!

  • Published on Sep 13, 2019
  • Making my very first A.I, and trying to make it play my game "Balls?"
    DOWNLOAD "Balls?" play.google.com/store/apps/de...
    ➤Discord - discord.gg/dani
    ➤Facebook - DaniMilkman/
    ➤Twitter - DaniDevYT
    ➤Music by Evan King, check him out!!
    0:07 - 0:40
    Evan King - Button ( thexvid.com/video/KVbPaZLf4Qc/video.html )
    0:47 - 1:27
    Evan King - Scuba ( thexvid.com/video/BxQwVLa1HnI/video.html )
    1:45 - 3:53
    Evan King - Moon Base ( thexvid.com/video/orooE4jp1ak/video.html )
    3:58 - 6:10
    Evan King - Mask ( thexvid.com/video/abh59iiH3gc/video.html )
    6:38 - 8:00
    Evan King - 20XX ( thexvid.com/video/kZRQosq3PjM/video.html )

    A couple of weeks ago I made a video "Making a Game in ONE Day (12 Hours)", and today I'm trying to teach an A.I to play my game! Basically I'm gonna use Neural Networks to make the A.I learn to play my game. This is something I've always wanted to do, and I'm really happy I finally got around to do it. Some of the biggest inspirations for this is obviously carykh, Jabrils & Codebullet!
    Check the bottom of the description for links of videos by them and more that you should check out if you enjoyed this one!!

    Hey! If you're new here, welcome! I'm an indie game developer, currently working on a physics based game using Unity. This is my devlog / devblog where I show off the progress I make on it. I'll try uploading every week, but I'm pretty busy with university and part time job, so I won't have time every week. But I'll do my best!

    GTX 1060
    16GB RAM

    Laptop / tablet
    Surface Pro i5, 8GB RAM, 256GB Storage

    My Equipment:
    Keyboard - Steelseries 6Gv2
    Mouse - Steelseries Rival 100
    Mic - AT2020+
    Screen - ViewSonic 24" LED Curved VX2458
    Headset - Steelseries Arctis 3

    If you enjoyed this video, here are some other really good ones I was inspired by:
    Carykh (This is the first guy I found doing A.I videos, absolutely check him out!!!)
    Carykh - Evolution Simulator (Part 1/4)
    Carykh - Evolution Simulator (Part 2/4)
    Carykh - Evolution Simulator (Part 3/4)
    Carykh - Algicosathlon Day 2

    Jabrils (All around awesome dude with some of the best videos on the entire platform)

    Primer (I absolutely love this guys videos, they're so clean and well done)
    Primer - Simulating the Evolution of Aggression
    Primer - Simulating Supply and Demand
    Primer - Simulating Natural Selection

    Code Bullet (This guy just popped out of nowhere and he's absolutely amazing)
    Code Bullet - AI learns to play Google Chrome Dinosaur Game || Can you beat it??
    Code Bullet - A.I. Learns to play Flappy Bird
    Code Bullet - A.I. Learns To Walk
    Code Bullet - AI Learns to play the Worlds Hardest Game
    Code Bullet - A.I. LEARNS to Play Hill Climb Racing
    Code Bullet - A.I. Learns to DRIVE
    Code Bullet - A.I. Learns to play Snake using Deep Q Learning
    Code Bullet - A.I. Learns to play Flappy Bird

    Sebastian Lague (Really cool guy, very calm and relaxing videos)
    Sebastian Lague - Coding Adventure: Simulating an Ecosystem

    Seth Bling (Top tier minecraft youtuber)
    Seth Bling - MarI/O - Machine Learning for Video Games

    Dani (This guy kinda sucks, but it's an alright video i guess)
    Dani - I Made a Game in 48 Hours!

  • EntertainmentEntertainment

Comments • 5 927

  • Dani
    Dani  2 years ago +5115

    Smash subscribe to pay respect for Billy

  • Aashit Agrawal
    Aashit Agrawal 2 years ago +4162

    Dani: lets make a game
    Dani: now let's teach AI
    Dani: now let's teach AI to make a game

    • pyro
      pyro Month ago

      Dani:now lets create a friend for a Pyro

    • Immortal Kombat
      Immortal Kombat Month ago

      @Dani where is part 2 for this video? Also BRING BACK KARLSON DEVLOGS OR I WILL STEAL ALL OF UR MILK!

    • DRDDR8
      DRDDR8 3 months ago

      @Tr4nt lets just not

    • Ved Thakkar
      Ved Thakkar 3 months ago

      @Yashaswi Kulshreshtha well, Thanks I didn’t knew it.

    • Yashaswi Kulshreshtha
      Yashaswi Kulshreshtha 3 months ago

      @Ved Thakkar Arduinos aren't that capable of it, they don't have that much processing power and also they have limited memory, I haven't tried it but I think it's not efficient to use them for that

    GAMMARAZOR 10 months ago +77

    Man. I miss when Dani actually explained how stuff worked.

    • SalemTheDog
      SalemTheDog 22 hours ago

      Yes, one of the main reasons I liked his channel was a layman’s explanation of complex topics I didn’t understand at all

    • Akshat Singhania
      Akshat Singhania Day ago

      totally not like there are tutorials on neural network, machine learning movemenet terrain generation and all the stuff he does all over youtube but ok

    • 49BA
      49BA Month ago +1

      Shut up

    • Jelly_The _Nub
      Jelly_The _Nub 2 months ago +4


    • lmao ded ass
      lmao ded ass 3 months ago +14

      Boooring shut up nerd

  • D0ggyW0ggy12
    D0ggyW0ggy12 5 months ago +57

    Dani in irl: Super smart at coding

    Dani on TheXvid: Only shows him being dumb with the tiniest bit of him being smart.

  • courtney enright
    courtney enright 2 months ago +3

    if you could go into detail on how to implement the AI into a game that'd be amazing, I'm a cyber student and am planning on using ai to find bugs and exploits.
    Great vid though, had me engrossed throughout.

  • Bio
    Bio 10 months ago +10

    can we just appreciate dani for *neutralizing* so many of his *brain cells* for us

  • Blackthornprod
    Blackthornprod 2 years ago +201

    Wholesome, excellent content ;D! I love the direction you're taking the channel. Each video is very unique and interesting! See you in Copenhagen man!
    PS: I'll mutter a silent prayer for Billy before going to sleep tonight.

    • Xertunbolt
      Xertunbolt 10 months ago

      Ha, I’m in Denmark!

    • Arnav
      Arnav Year ago

      Woo hey man

    • Dawg.Pound.Network
      Dawg.Pound.Network Year ago

      Also Dani in every video “thicc, milk, more milk, even more thicc,

    • Raphael Jaggerd
      Raphael Jaggerd 2 years ago

      Warup BlackThorn!!!

    • Dani
      Dani  2 years ago +31

      Thanks, and can't wait to meet ya in Denmark buddy!

  • Jake Garrett
    Jake Garrett 5 months ago +8

    This made me think targeting system, you know the military would love some advanced and highly accurate targeting systems if they could train them this easily (using basic ballistic physics and wind speed conditions). Or for the homies, some sweet highly accurate Nerf turret that finally accounts for the foam darts getting caught in the wind and severe dart drop.

  • GreenSlimyRobot
    GreenSlimyRobot 9 months ago +28


    Legendary footage of Dani not drinking milk

  • cringe channel
    cringe channel Year ago +4

    in your game "balls", i found a glitch where if your missle hits an enemy at the same time you do, the enemy double splits, into 8 4ths. making 4 immobile background enemies, and 4 normal enemies.

  • tayto chip
    tayto chip 10 months ago

    dani you are simply amazing i am learning coding and what i do in a day you would do in around 30 seconds you dont realise how complex the things you do are until you start to do it yourself

  • : D
    : D 2 years ago +1382

    “Game developer creates cheat bot for his own game”

  • Rupraj Sarkar
    Rupraj Sarkar 2 months ago

    So this is how "auto target/aim" feature was added to the game. Man I've been playing this game for 2 days now I'm really into this game tbh

  • Josep Julià López
    Josep Julià López 9 months ago

    really nice work! when u duplicate the survivors of your generational thanos erradication u just cline the instances or do some kind or genetic algorithm?

  • Da Dmitri
    Da Dmitri 4 months ago

    please teach him to account for gravity. it would make it so much cooler, and also much less trivial, since you could probably hand-write code that aims like this yourself

  • Blight
    Blight 9 months ago

    I can't believe dany taught a neural bot to aim some balls when he could have just coded it.
    He basically raised a kid to command him to aim a bow for you

  • Helen Gorelik
    Helen Gorelik Year ago +452

    Dani: Goes to university, can code, knows how to video edit really well
    Also dani: It has 86 neurons, just like my brain

    • The Alpha 4
      The Alpha 4 5 months ago

      @TKGL I thinked that too

    • TKGL
      TKGL 8 months ago

      just what i thinked

    • UnfunnyHumour
      UnfunnyHumour 8 months ago +3

      @Luka Plavevski Coding require vast knowledge of math, logic, and learning how to actually code in general, it's way harder when you start making bigger projects

    • gerardo navarro
      gerardo navarro 8 months ago

      @Gili wait really?? nooo

    • Luka Plavevski
      Luka Plavevski 8 months ago +1

      @WalnussPower me too(:

  • Kilian Liss
    Kilian Liss 10 months ago

    Assuming your gravity is defined by a constant downwards acceleration, you could have solved this issue analytically. You choose a target that is close to the player at random, and since the path that a player takes is parabolic (due to constant gravitational acceleration), you can derive an equation for the velocity that the player requires in order to hit it's target. No need for machine learning in this case, and the problem would be reduced to linear complexity (much faster run time).

  • AdenMakesStuff
    AdenMakesStuff 11 months ago +2

    Dani: My brain has 86 neurons

    Also Dani: I understand robot gibberish

  • Gredran
    Gredran 11 months ago

    Wow looking back I realize that Billy had a MAJOR glow up.

    Side note you need more tutorials. I love your humor and memes, but when you show your technical knowledge, I realize how good of a programmer you actually are LOL.

  • Ashwin Tech
    Ashwin Tech 5 months ago

    Bro you are really genius 😍.. I just found you today on the TheXvid and now I am binge watching your videos ✨.

  • Jeyfromthestars
    Jeyfromthestars Year ago +588

    "i have 82 neurons" 2 mins later "unless ur a big brain like me"

    i love this channel

    • Ani Mania
      Ani Mania Year ago

      I swear i read this comment when he said it 😭😭 i was looking for it

    • Pratinav Gupta
      Pratinav Gupta Year ago +1

      Now i know that big brain people have 86 neurons

    • Pratinav Gupta
      Pratinav Gupta Year ago +2

      *86 neurons

    • huer 28
      huer 28 Year ago +3

      86 neurons*

    • Feroniks
      Feroniks Year ago +9

      EverythingIsScience is it just me or are those neurons lookin kinda *THICC*

  • SAN4TH
    SAN4TH Year ago

    i wish i had a teacher like dani.. i would've topped the class

  • Eshaan Goel
    Eshaan Goel 3 months ago

    He just literally taught all of us how to make aimbot hack for his game. A legend. F to billy

  • Brass Bandit
    Brass Bandit 9 months ago

    I would've made them train by making it so the higher the combo, the higher the fitness score they get.

  • Kaleb Santiago
    Kaleb Santiago 2 months ago +1

    Wow this is one of the only video that he actually explains stuff.

  • CookieGuy
    CookieGuy 2 years ago +27

    #BillyLifeMatters :D Great content man, you make everything seems to be interesting! GG

  • Withered Luna
    Withered Luna 7 months ago

    It's so satisfying to see the AI player just obliterate all of the goals

  • blue_birb ֫
    blue_birb ֫ 9 months ago

    I wonder why it defies your game's gravity, it goes in straight lines without changing vilocity

  • Tech Dunk
    Tech Dunk Year ago

    4:13 start (all at the beginning)
    6:47 random start pos and generating generations
    Done: 8:09

  • Michael Reeves
    Michael Reeves 9 months ago

    This would be much easier with a graph chart. I guess the AI was just out of experimentation

  • Sykoo
    Sykoo 2 years ago +2736

    Wow that's really cool! Also I paid my respects for Billy already

  • Gabe Quenzer
    Gabe Quenzer 5 months ago +6

    Dani- explaining what neurons are: me- starts walking away

  • Sam.iThink
    Sam.iThink 5 months ago

    Watching Billy play after the video was over was so satisfying

  • The Ragdoll Dude
    The Ragdoll Dude 5 months ago +2

    I love how he says " So I told them to" but in real life that was a 5 hour work

  • Galaxo
    Galaxo Year ago

    Dani earlier in the video: 86 neurons... just like me

    Dani later in the video: only big brain people like me can understand the hidden layers

  • dwest
    dwest Year ago +436

    2019: *Teaching an AI to play my game*
    2119: *Teaching Humans to play my game*

    • Gabe
      Gabe 11 months ago

      OH FUCK. OH NO.

    • Gabe
      Gabe 11 months ago

      OH FUCK. OH NO.

    • Phxntom
      Phxntom 11 months ago

      @GLaDOS r/woooosh

    • Phxntom
      Phxntom 11 months ago

      @GLaDOS no

    • Iphimedia
      Iphimedia 11 months ago

      @GLaDOS It’s a joke

  • shimon maneshwar
    shimon maneshwar 5 months ago +8

    This is the first time watching AI playing a game is SATISFYING

  • justkluzz
    justkluzz 5 months ago

    I already know that this would be a addicting but hard game to play

  • Zeke Jeager
    Zeke Jeager 9 months ago

    thanks, time to make a charmelion with the ability to learn fire type moves, basic movement and breading when they are older

  • ArronAnims
    ArronAnims 7 months ago

    2019 Dani: *Proceeds to explain what it is after the joke.*
    2021 Dani: "Yeah, you're welcome!"

  • Chero
    Chero 2 years ago +615

    So this is just the auto bounce feature, but unlimited.

    • Mike_o
      Mike_o 2 years ago +1

      @Dexter Silva except its not,
      well the AI is rigged, the point is he knows always what direction to aim, he just always knows his next target, so the ai just rotate toward that target,

      his first attemp was much more "better" in AI terms, because it was kinda random, while in this case you can simply create a bot that always perfectly aims to the next target.

      A.k.a building an AI that only see the screen and then decide what to do is the real deal, now one that can just get "best next move" and say what he will do with it.

    • ͡ ͡
      ͡ ͡ 2 years ago

      It's different autobounce is just some code that makes it go to the nearest ball. This thing has a sort of mind of it's own and can make smarter decisions than auto bounce and also when it hits walls it doesn't do that weird thing auto bounce does

    • Aníbal González
      Aníbal González 2 years ago +1


    • Neks 444
      Neks 444 2 years ago +1

      Auto bounce i epic

    • dog
      dog 2 years ago +1

      Auto bounce is actually way worse

  • ZalStudios
    ZalStudios 10 months ago

    I like how he keeps calling himself stupid but he’s actually really smart

  • leon umeyama
    leon umeyama 6 months ago +4

    "The red line is the direction in which they should be aiming"
    Boom! AI Done!

  • Minecraft_Coder _Guy
    Minecraft_Coder _Guy 2 months ago

    Good Idea: To make the AI work better with gravity, it should get more points aiming downwards accurately.

  • TheEyeOfMango
    TheEyeOfMango Year ago

    A good way to fix them ignoring nearby dots could be rewarding them for getting multiple points in quick succession or making it so they're not capable of seeing dots past a certain point so they stop flying to dots miles away

  • DrPixel Dude
    DrPixel Dude Year ago +425

    I've never felt so entertained yet so knowledgable from a youtube video

  • Insert_funny joke
    Insert_funny joke 8 months ago

    I wish he still taught like this.

  • Subhodeep Mondal
    Subhodeep Mondal 4 months ago

    I really want to know how ai bot's loss function is calculated, or is there any backpropagation

  • ebo Bob
    ebo Bob 11 months ago

    Aren't the hard coded rules are more easier on this game?
    What is the advantage of making ai learn this way?

  • Haranoi17
    Haranoi17 9 months ago

    1.Select the closest target.
    2.Shot in (target - player) direction with full speed.
    Sound like 86 neurons could do.

  • Just Some Guy Who Never Dies

    After this, Billy became a speedruner and he changed his name to : *TAS*

  • coolguy_998
    coolguy_998 Year ago

    Dani at 0:42: 86 neurons, kinda like my brain
    Also Dani at 7:22: Unless you're a big brain like me, i can TOTALLY understand it

  • Tolafia
    Tolafia 9 months ago

    I want to see more like this!

  • Danibeshoy
    Danibeshoy 7 months ago +1

    AI in other games: Bad
    AI is Dani's games: God level

  • Satan Isamongus
    Satan Isamongus 8 months ago +1

    Machine learning is amazing I swear to god I'm not even lying

  • Comrade Doggo
    Comrade Doggo 2 years ago +360

    2019:robot got teached by a programer
    2020:robot teaches the programer
    2021:robot now has a physical body
    2029:robot creates another robot
    2035:first robo president and robo democracy begins
    2040: billy the AI takes over world

  • Bianca Maria Lazăr
    Bianca Maria Lazăr 8 months ago

    It's so much better than i could ever be, I'm so proud of it

  • NoNeed
    NoNeed 8 months ago

    Aah this channel if full of fun, If where I'm going to study teaches me this then I wouldn't skip a DAY!!

  • Elanigor
    Elanigor 10 months ago

    Damn billy is almost as good as Japanese osu players

  • Toy Bonnie SFM
    Toy Bonnie SFM 6 months ago

    5:25 what if it was like the longer you don’t hit something, the more your points slowly go down

  • Cubetix
    Cubetix Year ago +250

    dani before: *its big brain time*
    dani now: milk is *T H I C C*

      ROOKIEPROBRO 7 months ago

      @CG EPIC wait , he did that

    • MrWheat12
      MrWheat12 9 months ago +1


    • ꥈ
       10 months ago +1

      Bro I'm interested in ai I would like to be a nerd. To make a robot slave. :(

    • CG EPIC
      CG EPIC 10 months ago +2

      @SonicPlayrite make it 107

    • SonicPlayrite
      SonicPlayrite 10 months ago +2

      106 LIKES 2021

  • HiIamCrazyboi
    HiIamCrazyboi 11 months ago

    If the ai had auto bounce, it would have easily reached 1 million.

  • Aaryan Aech
    Aaryan Aech 11 months ago

    It feels like Dani makes these games for his university projects! LOL!

  • Fridarkness
    Fridarkness 10 months ago +8

    Dani: Sit back, relax, grab a snak. Also dani: awww man no snak

  • uncleweirdbeard
    uncleweirdbeard 5 months ago

    Make an AI that can master TheXvid algorithms to make the most profitable video ever. Spiff can help with that I am sure

  • Rokas
    Rokas 2 years ago +251

    he just created cheats for hes own game. BIG BRAIN

    • TheCustom FHD
      TheCustom FHD Year ago

      @bOmqYule Stuffs :)

    • bOmqYule Stuffs
      bOmqYule Stuffs Year ago

      @TheCustom FHD I agree now

    • TheCustom FHD
      TheCustom FHD Year ago +1

      @bOmqYule Stuffs nah he is right it would be good if he shows us how to make it on mobile like on his teaching channel

    • bOmqYule Stuffs
      bOmqYule Stuffs 2 years ago

      @Techno Riyaz Im sorry :(

    • hector 14
      hector 14 2 years ago

      @QuestEST ewwwww

  • Twotoohonest
    Twotoohonest 9 months ago

    Yo, I found this game by chance and thought it was really neat and fun, and then here comes TheXvid recommendations being like I got you

  • USB-Type-C
    USB-Type-C 5 months ago

    You should put 3 different generations ( a bad one, a good one, and the final one) and make a VS mode in Balls where you have to get more points than the AI in a set time, and there could be different difficulties.

    • PHILIP ARMY 69.420
      PHILIP ARMY 69.420 5 months ago

      Bro that video was made in 2019 he won't make it different

  • cytix
    cytix 8 months ago

    dani actually explaining things and not memeing? impossible

  • Arif Anxum
    Arif Anxum 5 months ago

    Want more videos like this one plz cz i am learning AI and neural network too

  • Tom C
    Tom C Year ago +19

    Thanks for the content Dani, I'm learning unity and whenever I get dis-interested or loose motivation I watch one of your videos and that gets me going again. Not sure if you realise but your whole channel is pure inspiration for someone like me. Thanks!

  • it's time to be a [[BIG SHOT]]

    I would love to play a game which is just those cube robot GUYS and you could choose an objective for them to do and it would have those gen mechanics too.

  • Yurtrimu
    Yurtrimu 5 months ago

    hey dude how did you make the first leg cube one can you give us source? im searching for hours :/

  • Jelly PLAYERS
    Jelly PLAYERS 9 months ago

    The A.I is like the auto bounce that you need to buy in the game


    loved your simplistic start to explaining a neural network

    Dani: a neural network is a network made of neurons

    Me: yeah thet REALLY cleared it up

  • xXLord_LeoXx
    xXLord_LeoXx Year ago +354

    Dani At Uni: *Explains Stuff*
    Dani Now: "it's basically reality but virtual, yeah your welcome"

    Edit: Didn’t realise 200 people liked my comment ty

  • Mohammadreza Badpa
    Mohammadreza Badpa 5 months ago

    You give an input,
    It gives an output.

    Ok, now that we know how the neural networks work....

  • bl4ck
    bl4ck 5 months ago

    That AI is literally the auto bounce feature

  • PeskyPlayz953
    PeskyPlayz953 10 months ago

    now we need to see this with all the upgrades

  • Pilot Gamer
    Pilot Gamer 24 days ago

    Plot twist: the “auto-bounce” upgrade is actually just Billy’s brain

  • MTCB
    MTCB 2 years ago +379

    “Kind of like my brain, pretty empty.”

    “Unless you’re a big brain like me.”

    • okuhhi
      okuhhi 2 years ago

      He got a big brain but it's empty

    • Joy Hatake
      Joy Hatake 2 years ago +1

      *visible confusion*

    • Cpt1_Campion
      Cpt1_Campion 2 years ago +1

      MTCB Animations pretty empty indeed

    • Narwhale
      Narwhale 2 years ago

      He evolved

    • GalaxyWolfScent
      GalaxyWolfScent 2 years ago

      @Bisquit sdamn my joke has already been posted

  • h1mm7
    h1mm7 8 months ago

    10 minutes of billy turning into a afk machine that gives in-game credit

  • BruhLikeBruhz
    BruhLikeBruhz 5 months ago

    Woah I never knew Dani is this smart

  • Donaven Hollow
    Donaven Hollow 7 months ago

    So all this machine learning experimentation just to make a TAS for your own game. Nice.

  • Flip A Goat
    Flip A Goat 2 months ago

    When you started explaining neural networks I was like "GET OUTTA HERE NERD!!"

  • Thor H.
    Thor H. Year ago +13

    It’s great to have AI do it, but wouldn’t it be easier to just have an algorithm that aims in the direction of the next red dot, in this case? Great vid tho

    • Rex Levertom
      Rex Levertom 7 months ago

      obviously, it would have been easier to make the algorithm. However, the overall point of the video was for an AI to *learn* how to play the game, since he wanted to play around with machine learning.

    • Romil Goel
      Romil Goel 10 months ago

      He knows too much..

  • Hans Gaming
    Hans Gaming 8 months ago

    I'd like to see an AI learn to play Minecraft, or at least a simplified Minecraft

  • Nightmare3104
    Nightmare3104 11 months ago

    I would make it learn to find the nearest red orb by using a sight detector adding a distance to it and during its generation its eye sight would get better and find them from therther away and then use your thing to learn how to AME and other detecting to find out what to do

  • Cranny 45
    Cranny 45 7 months ago

    You know, you could have just applied auto bounce. At this point, Billy IS auto bounce.

  • oskiboski
    oskiboski 3 months ago +9

    The worlds beat player at dani’s game: i got the best score ever!

    The AI: pathetic

  • Djole.mp3
    Djole.mp3 Year ago +721

    These are billy's early days

  • GrouchyMMCC
    GrouchyMMCC 10 months ago

    8:04 that guy must have a really good gaming chair

  • Satan Isamongus
    Satan Isamongus 8 months ago +1

    Their movements are so fluid

  • markusoma
    markusoma Year ago

    15 years later, they will put you into their game.

  • Chair
    Chair 5 months ago

    Look at him, how respectable

    OMEGATROLL 6 months ago +1

    Billy looks like he's speed running a rhythm game

  • Garlic bread
    Garlic bread 7 months ago

    Dani: i have 86 neurons
    Also Dani: unless you are a big brain like me

  • Chameleon Gaming
    Chameleon Gaming Year ago

    It's weird seeing Dani talk about smart stuff

  • QuartzmanPH
    QuartzmanPH 24 days ago

    Dani being a good game creator teacher