Inteligência Artificial jogando Flappy Bird!!

Inteligência Artificial jogando Flappy Bird!!


THIS IS SPARTA Welcome to another video of Universo Programado And this time the AI will play FlappyBird And if you like this kind of content don’t forget to subscribe to receive new videos when they’re out! For those who don’t know FlappyBird was a mobile game that became really popular in 2014 You played as a bird jumping through obstacles To do that you could only jump The objective is to get as far as possible In FlappyBird I used the same algorithm of the Dinosaur’s video So if you’d like to know how this algorithm works Check that video out, I’ve explained everything there I’ve used the same algorithm because it’s really efficient for this situation where the agent has to dodge obstacles. When making FlappyBird I already knew that the AI would play with ease. For the AI it’s easier than the Google’s Dinosaur Because the speed remains the same It has only one action which is jump and need less information to play but I didn’t know that it would be so easy Because they didn’t even need to train: The first random individuals were able to play the game indefinitely And now we will see how this is possible. FlappyBird is a prime example for us to visualize how a neural network works since the game is so simple and a small neural network is already able to play the game and because it’s so small we can visualize it graphically and understand what’s happening inside (of their brain) The first step is to decide which informations that the AI needs to play If you’re in doubt of which informations it needs Just think of human player playing All information that the human player needs to play the AI will need it too. The AI will work much better if you hand them distances because distances does not depend of the position It doesn’t matter if the pipe is too low or too high. What really matters is the distance of the bird to the center of the pipes When making the charts the horizontal distance will be X axis the vertical distance will be Y axis and the final result determining if the bird will or wont jump will be the Z axis So we will be able to visualize the neural network graphically Using a 3 dimensional graph Now we have to discover what is the biggest value that the horizontal distance can get In this case, 1100 in a situation like this: and also we have to find out the lowest value. That would be a situation like this: -75 Then we do the same thing for the vertical distance so now we have our graph. Each point in this rectangle is a different situation that the AI can be Now what we need to know is which of this points are bigger than zero so the bird jumps and which of this points are equal to 0 so the bird won’t jump Each bird of the population will be one of this functions that were randomly created. But the game is so simple and the neural network is so small it happens that one of the bird is already “BOIRNE” prepared to play the game It’s already *BOIRNE* with the right behaviour to where to jump and where not to jump In which situation it jumps and in the ones that it won’t And to facilitate the visualization of the graph I will paint all the points that are bigger than 0 in blue And leave all the points equal to 0 in green we will see the graph from above. Now we can really see the neural network for what really is: A function This graph on the right contains all the possible situations that the AI may encounter the red dot being its current situation The green dots are situations that it shouldn’t jump the blue dots are situations that it should jump Check that as it approaches the pipe the horizontal distance lowers So the red dot which is its current situation goes toward the point zero which is this black dot When it goes through the pipe it starts receiving the informations of the next pipe This is why the red dot appears to be teleporting It’s already in another situation Gravity is always pulling them down to the situations in blue but when they are in a blue situation it jumps and goes back to the green situation Its objective is to keep to the green situation But in this channel the AI can’t simply win so easily What do we have to do? You’ve guessed it: Make them miserable In order to do that I made the canes move and also made a special obstacle that they can only pass using the parachute. This cane is too narrow so you can’t just jump through it The only way the AI could pass through it is using the parachute and saving the parachute for this obstacle Just like in the Google’s Dinosaur video the parachute recharges every 4000 pixels of distance and the special cane appears every 5000 pixels So now I will make my thang and let it train when the AI is good I will return DO IT! JUST DO IT! Don’t let your dreams be dreams! After a few generations they got this score and they won’t die The AI already learned how to react to all obstacles in all speeds Sadly they won this time. I tried to make as hard as I could Even then it learned and there’s infinity… It learned how to play. That’s all folks! If you’re still here don’t forget to leave your like and share with your friends because it helps the channel to grow It’s amazing to know that you’re interested in programming and AI Thank you for your attention and until the next one!

100 thoughts to “Inteligência Artificial jogando Flappy Bird!!”

  1. ✅ – Se você curtiu o canal e deseja aprender a programar jogos muito melhores do que esse, te recomendo esse curso: https://go.hotmart.com/R16683817C é de longe o curso online mais completo do Brasil, conteúdo gigantesco!! Qualquer dúvida é só me chamar lá no Instagram @universoprogramado!! Valeeeu!

  2. Porra cara, cheguei aqui agora, canal foda pra cacete, tu tem um potencial incrível cara, boa sorte no seu caminho, terei prazer em ver o seu crescimento

  3. Cara, nunca terá uma derrota se treinar, "uma" vez treinado nunca errará, isso é matemática, exatas,… nada surpreendente, sem desmerecer. Acho muito legal seus vídeos. Mas poderia fazer um, que não precise treinar, q já é mais difícil, mas vcs são impossionados pelas dificuldades.

  4. mano porque tu nao bota a inteligencia artificial em um jogo de açao pra ela aprender a ter reflexos e desviar dos obstaculos no tempo certo?

  5. Olá!

    Sou "vidrado" na inteligência dos programas de: "Damas e Xadrez" você poderia implementar uma rede neural pra jogar Xadrez ou Damas ?

    A lógica que conheço e o "mini-max" em cojunto com uma função rcursiva pra fazer a "Busca em Profundidade" e achar a melhor jogada possível ! Seria maravilhoso ver isso funcionando em uma rede neural!
    Thks!

  6. Cara, não sei nada de programação mas me interessei muito por isso. Tipo, muito mesmo.
    Por onde eu começo?

  7. Eu pesquisando/assistindo vídeos sobre DevOps e chego aqui, que bruxaria é essa?! Parabéns, muito bom o vídeo! +1 inscrito!

  8. Quero saber como tem gente que além de não curtir ainda dá dislike. Conheci hoje o canal através do Deschamps e já to alucinado. 4 período de computação e louco pra aprender sobre esse mundo fantástico da IA. Parabéns meu caro.

  9. mano, eu quero aprender a fazer isso… o que eu preciso aprender?? quais sao os conceitos?? que softwares ele usa? qual a linguagem de programaçao usada?? eu quero saber tudo.. eu quero tudo!! tudoo!! haha serio!

  10. Amigo, muito bom seus vídeos! Explica pra galera que quer começar a desenvolver esse tipo de IA pra aprender como iniciar.

  11. Ei faz um vídeo de você pega no o jogo original e botando eles sem nenhuma modificacão porque nem como zerar o jogo no final aparece o Mario

  12. Gosto muito dessas edições que você coloca, quebra aquele gelo e da um tom de humor bacana… Curtindo muito esses seus vídeos, meus parabéns com seu trabalho

  13. adiciona obstáculos que se movem na horizontal e diagonal, tbm aumenta a velocidade dos pássaros por 10%, duvido eles ganharem >:D

  14. Descobri seu canal hj, e estou gostando bastante. quero muito fazer engenharia de sofwer e mexer com Inteligência Artificial EU AMO ISSO

  15. Como é que calcula a distância várias e várias vezes se os canos podem assumir alturas totalmente diferentes?????

  16. Referenciou The Office, ganhou meu like. Muito bom pra aprender como funcionam as IA's, dá até instiga pra programar um monte haha

Leave a Reply

Your email address will not be published. Required fields are marked *