Not Quite Human: Artificial Intelligence in Games

Not Quite Human: Artificial Intelligence in Games

If you have ever played a video game or casino games online for real money, it is almost 100 percent likely that you have interacted with artificial intelligence (AI). Whether you’re a fan of racing, strategy, shooters, or other genres, there will always be elements in games driven by artificial intelligence. More often than not, however, it has to do with the behavior of characters, whether they are neutral merchants, enemies, or even animals.

So what is in-game artificial intelligence? We looked at how AI was introduced in games, as well as the development of AI itself. At the same time, we recalled examples of games with a decent implementation of NPC behavior.

Defining Artificial Intelligence

To understand how artificial intelligence works, we need to understand what is meant by this phrase. Some people might answer this question with something like, “Artificial intelligence is a brain that is recreated inside a computer.” They will be partly right, but the concept of “AI as a brain” has already been ridiculed dozens of times – for example, in Fallout: New Vegas.

In-game AI is a set of software techniques used in video games to create the illusion of intelligence in NPCs through character behavior. Game AI includes algorithms from control theory, robotics, computer graphics, and computer science in general.

AI is a technology that, through machine learning, allows a system to learn to analyze certain information in a virtual environment to produce behavior that is closer to human behavior. A few decades ago, something like this could only be found in science fiction, but now similar technologies are used everywhere.

How Does AI Work in Games?

Rather than learning how to best defeat players, AI in video games is designed for something else entirely. It’s needed to improve gamers’ gaming experiences.

The most common role of AI in video games is controlling non-player characters, and developers often use various tricks to make NPCs look smarter. One commonly used algorithm is called finite-state machine (FSM). It was introduced in video game development in the 1990s. In the FSM algorithm, the developer summarizes all the possible situations the AI might encounter and then programs a specific response for each of them. For example, in shooters, the artificial intelligence attacks when a player appears and then retreats when its own health level becomes too low.

In the FSM algorithm example, the NPC can perform four basic actions in response to possible situations: seek help, evade, wander, and attack. Many well-known games, such as Battlefield, Call of Duty, and Tomb Raider, include successful examples of artificial intelligence based on the FSM algorithm.

A more advanced method that developers are using to enhance the personalized gaming experience is the Monte Carlo Tree Search (MCTS or Monte Carlo Tree Search) algorithm. The MCTS algorithm was created to avoid the repetitiveness aspect that is present in the FSM algorithm. The MCTS algorithm first processes all possible moves available to an NPC at a particular point in time. Then for each of these possible moves, it analyzes all the actions the player could respond with. And then it goes back to evaluating the NPC based on the information about the player’s actions.

This AI algorithm was used by IBM when they created Deep Blue, the first chess supercomputer, which made history on May 11, 1997, winning a six-game match against world chess champion Garry Kasparov.

A similar algorithm is used in many strategy games. But since there are many more possible moves than in chess, to consider them all simply will not be possible. In such games, the MCTS algorithm will randomly choose some of the possible moves. This makes the NPC’s actions much more unpredictable for players.

Think of a game like Civilization, in which there are a huge number of possible events available to the computer opponent. Building a tree for every possible choice and scenario would take a very long time. That’s why, to avoid such huge calculations, the MCTS algorithm randomly selects a few possible choices. As a result, the game takes up fewer system resources, while the AI is still able to surprise players.

Game Artificial Intelligence Today

At some point, the demands of game developers began to be satisfied to a large extent by artificial intelligence, which we do not consider so intelligent today. The lack of big, noticeable leaps in the development of game AI is due to the fact that the underlying algorithms have not undergone radical changes.

Today’s games still operate on the old fundamental concepts and methods in terms of AI but use them on a large scale and with the advantage of the computing power of computers.

The goombas in Super Mario, the terribly difficult bosses in Dark Souls 3, the enemies in Rogue, and Dead Cells all use the same methods.

The bosses in Dark Souls 3 can move at incredible speed, they are programmed to anticipate many of the common mistakes players make, but they use exactly the same algorithm of AI behavior as the Goombas in Super Mario, which came out decades earlier.

Google’s DeepMind lab, Facebook’s AI research department, and other units around the world are hard at work teaching AI to play more complex video games. This includes everything from the Chinese board game Go and classic Atari projects to advanced cybersport disciplines like Dota 2 and CS: GO.

They’re also trying to use neural networks to improve AI gaming, albeit as an experiment. There are some very famous recent examples, one of which was the AI that beat a professional Dota 2 team.

The 2019 OpenAI Five Championship was held in San Francisco, where the AI met with five cyber athletes from the OG team-and the humans lost. That team took the highest honor in cybersports in 2018, taking first place at The International Dota 2 tournament.

