Viability of Machine Learning for enemies in Video Games – BSc thesis

Title: Viability of Machine Learning for enemies in Video Games

Authors: Mattias Larsson, William Örnquist

Institution: Stocholm University (SU), Department of Computer and Systems Sciences (DSV), Sweden

Date and language: Spring term 2022, English

Type: Thesis at BSc level degree project 15 HP (sv: Självständigt arbete på grundnivå [kandidatexamen])

Key words: Video games, Artificial intelligence, Machine learning, Game design, Believability

Advisor: Mirjam Palosaari Eladhari

Abstract

Video game enemies require behaviors, currently there are various well researched, documented and accepted methods to create these behaviors such as finite state machine and behavior tree method. An alternative potential method of creating these behaviors is with the use of machine learning. The current advancement and achievements in developing machine learning artificial intelligence are mostly used for other means rather than games. This technique allows video game characters which are controlled by the computer known as ‘non-player characters’ (NPCs) to learn from the environment and act upon it to create both complex and interesting behavior. Because of these achievements, it seems to be possible to create enemy behaviors with machine learning.

Recently, large scale projects for machine learning of artificial intelligence have proven to be very capable of rivaling professional players in competitive video games as players themselves. But is machine learning able to integrate into the game’s environments and serve as believable and entertaining enemies against more casual players?

Currently, commercial games that integrate machine learning into interactive characters are exceedingly rare despite the reliability and widespread use of such technology in computer science including graphics in video games. The problem is that there is a lack of research into the reasoning behind the absence of machine learning NPCs in even the most popular games on the market.

This study experiments and researches on the current state of machine learning in terms of creating video game behavior for NPCs to understand its flaws and benefits. The experiment involves creating machine learning enemies in a simple 3D video game with stealth gameplay mechanics. It was created using the ‘Unity’ game engine along with additional components for the implementation of machine learning behavior and more.

The experiment collects statistical data on the performance of the machine learning enemy NPC and a traditionally designed enemy NPC to make a side-by-side comparison to learn of their efficiency. During the process, observational data is also collected to analyze how each NPC behaves in order to determine their level of quality in terms of ‘believability’.

The results of the experiment shows that it is possible to create video game enemies with machine learning. However, the complexity and time consuming effort of using machine learning makes it a difficult process. The machine learning agents are not fully believable from an implied players perspective in comparison to creating behaviors in the standard traditional way. Which is easier, both in terms of complexity and achieving believability.