Foreword

This is an article written by me for a little journal made during sixth form with the ‘university prep’ group that we had, where each member wrote an article about something in the subject they were planning to apply for. For me this was computer science.

The header image is taken from an article in the same journal about Viking culinary history, written by a good friend of mine who also went on to study at Cambridge.

Bad grammar and whatnot is left in.

— 19th September 2022


AI in Video Games

When we play games, we often do so with friends, the computer controlled players become background noise—if you’ve ever played Mario Kart you’ll remember how the other racers tended to act as fillers on the track, whilst the human players were left to battle it out. This doesn’t however, mean that those AI controlled players aren’t important; they make the racetrack feel alive and challenging, acting as a part of the world, with their purpose being to immerse the player in the game.

So how is this ‘artificial intelligence’ actually made? Well AI in video games is very different to the traditional idea of AI. They typically use what are called ‘Decision Trees’, simply a large number of “if this is true, then do this” statements. The system uses hard rules to decide what the AI will do in any given situation. If you shoot at an enemy, that enemy will always follow the rule defined for them; they might run away, or shoot back at you. After the massive strides we’ve made in the artificial intelligence industry, this seems to be the simpler, basic option, being preferred over the newer algorithms that have the ability to provide a deeper and more challenging experience.

Decision trees are pretty much as fast and efficient as AI gets, and in something like a games console, the scarce resources have to be exploited as much as possible: an advanced AI is just too much of a resource hog to be used. In many games, AI usually plays only a small part in the overall experience of the player, so it just doesn’t make sense to give it a large portion of the resources when other, more demanding parts of the game desperately need them. As a decision tree is built completely by a programmer, after it is finished it can be tweaked to fix problems, include more functionality, and change existing behaviour. Imagine if you have added in a new item and wanted the AI to be able to use it. This could easily be done, because you could just add on to the existing code of the AI without changing the behaviour that was already there. Advanced AI is almost the complete opposite. It trains itself on data supplied by the programmer, so the programmer has very little say on how the AI will turn out. This means that the programmer can’t tweak the AI after it has finished training, as the AI created its own rules. If you wanted to change the AI you would have to retrain it completely from scratch and just hope you get the behaviour you want.

Advanced AI can have incredibly deep behaviour, because the computer develops itself rather than being limited by a human. On the other hand, decision trees are limited by the programmer who wrote them, any mistakes made can be difficult to find, forcing them to be small scale for fear of the AI breaking in an unexpected situation. However, the complex behaviour of an advanced AI will never be appreciated by 99% of people. In fact it could harm the experience for most players. One of the strengths of using a decision tree is the predictability of its behaviour. While this seems boring and stale, it’s actually the best choice for an AI opponent, and can even make them seem smarter to the player. We intuitively see intelligence as following common sense. When a dog barks at a truck, the dog is seen as stupid because the truck is clearly not a threat, and while that can have other explanations beside intelligence, that’s our first, reactionary assumption, because common sense hasn’t been followed. When an AI predictably reacts to stimuli, the player sees them as intelligent. If the AI acts in an unexpected way, even if there are complex reasons behind the action the player will still see them as stupid.

Unpredictably AI also limits how the player will play the game. If they constantly have no idea what to expect, they’ll play conservatively, staying as safe as possible by being slow and cautious. This is the worst possible way for a player to end up playing your game, because there’s no excitement and no tension. Your player will become bored, but they can’t play aggressively (a much more exciting way to play) because that play-style is punished by the unpredictability of the AI.

Overall, it’s likely that advanced AI will never have a steady place in mainstream video games. They’re slow, hard to work with, and above all that, the deep, nuanced behaviour that they offer actually harms the experience of the player.