top of page

Using Deep Learning to Play Video Games in Unity

Writer's picture: Manogane SydwellManogane Sydwell

Updated: 5 days ago

One of the best things about social engagements, for me at least, is free flowing conversations, the type of conversations that seem to make time nonexistent. A significant impediment to this type of conversation would be a know-it-all. Most of us pull this face when we interact with this type of person.

The most frustrating aspect of this type of person is that they allow their supposed knowledge to interfere with what could have been an excellent lunch, conversation, or team project. Know-it-alls exist in every field. In finance, some individuals assert they can precisely predict market movements, yet often they lack true understanding. Fortunately for those of us who are satisfied with knowing only what we know, machine learning, and consequently deep learning, offers us a way to avoid interacting with the know-it-all in any form or capacity.


Both machine learning and deep learning simplify the prediction process by outsourcing this stage of a project to computers, who are much better at arithmetic than humans are. Hedge funds like Renaissance Technologies and Next Alpha make use of artificial intelligence and mathematics to make their profits, and it works! Deepmind made use of artificial intelligence to win at the game of Go. Their achievement was so significant that they made a movie about it!


Fundamentals of Deep Learning

According to deepai, A neural network is a computational learning system that uses a network of functions to understand and translate a data input of one form into a desired output, usually in another form. The concept of an artificial neural network was inspired by human biology and the way neurons of the human brain function together to understand inputs from human senses. The picture below represents what an artificial neural network looks like




After an individual creates or instantiates a neural network, he or she would forward propagate through the network in order to predict the variable of interest. However, the issue with forward propagation is that it produces incorrect predictions.


In order to improve the performance of our neural network, we backpropagate through our neural network in order to reduce the error the model initially produced through forward propagation and thereby get a more accurate prediction. Backpropagation is a really important component of deep learning, which is in turn dependent on the chain rule. Both these topics are beyond the scope of this article.


Below, I provide an illustration, where we use deep learning to play Pong in Unity. Pong is a groundbreaking video game released by Atari in 1972.This video game was fundamental to the success of the early video game industry. The scene presented below is not a carbon copy of the original game but the underlying idea from it is still present. As simple as this scene might look, putting it together is the complete opposite of this.

And there you have it! After training the paddle(i.e. the white rectangle in the scene) to hit the tennis ball, it is able to do so consistently after completing its training. For a richer explanation regarding this scene, I recommend Penny de Buyl's course on Machine Learning, which is freely available on Unity Learn.


Conclusion

The improvement in computational technology has led to machine learning becoming more accessible to non-researchers from 2010 going forward. As time continues to move forward, artificial intelligence will continue to be even more prevalent in our lives. Google has a significant investment in the self-driving taxi industry that is currently only operational in America. As time passes, similar service will become available in South Africa and other developing countries. Complement this article with the following video


References

AlphaGo--The Movie, youtube.com

Neural Network Definition, deepai.org

Backpropagation, Brilliant.org

Pong, unity.com

Artificial Intelligence in Unity, youtube.com


In order to get a more comprehensive feel of deep learning, I recommend the following articles

Getting Started with Keras Deep Learning Tutorials, medium.com

Intro to Keras--Deep Learning Library, medium.com

Deep Learning Tutorial with Keras, medium.com

1 view0 comments

Recent Posts

See All

Comments


©2020 by creativeAfricanProjects.

bottom of page