Victor James

Posted on

AI in Gaming: How Software Drives Immersive Virtual Worlds

As long as you use the internet regularly, you’ve been reading a lot about how AI is changing the world. The craze started after OpenAI unveiled ChatGPT, a generative AI based on a Large Language Model (LLM). Apparently, you can make conversations with it!

But ChatGPT is not the last of what is happening in the world of artificial intelligence. Take AI in gaming and its reach outside the virtual world for example. Did you know that Microsoft named Cortana based on a character from its Halo franchise? In case you haven’t played the game, Cortana is an AI character that plays a vital role in the game.

ai in gaming

And that’s not the last of it. Outside of the game AI, game developers are also opting for more AI usage in their development process. In this blog, I’m about to explore the options of AI game design for the future. After you’re done, I hope you’ll be more excited to play games than ever before!

What is AI in Game Development?

The standard definition of AI in gaming states that it’s a way to create “dynamic and personalized experiences through non-player characters (NPCs) that behave in a creative & intelligent way”. But in reality, AI has penetrated a lot deeper than just NPCs.

From adapting the game difficulty level to debugging the code before release, AI and machine learning have become integral parts of the video game industry! Players are all for it simply because it allows the developers to create more challenging games with immersive experiences we’ve never seen before!

Before I dive into the benefits of AI in gaming, let me outline the most common areas of a game development cycle where AI is used currently.

Types of AI Used in Game Development

The term “artificial intelligence” is quite broad. It houses a lot of different types of modules. While you don’t need to know about them to enjoy a game AI, it never hurts to expand your area of knowledge.

Pathfinding AI

In tech terms, pathfinding is the plotting of the shortest distance between 2 points by a computer program. But when used in the game design process, it allows non playable characters to navigate accurately in the game world, without facing obstacles.

It’s often the pathfinding AI that allows NPCs to drive around the city without crashing into each other or ride their horses without crashing into you. They even wait on the side of the road for the light to turn green so that they can avoid a ticket for jaywalking!

As I already said, AI in gaming is not a new concept. Pathfinding is one of the oldest artificial intelligence types to make its way into the gaming industry.

Can you believe that older titles like Starcraft 2, Alien: Isolation, Elden Ring, Assassin’s Creed, etc. all used pathfinding AI?

Apart from them, almost all racing games use it, for obvious reasons.

Decision-Making AI

The next most common type of AI used in video games is decision making based systems. As the name suggests, it allows NPCs to make intelligent decisions. Of course, the accuracy of these decisions will depend on the dataset used to train the model.

Although the decisions made by non player characters are made with AI, the rules are always predefined in the form of a decision tree.

Unless you’re a programmer, you may not know what a decision tree is. Well, it’s nothing but a tree-like flowchart that illustrates decisions and their consequences.

how games act intelligently

The AI then uses this tree as a compass on the ocean to find its way to the right decision.

Now, you may ask what is the point of using AI if the rules are already assigned? It’s simply because AI can decide much faster and more accurately than humans. Also, it makes more sense for the ever-busy developers to let AI handle the task rather than programming everything manually.

Learning AI

This is a more advanced form of AI in gaming where characters can learn and evolve over time based on past actions. For example, you may find the same boss fight becoming increasingly more difficult as you respawn. It’s simply because the AI behind the boss is learning from its mistakes!

Modern AI systems can adapt this kind of behavior primarily through machine learning and neural networks.

What a fancy world we live in, right?

Another example of learning AI in a game environment would be FIFA games. How do you think the opposition players can predict your moves and intercept the ball every time you make a run for the goal?

fifa gameplay is dictated by ai

In case you haven’t noticed, the better your stats get in the game, the harder it becomes to win a match. It’s simply because the AI model is using data to improve itself too!

Reactive AI

The reactive AI in gaming comes into play when you (playable characters) interact with non player characters. They simply “react” to your decision.

For example, if you hit NPCs with your car in GTA, they die. But if you slightly bump the character, they may turn around and engage in road rage with you!

Interestingly, reactive models don’t have any memory and they only work on a task-based model. The output you get is based on your input.

This is why there is no single type of AI solution that developers can use in game programming.

Fuzzy Logic AI

When partial truth comes into play, programmers use fuzzy logic to deal with it.

To break it down, fuzzy logic (FL) is used when the input is not defined enough to reach an exact decision. For example, the answer to your input cannot be true (1) or false (0). Rather, any value between 0 and 1 is a valid output.