OpenAI’s bots were trained with reinforcements and independently. That is, they got into the game without prior programming, having been forced to learn by trial and error. OpenAI co-founder and chairman Greg Brockman said that during the ten months of its existence, artificial intelligence has spent 45,000 years playing Dota 2.

In the wake of OpenAI’s success, some people raised the question of whether AI could beat players in real-time strategy games (RTS) such as StarCraft and Warcraft. The short answer: yes, it can. But in terms of possible moves and controls, RTSs are much more complex.

AI has several advantages over humans, such as the ability to multitask and react to things at lightning speed. Therefore, in some games, AI developers have even had to deliberately underestimate its capabilities to improve gamers’ gaming experience.

Today’s developers don’t strive to create the most complex AI possible, but rather to use it successfully within game systems to achieve so-called emergent gameplay.

Take, for example, Rockstar’s Red Dead Redemption 2, which allows players to interact with non-playable characters in thousands of complex ways that elicit different reactions depending on a number of details. For example, from the hat you wear, or the presence of bloodstains on your clothes. The world here is so complex and elaborate that different players can experience different events.

Similarly, the iconic game Dwarf Fortress uses a huge number of gameplay systems, from procedurally generated erosion levels to the different mood states and tendencies of the dwarf inhabitants, to create unique and bizarre situations.

Also worth mentioning is Middle-Earth: Shadow of Mordor, released in 2014 by Monolith Productions Studios. What makes this game really special and stand out is the Nemesis system.

Instead of the mediocre AI that can sometimes be found wandering pointlessly and waiting for the player, the enemies in Middle-earth truly evolve into truly dangerous opponents. “Shadow of Mordor” in some ways creates an artificial social memory, a form of intelligence that we encounter in real life but almost never in games. Middle-earth convinces players that their enemies think of them on another, personal, level-they remember, they hate, and they call them by name.

The system was originally designed as something simpler. Enemy warriors were supposed to remember encounters with players and react accordingly with a series of taunts. But as the idea evolved, the ambition expanded. The team introduced a promotion element: enemy soldiers gain more power and advance by defeating the player and other captains.

Nemesis involves betrayals, executions, and skirmishes-the player can discover them and even influence the outcome of the situation. Because of this, every battle in the game can be unique. But most importantly – the in-game society, which functions without the main character and lives its own life. Each character is created from a series of randomly assigned strengths and weaknesses, as well as variable qualities such as morale and discipline. From a modest set of attributes, the team was able to create an almost endless array of enemies.

Monolith Productions studio also developed F.E.A.R.: First Encounter Assault Recon, which was released in 2005. Despite many subsequent innovations, F.E.A.R.’s artificial intelligence is still considered in some circles to be the standard for first-person shooters.

One of the key issues developers had to consider was NPC behavior, specifically building some sort of long-term strategy. Often, even today, enemies in shooters are more reactive in nature. This means that they focus on the action immediately, without taking into account what has happened before or may happen in the future. And the problem arises that their behavior then is not commanding, not emergent. It is merely tied to specific situations.

In F.E.A.R., thanks to AI planning, it is possible to separate actions from goals. The developers used pre-conditions when creating NPCs. With this model, you can create a range of unique actions for the different types of characters in the game. And this, in turn, makes the behavior of enemies more unexpected and thoughtful.

Recall the Alien: Isolation from Creative Assembly studio, which is well-known to many gamers. While making the game its creators used quite unusual methods of AI implementation. There is a system of tasks in the game, which allows the Alien to be in two main states – active and passive. The active state is when the system orders the Alien to search the entire location or certain places after a trigger is triggered. The passive mode is activated when the threat level is at its peak for too long, and then abruptly disappears. Then the Alien tries to find the player on its own.

The alien’s behavior depends on a preset tree. The monster has more than 100 nodes hidden in its system. But only 30 are used at the start of the game. The system gradually unlocks complex behaviors – as certain conditions are met throughout the game. This ensures that the more time a gamer spends in Alien: Isolation, the more Alien begins to exhibit new behavioral traits to constantly surprise and shock. It is this concept that gives the impression that the monster begins to learn from his own experiences and, more importantly, from the actions of the player.

Future AI development in games will likely not focus on creating more powerful NPCs so that they look for sophisticated ways to defeat players. Instead, the development will focus on how to create a unique gaming experience for each gamer.

Gamers these days pay a lot of attention to detail – this includes not only the look and quality of the graphics, but also how vivid and interactive the game is in every way possible. And it’s the AI that can take the gaming experience to the next level. Maybe one day players won’t be able to tell whether a character in the game is being controlled by artificial intelligence or another gamer.


Please enter your comment!
Please enter your name here