top of page
Search

Blog 2: Can You Flap Better than an AI?

  • rigelchan
  • Dec 3, 2022
  • 3 min read

Updated: Dec 8, 2022

Welcome back to this journey I am on in learning and understanding machine-learning and neural networks and how we can apply them. Lucky for us since all the technical details are out of the way, we can get into the fun stuff here. Here more so than learning new concepts we will be showing the application of machine learning through the ML-Agents package through Unity.


Reinforcement Learning

Real quick before we get into the fun stuff, I will talk more on reinforcement learning as this will be a major part in what comes next. Although it was touched upon last time, here I will talk about it more in detail:




TLDW: The agent or machine that is learning looks at what is around it, makes a decision and performs an action. That specific action will then reward the agent either with a positive reward or a negative reward. That will in turn influence the next cycle of learning.


FLAPPY... DON?


Inspired by the simple yet addictive game that flapped its way into our lives, I decided to re-create the game Flappy bird. However, I wanted to improve on this simple game and therefore with the permission of my friend Don, we will have him flap around instead. Since this blog is not about game development or Unity specifically, all you need to know is I made a game which you can try out yourself by downloading here:

(Just unzip the file and run the application ML-Game)





In the game you will be able to compete on an online leader board and the controls are very simple where you can jump by pressing the SPACE BAR. There is also an option to see the machine learning model I created in this project as a demo within the application.


Learning to Fly


Now that the base game was created, we will actually use a more stripped version of the game to conduct the machine-learning process, so we won't be distracted by the bright colors, intense synth-wave music, and a very handsome face. The basic knowledge of the learning cycle is brought into this game and through some programming magic, we can generate different levels of brains depending on how long we allow the program to run in the game. That there is a large jump between programming the machine learning environment to running models of it. For a more technical look into the work watch the video below! (Just cause of the limitation of Wix the video is split into two parts)





With some more adjustments we are ready to move on to phase 2.



Deploying Our Wings


Now that the agent code works, we need to integrate it into an environment that is more so like the real thing. Again, this will be a stripped down scene and slightly different behind the scenes, but the functionality of it will be the equivalent to the actual game. After some code integration and touch ups, we are ready to generate our models or brains for our Flappy AI.




Now that that is all done and said, lets see if you are able to beat an AI in this advanced game of Flappy Don. Included in the game is an online leaderboard where you can compete with others to be the ultimate Flappy Don. Although this application of machine-learning is simple, I hope it gives you a greater appreciation to this technology.





 
 
 

コメント


Drop Me a Line, Let Me Know What You Think

© 2023 by Train of Thoughts. Proudly created with Wix.com

bottom of page