AI in gaming: become (better than) human
Artificial Intelligence has a plethora of applications, all of which are meant to make our lives better — both work and play, as you wish.
It helps us carry out an analysis of large volumes of data in a short time, automating a ton of different mundane operations.
AI powers our entertainment as well — we get content recommendations, targeted ads, and AI-generated content.
Today we are looking at the “play” part of the ordeal in a more literal way — how AI is used in the gaming industry?
Apart from fueling the media side of things with AI highlights.
Artificial Intelligence in gaming
Last Sunday I sunk around 6 hours of my day playing Skyrim.
There was no important artifact I was trying my best to obtain. I wasn’t maxing out my smithing skills to make overpowered weapons, either.
I spent those hours being completely immersed in the world of the game — despite the aged graphics, the northern province of Tamriel manages to feel alive even 11 years after the release.
A big portion of that immersive experience is achieved through interactions with characters that live in Skyrim.
And I’m using the word “live” literally here. You see, developers made sure to create characters that appear as living creatures — you get into the random town at 8 pm and see local folk closing their shops. Some of those head home to rest, others decide to visit the tavern to drink and listen to bards.
Should you find yourself outside in the rain, you won’t see a lot of people around — most of them would hide inside, where it’s warm.
People around can also react to the player’s actions — running away if you start a fight, appreciating your choice of armor, or scolding you for representing an opposing political faction.
Summing up the differences, here’s what we get:
All those little things that non-playable characters — or NPCs — do, are the results of Artificial Intelligence in gaming. It powers the decisions that characters make so that they could appear as real as possible.
That makes games more immersive and enjoyable.
And there are a ton of other ways which help achieve realism.
Let’s talk about them.
AI in gaming applications
Artificial Intelligence in gaming pierces through various aspects of gameplay to make the game entertaining, challenging, and realistic.
And now, we go through those aspects one by one.
NPCs
Here, AI in gaming manages the behavior of non-playable characters. Obviously, we don’t want them to stand still on the location and doing nothing. That would not be very realistic.
So, developers build the AI that has a set of determined actions in a number of scenarios.
It includes NPCs having certain routines they follow — like folks in Skyrim, Red Dead Redemption 2, or Gothic. They roam the locations, prepare food, trade, go to work during the day, talk to each other, quarrel, and so on.
They also can interact with the protagonist — asking them a favor or reacting to their actions. If you punch a random person on the street of Los Santos in GTA V — everybody runs away.
If you do that in the salon in RDR2, every last one of the guns in that room will be pointed at you.
Combat
When talking about good or bad AI in video games, the combat aspect is mentioned just as frequently as NPCs’ behavior.
That is no coincidence: like NPCs make the world of the game more believable, the way your in-game opponents behave can make or break the experience.
The key to a successful combat is challenge. Good AI in gaming spawns a plethora of interesting situations during encounters which you will need to adapt to, otherwise you lose.
Tell us about your favirote AI implementation!
It’s not very fun when your enemy is a stormtrooper who can’t make the shot even if his life depends on it, right?
And his life does depend on it, so he’d better start acting appropriately.
The great example of good combat AI in gaming is F.E.A.R. — a first-person shooter with a mystic and haunting tone to it.
The in-game enemies are considered being some of the smartest out there because they do not just shoot at the player, but implement different tactics and utilize the environment to their advantage.
For instance, if the player feels overwhelmed and stays behind the cover, the opponents will actively use grenades to lure them out. Or some can try to focus the fire on the front while their buddies flank the player.
If the player manages to kill the majority of the enemies, the one who stays alive will try to flee and get reinforcements.
AI in game development
Those were the feats of AI that make the gameplay solid — it’s the player’s perspective.
But can AI be useful to developers to build games more efficiently?
Let’s see about that.
Level generation
The first thing that comes to mind is, obviously, level generation.
Called “procedural content generation”, the technology was popularized by a unique indie project “No Man’s Sky”, which was about space exploration.
But bigger development studios do not shy away from that either — for instance, Bethesda claims to use procedural generation of locations in upcoming Startfield.
Which is also about space exploration.
Maybe developers across the board don’t like making space-themed locations?
Maybe.
Or it’s just that the space is big. Who has the time to create countless planets and star systems?
In that case, when the in-game world is enormous, the developers build certain locations by hand, and use AI to automatically generate the others.
This way, they can cut development time and introduce more content, which is what we’re playing big games for, right? We love ourselves a couple of hundred locations to explore and quests to do.
Some of the games even become infinitely replayable. Certain dungeon crawlers generate a whole new dungeon each time you start over, and aforementioned No Man’s Sky does not just have a big world — it has an infinite number of planets, with AI generating them as you play.
Player experience modeling
Player experience modeling helps developers to keep the balance between the game being challenging and frustrating.
The AI in gaming does so by constantly analyzing the gameplay and how the player deals with various situations.
If it decides that the player has too much trouble, it can lower the difficulty of the game in real time. For example, it can make opponents do less damage, or have larger attack windows.
For the sake of our sanity and structural integrity of our gaming devices.
Data mining
Artificial Intelligence also proves useful if the developer wants to analyze the players' behavior. It looks at how different players interact with the game, what they like and don’t like.
They can use that data to further patch the product, or release add-ons and DLCs, catering to the interests of their audience.
Types of AI in gaming
All of those different feats of games are achieved through different types of Artificial Intelligence that developers use.
Let’s explore them a bit.
Basically, we can divide those types into two large groups.
Deterministic AI
It’s all in the name: the approach is all about a predetermined set of rules that the system follows.
Such an AI technique is quite easy to implement and test, and it is very reliable, since there is no uncertainty in possible situations.
The great example of that is the way NPCs act: they always have things to say and to do.
Non-deterministic AI
It’s not hard to guess.
The technique is the polar opposite of deterministic AI: it allows some level of uncertainty depending on the particular method.
Having implemented such a technique, the developers won’t need to code all of the reactions and account for possible scenarios: the system will figure it out on its own.
Learn more about AI in other forms of media!
The great example of that would be an adaptive difficulty. We have talked about it making the game easier for the player if they struggle with a certain section or level.
But it can also go the other way, learning the moves of the player and adapting to their strategy, making the game challenging.
But there’s more.
Non-deterministic AI actually includes several techniques, all of which developers can use for certain goals in their games. Let’s take a look:
- Decision trees. One of the most basic AI in gaming techniques. Decision trees describe choices and their consequences that shape the further experience. It is mostly used in narrative-driven games like Telltale’s The Walking Dead. Until Dawn, or Detroit: Become Human. Each choice you make in those games influences the story and how it comes to an end.
- Neural networks. Neural networks work great for modeling all kinds of scenarios and are adaptive to changing circumstances. They can be trained during the development of the game, or train themselves as the player goes through it. That’s where adaptive difficulty comes from.
- Genetic algorithms. The algorithm mimics the natural selection process, allowing the game to eliminate tactic loopholes that the players can exploit to their advantage.
- Reinforcement learning. Good ol’ trial-and-error training. It works well for creating NPCs that can make decisions in a changing environment.
The future of AI in video games
We can see that there is a lot going on in terms of Artificial Intelligence implemented in all kinds of games.
You can take any game — you will find some sort of AI powering the in-game world, whether it is as simple as GTA pedestrians or as thorough as tactics of F.E.A.R.
But sometimes developers manage to outdo themselves on that front.
In the game Middle-Earth: Shadow of Mordor, the developers have introduced the new way antagonists interact with the player — they called it the “nemesis system”. The whole point of it is that you, as a player, build relationships with antagonists as you play the game.
Your opponents move around in the hierarchy, plotting and scheming against each other, and also against you. It can happen so that the character you have spying on others can turn against you and rat you out.
The characters which you have tried to kill but failed will remember that and try to get back at you — hence the name of the system.
But you can’t really call it a revolution. It’s just more of the same.
As of now, AI has some limitations when it comes to applying it to video games.
Interesting situations that involve NPCs and the player can quickly become boring as eventually they start to repeat themselves. It is often the problem with open-world games if you’re playing long enough.
On top of that, if constantly learning, AI can become unbeatable. On the other hand, when the challenge requires thinking outside the box, the AI falls short.
Have some thoughts on the subject? We are happy to hear them!
But AI carries on, advancing and getting better with each installment.
Though most innovation happens outside the gaming industry, it will get its slice of the pie: developers are now striving to implement AI to create games that continually entertain the players with new dialog, characters that never stop to change and evolve, new locations, challenges, and all kinds of interesting situations.
Let’s hope it won’t boil down to “copy-pasting” content.