In the AI context, fuzzy logic is perhaps the closest thing we have that compares with human reasoning. An FL AI will take all potential outputs into consideration before deciding on one.

This is used widely for enemy characters who move and act based on the player’s ability and actions. This is a better way to use AI tools in games than using concrete rules. Otherwise, players would face no challenge, making the game design pale as snow.

Swarm AI

I’m a big fan of zombie games and Days Gone has been one of my favorites!

Hey, I know a lot of you don’t like that game for some reason. But I do, okay?

The way the zombie herds come at you, especially at night, is terrifying! Do you have any idea how many times I had to try to get rid of the sawmill herd?

This is a classic example of swarm AI in gaming. Any time the game designers need to implement a herd or a flock of non player characters, swarm AI comes into play.

Natural Language Processing

Natural Langauge processing or NLP is a fascinating branch of technology that overlaps with linguistics, artificial intelligence, and computer science!

ChatGPT is the prime example of what NLP can do in AI. And NLP in gaming refers to the use of language models that NPC behavior is somewhat based on.

Imagine running the curbs in GTA and bumping into someone. Whatever they say is processed by the NLP model. Rest assured that the responses will be different every time, before starting from scratch in a random order.

Generic Algorithms

Well, this is not one of the fancy types of AI in gaming. I can go on and on and keep listing them but that’s beyond the point. You get the idea, right?

Generic algorithms are pretty much everywhere and game developers use them pretty regularly. They’re “generic” because they don’t have any specific use case. Rather, their job is to evolve and optimize the game world.

Benefits of AI in Video Game Context

As every “expert” and their grandmothers are predicting that AI in gaming is the future, there must be some benefits to it, right?

Let me try and see through the future lens.

Enhanced Game Experience

This is undoubtedly the most obvious benefit of using AI models in our favorite games. Let’s be honest. As much as we human players enjoy the virtual world, it still feels virtual.

I did some soul-searching before writing this blog to figure out why that is. It turned out that at some point, games become predictable. And we don’t like it.

But when AI is successfully used in a game environment, it does introduce the life-like element, the element of surprise. And when actions by other characters become unpredictable, you have more problems to solve.

Isn’t that what we want? To be more engaged in the game we play?

Evolving as You Play

This is somewhat an extension of the point I just illustrated. All my played games were somewhat predictable. As long as I do the “jacket on, jacket off” move enough times, I can complete a mission with my eyes closed.

But not with the sky of AI in gaming lighting up like the 4th of July! Games now have the potential to grow with you. Red Dead Redemption 2 is perhaps one of the best examples of what modern AI can do in gaming.

Although finite state machines will always be limited in what they can do, RDR2 has shown how thousands of human and even non-human characters can act intelligently and independently.

Take finding the white Arabian horse, for example. You know you can find it on the northwestern side of Lake Isabella but it’s not easy. It’s simply because even the horse is powered by AI, wandering the mountains and living its best life!

Intelligent Non-Player Characters

There was a time when we could count the total number of NPC. Not in terms of number but in terms of variation. We could walk around the city and encounter the same NPC over and over again.

Well, we’re well past those days. Making games has come a long way and so has the database of non player characters. But they were still not very intelligent, up until now.

With the use of generative AI in gaming, the NPC-realm has become a different ballgame.

The enemies in The Last of Us take the win for the most intelligent NPCs, hands down. If you’ve played it and are familiar with the game world, you know what I’m talking about.

The GTA series and the Half Life Series are close competitors to The Last of Us.

Automated Content Creation for Game Developers

This is a benefit for developers rather than players. This is commonly known as procedural generation where AI algorithms can create new maps, quests, and even main missions based on inputs.

Needless to say, this is a great way of brainstorming in the early days of the development process. It not only reduces costs on the developers’ side but also introduces new dynamics to the gameplay!

The Sims series is a great example of the implementation of this new technology. Sims 4, the latest release of the series, uses AI for pretty much everything to mimic the social behavior of humans.

An example would be the posture transition map that dictates how a Sim stands, cooks, sits, showers, and does everything else.

When combined with AI programming tools, developing an immersive experience becomes really cost effective for developers. Instead of brainstorming and executing ideas manually, they can leave things up to the AI.

