Published on April 12th, 2022 | by Ali Arkani

AI and Games: More than just your enemy

As gamers, we are the people who spent a lot of our time interacting with Artificial Intelligence (AI) in games. For most of us, AI means the next dumb enemy who miserably tries to kill us just to make the game last a bit longer, but that’s not the only purpose of an AI in games; it can tell stories, create characters, and even make the player feel emotional bonds with in-game characters.

AI can make games more realistic. To better demonstrate this, I’ve chosen F.E.A.R. developed by Monolith Productions. Released in 2005, F.E.A.R. has the most realistic enemies in case of their action and tactics in confronting the player. Even after 17 years, it’s still undisputed and the Halo series’ AI is the only worthy opponent that comes close to rivaling it. The soldiers in this game use Goal Oriented Action Planning (GOAP) algorithm to mimic intelligent decision making.

This game and the algorithm were so important in the video game industry that Ph.D. proposals were written over their functionality and they are being taught in universities.The algorithm has three phases based on the state in which the enemy soldier is. One of the phases is Go-To in which the None-Playable Character (NPC) is ordered to move to another location. The other phase is Animate in which the NPC is ordered to do a specific action such as firing at the player or throwing a grenade. The next phase is Use Smart Object in which the AI interacts with the environment. For example, when the soldier is being shot by the player, he flips the table in front of him and uses it as a cover.

The AI cycles through these three phases based on the state of the world around him to complete the Goal that is set for him by the game. This 3 phased action planning keeps the enemies in FEAR always on the move and creates a notion of cooperation and intelligence in them.

Another important role of AI in games is the management of pacing and excitement. Pacing is very important in games because if managed incorrectly, it can result in either exhaustion or boredom. A good AI can balance the pacing. A good example isthe horror first-person shooter Alien: Isolation by Creative Assembly. The stalking Xenomorph in this game is tasked with finding and killing the player. The game has a utility AI -a god-like being that is aware and in control of many aspects of the game- called the Director. Director gives the approximate locationof the player to the Alien and it goes for the kill.

Since the game is focused mostly on hiding from the monster, the player is stressed when the monster is near. That’s when an invisible element called Panic Meter comes to play. It is used by the Director as a proxy for the real-life stressthe player is facing. The closer the monster is to the player and the more the player looks at it from hiding spots, the faster the Panic Meter builds up. When the panic meter is full, the director orders the monster to leave the area and enter a passive mode in which it lays an ambush for the player in a nearby location. If the player is not caught in the ambush after some time, and the Panic Meter is emptied, the director sends a new location to the Alien, and the cycle repeats. This cycle creates Active and Passive sequences in the game that balance the excitement and pacing of the game.

The next important role of AI in games is creating emotional bonds. The western 3rd person shooter Red Dead Redemption II from Rockstar games is famous for its realism; especially regarding horses. Since the horse is always accompanying the player and has a significant role even in the game, the developers tried to create an emotional bond between the players and their horses.

The elements in the world of the game or Environmental Stimulations cause the horse to disobey player inputs. The player needs to interact with the horse in a specific way in order to calm it down and get rid of the Environmental Stimulations. For example, being attacked by a wild animal or seeing a moving train causes the horse to get restless and the player should pet the horse to calm it down.

The horse also gets hungry and tiredand thus needsto be fed and brushed. The more the player takes care of the horse, the more they are bonded, and the less the horse gets out of control. At first, the horse is still wild and stubborn but when its bonding level with the player increases, it becomes more obedient. This gradual taming process turns the horse into a virtual pet and creates an emotional bond between the player and the animal.

AI can create a personality for NPCs as well; like the orc captains in Monolith Productions’ Middle-Earth: Shadow of War. This game uses the patented Nemesis system to react to player choices and create consequences for them. Like previous examples, the data gathered by the Utility AI is fed to the orcs and they then react accordingly. Fighting orc captains can result in different scenarios based on either the player or the orc’s death or retreat. These results are tracked by the utility AI and used in future encounters with other orcs or even the same one if it has survived the last encounter.

For example, the player faces an orc captain and is defeated. The orc humiliates the player by deeming him unworthy of being killedand by doing so, creates a notion of personal vendetta. The player returns to the orc and it trash-talks about their last encounter and how he has bested the player. Finally, he is killed by the player but later on, he comes back from the deadbearing scars from the last encounter and seeks revenge. Every orc captain in the game has a random chance to initiate such cycles by coming back from the dead, humiliating the player, or seeking revenge for the death of fellow orcs. This causes the orcs to seemingly have personal motivation in fighting the player instead of just following orders and that adds more character to them.

Last but not least is how AI can balance the game difficulty. Games must maintain a balanced difficulty curve, which means they should not be too difficult early on or too easy later in the end when players become more experienced. Capcom’s timeless masterpiece Resident Evil 4 uses a hidden difficulty balancing AI for this purpose.

The utility AI in the game records the player’s efficiency by examining the amount of damage dealt and received, the number of deaths,and how long it takes for the player to finish a level. Thus, if the player is struggling to move on, the AI makes the game easier by reducing the number of enemies, their aggressiveness, and damage. On the other hand, if the player is cutting through the hordes of zombies like butter, the game makes them even more deadly and numerous. This maintains a perfectly personalized difficulty curve based on the players’ skill set.

Video games are not just the beautiful vistas and action-packed sequences that take our breath away. They have deeper and hidden elements that AI is just one of them. A good AI can make a game great in different aspects and create a memorable experience; whether it’s a horse that has turned into our best friend or a stubborn orc that just won’t die.



Building the AI of F.E.A.R. with Goal Oriented Action Planning by AI and Games

The AI of Alien: Isolation by AI and Games

How Rockstar Designed the Ultimate Videogame Horse in Red Dead Redemption 2 by AI and Games

How the Nemesis System Creates Stories by Game Maker’s Toolkit

What Capcom Didn’t Tell You About Resident Evil 4 by Game Maker’s Toolkit



About the Author'

Back to Top ↑