Game AI | How is AI used in gaming?

Engati
6 min readMar 15, 2022

--

AI in gaming is all about creating more responsive, adaptive, and challenging games through the use of artificial intelligence. Even though academics argue that game AI is not true AI, the hype around the technology has been continuously growing for quite a while.

How is AI used in games?

1. NPCs

NPCs or non-player characters are where Game AI is used the most. These are characters in the game who act intelligently as if they were controlled by human players. These characters’ behavior is determined by artificial intelligence algorithms and engines. Quite often, decision trees are used to guide the behavior of these NPCs.

If you want a good idea of AI in NPCs, just look at Monster Hunter: World. There’s essentially a living ecosystem with AI-powered monsters that are essentially doing their own thing. Yuya Tokuda, the director of the game even talks about NPCs randomly attacking each other in the game. He remembers a time when his character was fighting a monster in the game and another monster just barged in, hit the first monster with a rock, and ran off. There was yet another situation when while the player was fighting one monster, another monster flew in and both the monsters started fighting each other.

According to Tokuda, this creates novel experiences for the game’s players as well as the developers.

“There’s constant surprises — not just for players, but also for us. We’ve set up the rules for how they should behave, but in that sense we didn’t script monster behaviour — we just gave them rules to behave by, and we still get surprised by how they respond to those rules.”

- Yuya Tokuda, Director of Monster Hunter: World

Earlier versions of the Monster Hunter games featured the monsters performing a limited amount of moves, but in the new versions, the monsters can perform a wide range of actions and can decide which moves they should make based on the position that the player’s character is in the moves that that character is in. This allows the NPC to perform moves that would be harder to dodge, block, or counter in that situation.

2. Pathfinding

Pathfinding involves getting from one point to another. The whole gaming landscape is the most important part of pathfinding. The game AI can generate the game landscape or the game world as you go through the game world. The AI can get feedback from your moves, your playing style, in-game decisions, appearance, and techniques, and create the landscape according to that.

3. Decision-making

AI will let the decisions that you make have a bigger impact on the gameplay. For example, in Red Dead Redemption 2, the behavior of NPCs and their interaction with you depend on variables like blood stains on your clothes or the type of hat that you are wearing. Since there is an enormous matrix of possibilities, the whole game world could be manipulated by your decisions. There could be extremely complicated cause-and-effect relationships.

NPCs can even learn from player behavior and adapt according to their tactics

4. Data mining

Artificial intelligence allows game designers and studios to perform data mining on player behavior to help them get an understanding of how people end up playing the game, the parts that people play the most, and what causes users to stop playing the game. This allows game developers to improve gameplay or identify monetization opportunities.‍

Data is mined from player behavior (Source: Unsplash)

5. Procedural content generation

Artificial intelligence can be used in games to create new content, interactive stories, environmental conditions, levels, and even music automatically.

6. Player experience modeling

Game AI can figure out the ability and emotional state of the player, and then tailor the game according to that. This could even involve dynamic game difficulty balancing in which the difficulty of the game is adjusted in real-time, depending on the player’s ability. Game AI could even aid in figuring out the player’s intent.

7. Cheating

The most common type of cheating used by NPCs is when the NPCs make use of information that is not available to the players in that situation. As an example, in a combat game, an NPC might be given human-like senses like seeing and hearing, but they might just cheat by checking the player’s position on the game engine. Other types of cheating include the AI system granting NPCs greater speeds to catch up with players in racing games or allowing them to respawn in beneficial positions (eg. giving them the higher ground) in first-person games.

Cheating is useful in certain games because without cheating, it would be much easier for the human player to beat the system after a few attempts.

What are the kinds of AI in games?

The most common types of game AI techniques are:

Deterministic AI techniques

Deterministic AI techiques are the most widely used game AI techniques. Deterministic behavior or performance is specified and is very predictable. There just isn’t any element of uncertainty involved in these techniques. They are rather quick and easy to implement, understand, test, and debug. The issue is that deterministic methods force developers to anticipate all the possible scenarios and code all the behavior themselves. These methods don’t even allow for learning or evolving, which makes the game’s behaviors predictable after a little gameplay and even has a limiting effect on the game’s play-life.

2. Nondeterministic AI techniques

This is basically the opposite of deterministic behavior. Nondeterministic behavior has some level of uncertainty (which depends on the AI method that is used and how well that AI method is understood). If you want to get a better idea of what this is all about, just look at an NPC that learns the moves and tactics of a player and adapts to counter them. For such learning, a neural network, Bayesian technique, or genetic algorithm could be used.

The game developers won’t even need to anticipate all the possible scenarios and code behaviors according to them. These methods can even learn and extrapolate on their own and promote emergent behavior — behavior that emerges without there being explicit instructions.

The benefits of AI in games

AI brings an enormous amount of benefits to the gaming industry. Some of these are:

The games become smarter and more realistic

Using techniques like pattern learning and reinforcement learning, the NPCs in the games evolve by self-learning from their actions. The games also become rather realistic because they interpret and respond to the player’s actions as well. There also are a lot of programs that do not need human interfaces and are able to create virtual worlds automatically.

2. Saves on costs and time

Normally, developing a game requires a lot of time and money to be invested in it. And you aren’t even sure how well the market will accept the game. AI can help dramatically reduce the time taken to build a game and save a lot of resources that would be spent on developing the game.

3. Makes it easier for the user to play

AI helps make the game more intuitive. In addition to this, the game can use AI to figure out the user’s ability and expertise with the game and adjust the difficulty level of the game in real-time to match that.

4. Eliminates the predictability of the game

The game becomes unpredictable when non-deterministic behavior is used. This means that what happens in the game can’t even be predicted by the developer of the game. This creates a novel, refreshing experience and increases the game’s play-life since the game does not become predictable and boring after playing it a few times.

Can AI make games?

Yep, it can. AI has played a huge role in developing video games and turning them to the preferences of the players. The most commonly used technique for this is machine learning. Basically, you could have the AI system learn from a lot of games, create approximate representations of the games, and then proceed to recombine the knowledge from these representations and use conceptual expansion to create new games.

AI has been bringing some major changes to the world of gaming, and its role is growing at a rapid pace. It wouldn’t be surprising to see AI being used even more in the gaming industry in the near future, seeing how it helps create more challenging and engaging game experiences

This article about “AI in gaming” was originally published in Engati blogs.

--

--

Engati
Engati

Written by Engati

Reimagine your customer journey with Engati!

No responses yet