Of course, the final version of any of this goes through strict human supervision and quality check. Software developers still work hard to polish the new content before release.

What I’m trying to say is that technology has made entertainment a lot more cost effective and achievable for everyone.

Game AI to Balance Teams

If you’re into multiplayer games, you have already experienced this. Every time you look for new matches on first person shooters like Valorant, CSGO, or PUBG, AI algorithms are firing on all cylinders to provide the best match. In most cases, the matches are based on player stats.

Testing for Bugs

Testing and debugging is one of the most tedious steps in the software development life cycle (SDLC). I know programmers reading this will agree.

game testing in real time

But not with the introduction of AI programming tools like OpenAI Codex or Tabnine. These AI systems are optimized to look for bugs in the code and fix them. These tools also refactor the code to make it more optimized.

Collecting Player Data

No matter what an AI is designed to do, its primary source of power has always been data. The more data developers can feed the system, the better the outcome they can expect.

The use of AI in gaming creates a unique opportunity for developers to perform data mining. They can gather valuable insights on player behavior like when they stop playing, how long they play, live operations analytics, and a myriad of other cues.

What’s even more intriguing is that AI can determine the emotional state of the player somewhat accurately with data mining!

Needless to say, all of the data goes into making the technology better as well as improving the player’s experience for the future. In many cases, developers may share the data with other developers to help them make the industry better as a whole.

Future of AI Games

The video games industry already has countless examples of AI technology usage. You must be intrigued to know what the future holds, right?

Well, it’s too early to say anything for sure. Video games that use AI for procedural generation and reinforcement learning are still in the experimental stage.

Big-name studios like Rockstar or Capcom Entertainment (the creators of Street Fighter) are still not willing to let AI dictate the entire gaming experience.

They have valid reasons for this. Until now, developers have the option to test every case for bugs and cultural appropriateness before releasing it to gamers.

But if everything is in the control of a hyperintelligent AI, the possible combination of outcomes becomes infinite. This can lead to a myriad of problems unforeseen bugs, inappropriate content creation, etc.

Of course, there are bright sides to everything. So, let me focus on that rather than bumming you out with the downsides.

NPCs Will Become More Complex

In most video games, it’s the NPCs that bring everything together. Wouldn’t it be boring if it was only you interacting with the game world? As AI in gaming evolves, the NPCs will start to act more intelligently. They can learn from the environment and it can have a massive impact on the game design.

Realistic Interactions

When NPCs learn how to act intelligently, you can expect a lot more variation thanks to the procedural generation process. The NPCs will be able to make meaningful conversations with gamers, something we’re still to see in video games.

The best part of all this is that this will happen in real time, as the player takes various turns in the game!

More Personalized Game Assets

Did you know that video games developed to this day have similar assets all over the place? For example, all the games from Assassin’s Creed franchise use many assets across all the titles.

Of course, this is a way for creators to save money on asset development. And they usually do it for assets that don’t hinder the player’s experience as much. The texture of a wall, for example.

But when AI has more control over the games, the ability to generate new assets is infinite. This means developers will no longer need to use the same assets, resulting in a more unique and personalized game experience.

Cloud Gaming

In recent years, cloud gaming is getting traction in the industry, and game AI can really enhance the game experience. Xbox Cloud Gaming is a good example but it’s still in Beta. Nvidia’s GeForce NOW is another example.

The whole idea behind cloud gaming is that you no longer have to worry about hardware limitations. Everything will be rendered on the cloud and you’ll just use a screen to watch.

Of course, you’ll need peripherals to control the game. Even mobile devices can work to run PC games if the video game industry progresses enough!

FAQ

How is AI used in gaming?

AI is used across different planes of the gameplay. From guiding the NPCs to the interactions, the whole game experience somewhat depends on the quality of the AI.

What game has the smartest AI?

Well, this is somewhat subjective as different players like playing different genres of games. From the developed games I’ve played, I can say Red Dead Redemption 2, The Last of Us, and F.E.A.R. has some of the smartest AI in gaming.

Are bots in games considered AI?

They are. However in the existing games, the level of intelligence for these AI bots is not very high. This is why they come across more like bots than a playing companion.

Is AI used in PUBG?

Yes, PUBG uses AI to match players for more balanced gameplay. It also uses AI for anti-cheat measures.

Subscribe
our newsletter

Stay ahead of the tech curve with our cutting-edge software and technology newsletter