AI 101 – Part 4: ‘Game’ AI – A Unique Challenge


In Part 3, we started getting our hands dirty with artificial intelligence theory. This largely revolved around rational agents: software that always makes the best decision it can based on the information is has in front of it. This is somewhat at odds with how humans think, given that we’re not exactly renowned from making decisions without our own biases and influences getting in the way.

Now AI is actually applied rather frequently in video games. However, there are some differences between the more holistic scientific pursuit (sometimes referred to as academic AI) versus what happens in the games industry (i.e. game-AI). The key thing to appreciate is that the intent of an AI in general, can be rather different from that seen in game-AI. Let’s break this down into a number of key areas.

Is it Actually an Agent?

A large number of non-player characters in video games do not adhere to the definition of an agent. In fact, entire genres of games carry NPCs that technically are not AI agents. One of the finest examples we come across is the Super Mario Bros. series. In the original game, the very first NPC we meet is the Goomba. Goombas are not agents. They are merely dynamic objects in the world that damage the player if they come into contact with them in a particular way. The reason it cannot be considered an agent, is because it doesn’t make rational decisions based upon the environment. Arguably, they can see very little, if anything, of the environment. They simply act by moving forward, regardless of whether Mario will jump on them or they will fall off of a cliff. This is merely a scripted behaviour, rather than one that is intelligent.

Goombas in ice skates.  I place this image purely for my love of this concept.  Goombas.  Ice skates!
Goombas in ice skates. I place this image purely for my love of this concept. Goombas. Ice skates!

Interestingly, Koopa-Troopa’s can be considered very simple agents based upon one slight difference in behaviour: they will backtrack if they are going to fall off of a cliff.

SIDE NOTE: It is important to note that this classification is eventually broken in later games in the Mario series, such as Super Mario 64 and Super Mario 3D World. In these games, Goombas now react to Mario’s presence and then act to harm him.

Conversely, a great place to find agents are fighting games. Characters such as Ryu and Ken from Street Fighter need to be agents when playing in arcade ladder. Given that fighting games are essentially a strategy game of quick reflexes and reactions, we need NPCs to respond to the players actions. Otherwise the player could pummel them repeatedly using any tactic given the NPC would never acknowledge that it can be blocked or countered.

Fun vs Optimality


One of the main challenges faced by game developers compared to pretty much any other AI developer is the need to ensure ‘the fun’ is retained. When we consider AI research and development, we often expect that the software that is being created will not only be smart, but provide an optimal solution to a given problem: i.e. the best plan of action possible that will result in our desired outcome such that it minimises the number of actions needed and any costs that are incurred from using them.

When dealing with games this is not necessarily the case. In games an AI character or system has a purpose with respect to the games design. That purpose is aimed at facilitating the need to entertain the player. Now if we’re dealing with a character in a game who is designed to act as an opponent, we do not want its AI to be optimal. Imagine playing Street Fighter IV or Killer Instinct, where your optimal AI opponent would be almost impossible to defeat, given it would always know when to block, when to punish, when to counter and the best combos to make in order to defeat you. That isn’t fun. That’s frustrating.

A game that is fun is seldom reliant upon optimal AI. If anything, we want it to be ‘faulty’: we want it to make mistakes, we want to find holes in its behaviour. In essence, it is optimal at being average in what it does. While the agent is still rational, it may not be given as many useful inputs as it could, since if the AI knows too much, it becomes god-like. Conversely, designers periodically give AI information it should not have: allowing it to see through walls and chase the player regardless of where you hide. Leading to players accusing the AI of cheating. Goldeneye was a classic example of this, given that no matter how well you hid from the enemy, it would always follow you.

Something That Works (Quickly)


As we progress through this series, we begin to discover more advanced and interesting algorithms that can solve very complex problems. Some of these algorithms become very expensive in terms of CPU power, memory, but also time. These do not lend themselves well to game developers, given that they need something fast: that gives good results quickly and does not impact the frame rate of the engine running at 30 or 60 frames per second.

Speaking from experience, there is an interesting divide between the AI scientists who research games, to the AI developers who make games. Given that a fantastic tool from the research side may not be immediately applicable on the industry side. Does this mean that innovation is stifled or new technologies are not adopted? Far from it. If anything we see some interesting applications of otherwise very simple techniques and, through continued development and discussion, more advanced methods are introduced as tools for developers to exploit.

If You Don’t See It, It Doesn’t Happen

A lot of optimisation needs to occur for AI to work well in a game. In an ideal circumstance, we would simply have infinite resources, allowing us to have as many AI agents running amok in our simulation, game or real world system. In games, we are once again constrained by resources, meaning that not only do we need the aforementioned quick solutions, we must be strict on when they are applied! Any AI computation should be focused on what the player sees around them, since that is all that matters. Games such as FarCry and Crysis adopt this method, so that AI agents that are on the other side of the sprawling game world aren’t being updated (they might even be deleted from memory).  The key thing is that any AI work that is happening in the game should be focused on the player and their experience.


It’s important to appreciate that AI in games carries its own considerations. It requires an engineering solution to a number of problems that many research scientists don’t consider. I would argue this is not the fault of the researchers, since it is their task to invent new methods and expand the state-of-the-art, whereas game developers look to see whether these are actually practical for their needs.

In Part 5, we get back on the theory front: as we look at key elements that define the challenge for AI in a given world. This is the process of knowledge representation.

Related Reading

The main series of articles we host on the site:  ‘AI & Games‘, provides a number of articles that deconstruct existing AI applications in commercial video games. While the AI 101 series introduces foundation material and techniques, we will point to the AI & Games series for case studies of real games and how those methods have been applied in the industry.

Enjoying AI and Games? Please support me on Patreon!
Tommy Thompson Written by:

Tommy is the writer and producer of AI and Games. He's a senior lecturer in computer science and researcher in artificial intelligence with applications in video games. He's also an indie video game developer with Table Flip Games. Because y'know... fella's gotta keep himself busy.