Crafting Cognition: AI in Video Games

Image Credit: PC Magazine

For as long as games have been worth playing, they have implemented at least some form of Artificial Intelligence, or AI. An integral part to the gaming world, examples can be found in almost every genre, from the enemies in classic shooters to the incessant ghosts in Pac-Man.

However, despite the ubiquity of AI, it often goes unnoticed by the player. Even some of the most avid gamers are completely ignorant of the brains behind their favourite NPCs.

So what does AI mean, in a gaming context? What makes it good or bad? And how can developers continue to improve on it in the years to come?

1: What is AI?

AI can learn real-world skills by playing video games | Science ...
How does the AI in games help and hinder the player?

To understand how one might go about improving AI, you first need to have a solid grasp on the basics. Artificial intelligence is essentially the hive-mind behind all the Non-Player Characters in a game. It allows for uniqueness, for individuality; if every single enemy soldier was scripted to do one thing, combat would get very boring very quickly. By implementing AI, they instead make informed decisions, making for far superior gameplay.

However, contrary to popular belief, the aim of AI, in games at least, is NOT to make a perfect facsimile of the human mind. The NPCs are not, and should not be truly “intelligent,” for numerous reasons (more on this later). Instead, AI merely enables the game to look at various inputs and perform an action in accordance to it. Can they see you, the player? If they can, how will they react? All of these inputs and outputs are tuned, with thousands upon thousands of different results in different games.

2: The Good, The Bad, and The Infuriating

Okay, so you’ve come to grips with what AI is. But what separates the well crafted, A-tier systems from the shoddy, poorly put together ones? The NPC either reacts, or doesn’t react. In reality the truth is very different.

If you were to ask an experienced gamer what games they thought had “good” AI, invariably the same answers come up: Halo and Half-Life. What is it that makes the AI so good? Surely, they must use the most intricately crafted systems, perfect replicas of real-world decision-making to achieve such high quality NPCs.

See the first screenshots of Halo 3 and ODST on PC | PC Gamer
Halo’s famous Warthog, depicted with an AI gunner on the back.

Well, no. The truth is much simpler. Take Halo, for example. While yes, it’s certainly true that the game’s enemies were play-tested over and over again to get the perfect result, the changes made were actually minimal. The key factor in Halo is aggression.

During play-testing, the team behind the game had two separate systems which they had testers trial, one after the other. In one, the enemies didn’t attack that often, and didn’t do a lot of damage. In the other, both the attack rate and attack damage was heightened significantly.

After testing, users were asked how intelligent they thought the enemies were. The score of “Very Intelligent” leapt from 8% to 43%, simply by increasing the toughness of the enemies. That’s all there was to it.

It is here that we see the reality behind “good” AI. It can, as put by Mark Brown of Game Maker’s Toolkit “let the player cheat without them knowing it.” This player bias has become the norm in most games today. In stealth games, enemies won’t turn when you’re right behind them, in DOOM demons won’t force you to the defensive. Good AI ensures the game can be played as it is meant to.

DOOM Eternal - Launch Details
Easiest way to give a demon good defence? A shield the size of a house.

Now we know how to make it good – what happens when it goes horribly wrong? Obviously, there are countless examples of broken, buggy games with units that wander aimlessly, or just repeatedly smack into walls, but that’s not what I’m talking about. Some of the greatest top-ranked games suffer from terrible AI issues and you’ll surely have experienced them.

Case in point: Assassin’s Creed, Ubisoft’s flagship title. The franchise has expanded enormously from its humble roots as an innocent Crusades-era fighter, but throughout its 13 years it’s kept the same glaring issue: escort missions.

The bane of almost every player’s existence, these missions involve following an NPC to a set location. Simple, in theory, but the same problem always arises: they move faster than you can walk, but slower than you run. As such, you wind up spending the whole mission either clumsily alternating between the two, or running literal circles around them. Every orbit completed is another nail in the coffin that was your immersion.

A Man They Call The Sage - Assassin's Creed IV: Black Flag Wiki ...
If I had a Reale for every circle I’d run round a Templar…

3: Where Do We Go From Here?

So, you understand what makes an AI good, and what makes it absolutely terrible, but how can this continue to improve? Despite constant development, players will always encounter AI that falls short of the mark; villagers walking aimlessly in circles or enemies somehow losing sight of you simply because half of your arm is obscured by a crate.

This is dying out, however. One such example is Rockstar’s 2018 masterpiece, Red Dead Redemption 2. In this game, you could be forgiven for thinking that the NPCs are as real as you are. Builders drive real carts to real places to pick up real materials. Deer and stag butt heads, even starving to death if their antlers catch, and even if you aren’t looking. They simply feel alive.

Red Dead Redemption 2 after campaign +tips+ | Red Bull
Just hold still, boah…

But even this, in all its wonderfully pointless detail, is not perfect. There can and will always be improvements that can be made, and most of these revolve around an idea called “intentionality.” Remember earlier when I said truly intelligent AI was a bad idea? This is why.

Intentionality, a term coined in a 2006 GDC Lecture, is defined as the “ability of the player to devise their own meaningful goals through their understanding of the systems of the game”. In short, allowing the player to look at what they can do, what the game world can do, and set themselves an organic task that feels right. How does this tie into AI, I hear you ask? It’s simple.

AI has no self-purpose. There is no reason for it to do, or be outside of the player. As interesting as it is to look at, Red Dead‘s living world that continues without the player is unnecessary. This idea of intentionality is the end goal for every game that tries to implement a good AI system, and as such it is essential that this system serves only to enable the player.

A brilliant example of this can be found in Monolith’s 2017 title Middle Earth: Shadow of War. It’s a good game in all – the story’s fine, good combat – but it really shines in the way its NPCs react. It does so by pioneering a wholly new method known as the Nemesis System.

Middle-earth: Shadow of War guide: The Nemesis System - Polygon
Mordor’s corporate ladder is positively cutthroat.

Each NPC in the Nemesis System, from the overlord of a nearby fort to a nameless, red-shirt grunt, has a place. They hold status and power. If, for example, said nameless grunt kills you, the player, well, that’s a mighty feat and they gain prestige. Thus, they move up the ranks, and are given a name, title, and unique abilities. You can then target them to try and take revenge. If they kill you again, the same thing happens: more power, more abilities.

This enables the player to build a really strong bond with what amounts to a simple enemy that would be posthumously swept under the rug in any other game. You’ll grow to hate them, and they you, evidenced by their recollection of prior encounters, and scars left where you tried to kill them before.

All in all, this perfectly realises that idea of intentionality. You can sink hours upon hours into a petty feud with a non-existent orc, and come out of it feeling a true sense of accomplishment. It works perfectly.

Steam Community :: Guide :: The Ultimate Guide To Creating Custom Orcs
With a name like “Grisha the Tark Slayer”, you’re just asking for a beating.

There it is then. A brief and simplified summation of one of the most complex parts of modern video games. If you want to know more, I highly recommend the following videos:

In short though, AI needs to be geared towards the player. It needs to be smart, strong, and have none of its own goals, while maintaining a rock-solid facade that suggests it does. You see now why this is all so hard. If even one of these factors fall short, the game ends up feeling like it’s lacking, and you end up running circles around a Knight Templar.

Words by Henry Elvidge.


Please enter your comment!
Please enter your name here