Updated date:

Artificial Intelligence In Video Games - How Good Is It?

Tim Arends has made a study (and over 40 videos) of the artificial intelligence in the classic video game Carmageddon.

artificial-intelligence-in-video-games-how-good-is-it

Most people use artificial intelligence every day, whether it’s talking to Siri or Alexa or performing a Google search. Whether you know it or not, when you play a video game, you’re also using a form of AI. Even a game like Pac-Man has a degree of artificial intelligence, if only a crude one; the ghosts in the game either chase or run away from the player.

People often debate the merits of playing against another human (multiplayer) vs. playing “against the AI.“ Aside from this, most people don’t give much thought to artificial intelligence in video games, other than to consider it inferior to playing against a human, and something to be done only when human opponents are not available.

Of course, playing against an artificial intelligence in a video game has advantages as well. Computers don’t have egos, so they don’t gloat when they win or rub their victory in the player’s face. They don’t generally “cheat,” either, except in the case of bad programming. They don’t care whether they win or whether the player wins, only about following the rules set by the game itself.

Videogame Scene from the Movie "HER" (Crude language)

Problems of AI

AI can not only drive video games, it can play them as well. Starting back in the 1960s, it began playing expert level chess. Today, DeepMind is crushing even professional StarCraft players.

But the AI that drives video games has not been advancing to the same degree. Many modern day video games haven't progressed much beyond the old Pac-Man!

One problem with AI is that it can be unpredictable. Developers of driverless cars are grappling with the problems of keeping it safe and handling emergency situations. A recent concern, perhaps bordering on hysteria, is “racist“ or “sexist” artificial intelligence that comes to biased conclusions based on the data it’s fed. Surprisingly enough, this unpredictability can also be a problem with video games.

So how does AI in video games work?

According to Julian Togelius, Associate Professor of Computer Science at NYU’s Tandon School of Engineering, interviewed by The Verge for a video on game AI, “Two of the core components of commercial game AI is pathfinding and finite state machines.“ Pathfinding, he says, "is a way to get from point A to point B in a simple way. Finite state machine is a construct where an NPC can be in different states and move between them."

Deep Learning

The field of deep learning is another way AI developers can make astounding progress in artificial intelligence in a short amount of time, although this technology is not used much in video games (but I’ll give an example shortly of a game in which it was).

According to Togelius, “Typically when you design a game, you want to know what the player will experience, and for that, if you’re going to evolve an AI there, you want the AI to be predictable." But if you threw a neural network into a video game that was constantly adapting and learning, there’s a very good chance it might break the game!

For example, the developers of the video game Oblivion created an advancement in artificial intelligence called Radiant AI, which governs the behaviors of NPC‘s and gives them a routine so that they don’t end up standing in the same place all day. Guards patrol the streets, NPC’s have lunch at noon, farmers work the fields and they all hit the sack at bedtime.

However, the AI was too good in certain respects. For example, certain NPC‘s were addicted to a substance called Skooma, and they ended up spending all their time trying to get ahold of the stuff, meaning they were already dead when the player got to them! Obviously, this kind of AI needed to be toned down.

Top 10 Video Games with the Best AI

Procedural Generation

There are other ways in which artificial intelligence in video games can advance dramatically in the 2020s. One way is through procedural generation, or the creation of randomly generated landscapes, environments and even faces. Nvidia has used a game engine to randomly create realistic video footage of a car driving down a city street, as well as computer-generated, photorealistic human faces.

Ultimately, the holy grail of game AI will be the creation of NPCs that can “ad lib“ or engage in independent dialogue with a player based on the player's actions -- without needing to pre-program the dialogue into the game beforehand.

Already, some remarkable things have been accomplished with artificial intelligence in video games, as listed in a video by WatchMojo called "Top 10 Video Games with the Best AI" (above).

In Thief: The Dark Project, enemy NPCs would dive behind objects, move around the environment and flank the player from all sides. In F.E.A.R., Enemy soldiers know how to dive behind cover, use multiple means of attack, call for backup or just run away. In Condemned: Criminal Origins, enemies will feint during combat to bluff the player and, if all else fails, retreat and hide behind corners, only to ambush the player at an opportune moment.

So, the solution to game-breaking AI in video games seems to be incorporating the AI into specific areas of the gameplay, but not allowing it free reign to take over the whole game.

Poll: Your take on video game AI

How the AI Works in Carmageddon

Carmageddon and AI

I have done my own exploration of AI in video games, particularly in the game Carmageddon, which I have played off and on for years. This is sort of a cross between a racing game and a demolition derby, with the added ability to run over pedestrians (a feature that garnered it a bit of controversy when it first came out).

The first release of the game back in 1997 had only a passible artificial intelligence. The NPC vehicles were often annoying in that they would keep trying to crash into the player’s car even when he simply wanted to run the race.

They showed other dumb behaviors as well, such as trying to hit the player’s car when he was on top of a ramp by repeatedly crashing into the ramp itself! (An update to the first version of the game improved the AI somewhat).

Another problem was that the NPC cars had a tendency to teleport around on the map when out of view of the player, meaning that the player never could be quite sure where the opponents were at any given moment.

