Is Machine Learning an unnecessary evil in game development?

Machine learning can easily be associated with a technology evil. It is a subset of artificial intelligence, which the latter is a buzz word for a very long time. However, it is only within the last decade that we can say we have truly seen applicable commercial use cases. Products widely use object and sound recognition now. While casual video entertainment uses DeepFake so far, we have seen variations of similar technology. Cyber criminals have also faked the voice of a company CEO and fooled staff to transfer money into criminal hands. Cyber security conversations also circle around threats that use artificial intelligence.

However, should we all turn into luddites, not only banish machine learning from day-to-day activities, let alone in game development?

Let us first begin with the path of artificial intelligence in games.

Hasn’t AI been in games for the longest time?

Don’t enemy behavior in classics (Doom, Command & Conquer and even good ol’ Tails from Sonic The Hedgehog) run on AI? If loosely defined, then yes, “AI” exists on these games. However when we talk about AI today, they are pretty different. Game character behaviors like Dead Cells are programmed to behave in certain ways directly by the developer. AI is usually associated with the computer developing its own behaviors whether supervised by a human or not. It is not the same as the Undead Archer’s pre-programmed behavior. The Undead Archer did not learn how to avoid the player by itself. If AI of today is in play, the Undead Archer will learn the player’s behavior on its own and develop its own set of behaviors.

This subset of artificial intelligence is called machine learning.

The substitution of Player Two

For us who play with bots in games, we would have enough hilarious situations when bots do stupid things (like the example above). We can create entire YouTube channels of stupid bot behaviors and have a good laugh, and there are also times when you will just point your gun at it and blast it back to bits to bytes. Machine learning can help improve the gaming experience with bots.

There is a heightened sense of variety when we play with or against human players. Nobody behaves or makes decisions the exact same way. When we play with or against programmed bots or NPCs, at some point, we eventually pick up set patterns that will occur almost every single time that it dulls the gaming experience. A bot or NPC that has its own simulated method of learning and making decisions can challenge the player and enhancing the fun in the game.

Replayability

Is this even a word? But you get it.

For the gamer, we appreciate games that we can revisit for a couple of reasons. One, we had invested time and effort in familiarizing with the controls, gameplay and perhaps developed attachment to the story and characters. This gives us a unique experience that we can only find in a particular game. Two, we often enough grow in a community of gamers who share the joy of a particular game, therefore replaying it enhances our social satisfaction. Three, games cost money, and at some point we don’t want to be spending too much on new games.

For the game developer, of course we want gamers to keep playing our game. The more they enjoy replaying it, the more they talk about it among friends and community, the more people will play your game, the more your reputation grows, and you make money and get more encouraged in developing the game further or make more awesome games.

Breaking the “artificial intelligence” tradition

In contrary to how it may look, the chess game on your device is not really artificial intelligence, neither does it use machine learning.

Traditionally, game developers try to create multiple paths through games, or throw in as much random outcomes as possible. While these methods do work, technology today can take things to a new level.

What if over time, a game learns about what the gamer enjoys about it, and tailors the game towards the gamer’s preference? A gamer might often avoid a certain enemy at all cost, and the game learns that it might be because the enemy’s particular ability is too strong, and so brings down its difficulty to a more balanced level? Or the gamer seems to be getting bored in clearing a level that has grown too easy that the game adjusts the challenge to bring a more exciting experience? Imagine what this in turn will translate to community conversations on social media platforms or over pizza at a friend’s home.

Machine learning is not rocket science

They might seem like big words but machine learning or artificial intelligence aren’t out of reach to the common man. In fact, there have been tutorials on machine learning in game development all over YouTube. If you as a game developer use Unity, there are sufficient resources out there to learn and apply machine learning into your C# or Javascript code.

The hard part could likely be in understanding what machine learning is. An easier approach is to first understand what it is not. We can start with the Terminator movies. Machine learning (at least today) is not at all a cybernetic organism that looks at a gamer through the webcam and makes decisions through a red filter interface, studying the gamer’s expressions, listening to his or her voice, and making decisions. In theory, that might someday happen but it would first require all computers to evolve into quantum technology in order to support such a capability. But today, machine learning is essentially just ploughing through a lot of data and making decisions from it.

Turn player data into machine learning data sets

By Markus Spiske (https://temporausch.com)

If you intend to develop your game to intelligently set a difficulty level, machine learning can. You want to collect useful data about the player’s score, the time taken to complete a level, the number of times the player failed and succeeded, and probably try to detect the number of times the player banged on the keyboard (if you can find a way to do that). You then apply a learning decision making algorithm that learns over time by experimenting with decisions.

If your goal as a game developer is to have your game to create the ultimate Player Two bot, then you want to collect a different data set. You then use the data to square it up against the behavior of the human Player One, and build an algorithm to make the bot learn how to be a better partner than to constantly get in the way of the player’s line of sight.

While this article does not cover the technicalities of a machine learning algorithm, this one does.

Machine learning is evil or not, depends on where you take it

Gamers are hit with a plethora of similar games until it is not funny or fun anymore. If my observation did not fail me, most gamers stick to only a few games despite having bought many. Most purchased games are often completed once and never touched anymore. They may remain in the download folder waiting to finally be installed and played. Gamers generally want games that they can have good reason to replay with, getting out different experiences each time they have a go with it. Game developers who want to have their work at the top of the list can use machine learning as a game changer. Machine learning can be applied to familiar game ideas, and throw out a newly tailored experience to every single player.

BONUS: Some good working examples of Machine Learning in game development

Because you will surely ask, here are some videos by game development YouTubers covering the subject with real examples: