Sponsored By

Artificial Intelligence in Game Design

An analysis on AI in single player video game development through the study of Batman: Arkham Asylum.

James Conrad, Blogger

April 5, 2017

5 Min Read
Game Developer logo in a gray background | Game Developer

Try and name a single player video game without any form of artificial intelligence, chances are you can’t, or you just named an interactive story. Artificial intelligence is everywhere in video games, from the simplest enemy that walks straight towards you, to the most complicated strategy game masterminds. One of the biggest challenges when designing an AI is remembering that you are not creating a brain, you are creating the illusion of a brain. In order to convey this, I will guide you through what I consider an incredible AI, Batman: Arkham Asylum.

 

Batman: Arkham Asylum

 

Batman: Arkham Asylum brought with it an AI best represented by two categories, combat and stealth. The combat system, based on the end result, was designed in a way to create slow paced, fluid, rhythmic fighting.

 

Combat

 

As stated earlier, the combat is quite fluid and rhythmic. While playing the game, or better yet watching the game played, take a moment to focus on an individual enemy. If you track and watch it closely it will do one of three things: attack, loot, or absolutely nothing. The first action we will look at is the attack, in this action the AI simply charges at Batman, and attacks with whatever it has equipped, whether that is its bare hands or a metal pipe it looted from the ground. Which brings us into the second action the AI can do, while doing nothing, it most likely checks its nearby area for a weapon for it to pick up and use, if it finds one, it simply picks it up and either attacks or continues to wait. Now the waiting phase is most likely done by the design of the combat. In order to create such fluid movements with long, heavy attacks, the entire pace of combat would have needed to been slowed down to prevent Batman from dying from a different enemy in the time it takes to punch something. In reality however, an intelligent brain would most likely attack in a much more strategic fashion, for example, making the only enemy with a weapon attack the front, while multiple others attack the behind and sides. With the enemies attacking at seemingly random intervals, this event can occur but rarely.

 

Stealth

 

The other category of Batman: Arkham’s AI is the stealth mechanic. When Batman is attempting to infiltrate an environment stealthily, the enemies begin spread out, patrolling around as if on guard. The important part however is the detection portion of their stealth. As you eliminate the patrolling guards, their bodies remain on the floor, and they could potentially alert others before they die. Once the other guards become alerted however, they start behaving slightly different. As more and more die off, the remaining guards appear almost afraid, compared to their spaced out positioning at the beginning, they are now grouped up more and frequently checking behind them.

 

Implementation

(Go ahead and skip this section if you are uninterested with the actual programming overview of the AI)

Without knowing the implementation of the enemies AI, the most likely AI paradigm used is a Finite State Machine. If so, the AI is surprising simply, you are left with the two primary states, stealth and combat. To breakdown the seemingly simplest state, stealth, you are left with a simple patrolling algorithm, whether preset and defined by developers or random. On Top of this a fear value would be introduced, starting at 0 and going to 1. We know the stealth is composed of two things other than patrolling, grouping and back-checking. Back-checking is the simplest of the two, based on the value of fear, the enemy simply needs to turn around for a brief second, so for example if we define a maximum and minimum interval for back-checking, we can simply use the fear parameter to interpolate between the two, on top of this a random delay can be added just to add that little extra variance. The other section is the grouping, again using the fear value, we can adjust a proximity value, which would force the enemies to adjust paths in order to maintain a maximum distance. As for the combat state, we can define it easily as the three sub-states defined in the Combat section: attack, loot, and nothing. To begin we start with the base state, nothing, in this state the AI is just waiting for, most likely, a random timer to end allowing them to switch to attack. However if a weapon is dropped, the AI would pause the timer, and switch into the looting state. Once in looting, the AI would flag the item as theirs, preventing other AI’s from attempting to take it from them, then proceed to that location, take the weapon, and resume its nothing state. Once the nothing states timer has ended, it would transition into an attack state, simply running towards Batman, and swinging once in range.

 

Summary

 

The AI in the enemies is a perfect example of the illusion of intelligence, despite the very limited actions an enemy can take they appear incredibly alive. The fear mechanic in the stealth is absolutely perfect, while the combat is just enough to convince the player of their intelligence without making the game unnecessarily difficult. All together it forms the perfect illusion of life, and is only noticeable when one takes the time to ignore the rest of game, something that an average player will almost never do. The most important thing however, is to remember when designing an AI is to keep it simple, you are not designing the next IBM Watson, nor KIT from Knightrider series, you are tricking a group of people into believing for a few minutes that the enemies are alive.

 

Read more about:

Blogs
Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like