Can a video game have Intuition?

AI in Carmageddon II

The second major version of the game in 1998 greatly improved the vehicle AI. The teleporting behavior of opponent NPCs was eliminated. In fact, the developers added a tool to the game called the “manual cam” that allowed the player in instant replay to follow the movements of any NPC vehicle at any time. Consequently, when the player checked the map, he could be pretty sure he knew the location of all opponent NPC’s at any given moment.

Another improvement was that the NPC vehicles seemed to understand what the player wanted. If the player simply wished to run the checkpoints and finish the race, the opponents would rarely crash into him. He might see an NPC temptingly turned over by the side of the road from time to time, but if he didn’t wish to be involved in a demolition derby, the NPC’s seemed to understand this and concentrated on chasing checkpoints as well.

As I continued to play the game, I noticed another interesting aspect of the AI. The AI tended to make the game always seem “winnable.“ Even though I was a rather poor driver of my virtual car, the opponents were never so far out of view that the idea of catching up with them seemed hopeless. What’s more, if I got tired of running the race and decided to take advantage of the demolition derby aspect of the game, the AI seemed to understand this. The NPC’s would stop running the race and would start trying to beat the daylights out of me!

Funny! I "Tease" the Artificial Intelligence

Carmageddon and Deep Learning

Even more impressively, I noticed that the NPC‘s had the uncanny tendency to appear in my vicinity just as I was destroying another opponent. This was particularly impressive since the maps in the game were huge and the odds that an opponent just happened to be in my area as I was finishing off another NPC were slim to none.

So I decided to run the instant replay feature and use the “manual cam“ tool to see what the NPC‘s were doing. I discovered a remarkable thing — the AI had the ability to predict when I was about to defeat an NPC car, and it sent the next one so that it would arrive in view just as I was finishing off the previous adversary! This helped to keep the game fun and fast moving.

My theory is that the developers of the game used a method of creating AI called “deep learning,“ or allowing an AI to teach itself by being presented with many examples of a concept they wish it to learn. This can allow an AI to come to conclusions that the developers would not have thought to teach it on their own.

In the case of Carmageddon, I believe the developers “trained” the AI by having it watch hundreds of people play the game (or a few players play it for hundreds of hours). In this way, the AI learned what behaviors a player demonstrated when he was trying to “waste“ an opponent vehicle, allowing the AI to develop an uncanny ability to predict when the player was about to do so.

10 Traits of Human Intelligence

AI Meets With Skepticism

I wanted to share my discovery with others who I thought would appreciate it, and what better place to do so than the forum devoted to the game? (Actually I thought, if anything, the regulars would dismiss my discoveries as “old news” — something they already knew about.) Therefore, I was surprised at the reaction: they said I was overestimating the AI in the game, it was really quite rudimentary, and I was attributing to artificial intelligence things that were actually mere coincidences!

If only I had some video proof of what I was saying! So I decided to upload to YouTube a series of videos of the artificial intelligence in the game with numerous examples of how the AI would predict when I was about to waste an NPC car and set the next one to arrive at just the right moment. I even used split screen to show how the AI’s movements coordinated precisely with my own.

In one video I even showed how the AI appeared to display ten traits of human intelligence. I consider this an impressive proof of concept of how human-like it is possible for artificial intelligence to be under the right circumstances.

However, it was all for naught! No matter how many videos I uploaded or how much evidence I presented, most viewers stubbornly insisted that I was reading into it an intelligence that simply wasn’t there! When I realized the viewership of my videos was declining rather than growing as I continued to upload more examples, I finally gave up. Meanwhile, concurrently uploaded videos of people mindlessly playing the game typically racked up hundreds or even thousands of views.

BEST Mind Reading EVER!!! - Artificial Intuition

AI Phobia?

My conclusion is that many people feel threatened by the thought of artificial intelligence. For one thing, there is the “Terminator” scenario of artificially intelligent robots that go around killing people, but I think there is more to it than that.

You see, the proudest trait of human beings is their intelligence. It is what separates us from the animals. So, many people feel threatened by the idea that a computer — a mere machine — might one day show an intelligence that rivals that of humans, and in some cases, even surpasses it.

True, today, we have many wonders of artificial intelligence — Siri and Alexa and Cortana, face recognition, driverless cars, machine translation of one language to another, image recognition, optical character recognition, speech recognition and software that can read aloud the text of printed books. We even have software that can play grandmaster level chess.

It doesn’t matter, because all of these things can be and are dismissed as not being “true” intelligence. In fact, each of these things was once heralded as a sign of intelligence before it was achieved — and once achieved, was dismissed as “mere computation.”

Many things are considered intelligent or requiring intelligence when done by a human, but not when done by a machine! In fact, one AI researcher lamented that the definition of “intelligence” always seems to be whatever computers are still unable to do! So I guess it isn’t surprising that I was unable to break through this resistance with my own videos.

Still, the concept of artificial intelligence in video games is a fascinating one. AI allows us to participate in engaging gameplay when there is no other human available to play against. And someday, it may reach the level shown in the movie “Her.” Perhaps that day is closer at hand than we think.

Top 10 Examples of A.I. in C2

Poll: Video watchers