bit-gamer.net

What the hell is videogame AI anyway?

Posted on 16th Jul 2014 at 09:05 by Rick Lane with 10 comments

Rick Lane
Dearest readers of bit-tech! Come hither and listen to my whispered words, as I am a troubled soul. For a long time now I have lamented the lack of progress made in the AI sphere of game development. In the years surrounding the millennium AI was bold and bright and exciting. Games like Unreal Tournament, Thief, Black and White and Halo were doing clever and innovative things with artificial intelligence, providing enemies that could use teamwork to outmanoeuvre us, guards that would hunt us, and a big daft monkey that could learn from us.

This continued until around 2005, with FEAR being the last game I can recall with truly memorable AI. Then something changed, and after that nothing changed. Stealth AI has patrolled the same pathways for years, shooter AI crouched behind a wall circa 2006 and decided to make a home there, and when was the last time you played a game that involved the AI learning anything?

What the hell is videogame AI anyway?
Click to enlarge

Until very recently this was more or less the sum of my position. Game AI has stagnated. This is bad. We need to do something. Yet I've been reading a little more about the subject lately, and looking into a couple of interesting projects, and this has resulted in my altering my stance. Now I'm unsure what video game AI is at all. What's more, I think my own dilemma is not altogether dissimilar from the problems the games industry is encountering.

The problem begins with the very meaning of the term "AI". When I think of an AI, I picture an android, or a sentient computer like GLaDOS (which, ironically as a game AI is about as intelligent as a shoe). Aside from the fact that they're both created using computers, a technological AI bears little in common with a game AI. The ultimate goal of technological AI is to give it an equal level of sentient intelligence as a human being. Game AI only needs to appear as intelligent as the game in question requires it to, and it can do this by any means necessary, be it through scripting, pathfinding, or more emergent techniques.

Immediately this conflation of concept causes problems. When criticising games it is tempting to judge AI based on its intelligence. But it's very easy to make a game AI super-humanly intelligent, and in most cases that isn't going to make the game better. Ideally, what you want in the majority of games, certainly games like shooters or strategy games, is for the AI to be humanly stupid. It needs to be capable of making clever decisions and reasonable mistakes.

What the hell is videogame AI anyway?
Click to enlarge

But hang on, isn't that also the goal of technological AI, which we just said was completely different from game AI?

No, the goal of technological AI is sentience. It can be as smart as we dare make it, but regardless of the level of intelligence, the AI needs to be capable of reacting to and coping with any given environment. Game AI, on the other hand, only needs to act human within the confines of the game, which by comparison is a far less demanding task. So an FPS needs its AI to shoot at the player, but not hit them with pinpoint accuracy every time. Other important capabilities are navigation of the map, use of cover, and possibly some tactical decision making, such as flanking and covering fire. It doesn't need to be capable of empathy, or making moral choices, or even feeling anything. This is very different from a game like The Sims, where the AI's ability to demonstrate and respond to physical needs and emotional moods are vital components of the game.

What the hell is videogame AI anyway?
Click to enlarge


Hence, it appears to be the limitations imposed by gaming genres which defines the difference between game AI and technological AI. The goals of video game AI are smaller, more specific, which is why it seems to be such a broad church with no real direction.

Only, maybe it shouldn't be. Perhaps the reason we don't see game AI developing as we would like is because genre is defining AI development when AI development should be defining genre. Maybe, for video game AI to really progress, a unified approach is necessary.

To understand this, let's consider another area of game development which has made huge leaps in the last ten years - graphics. Historically, graphics development has been driven by the ultimate goal of photo-realism. Now, regardless of whether or not you think photo-realism is a valid target to shoot toward or not, the universal desire of mainstream publishers to push further toward this objective has resulted in a rapid advancement in games' ability to render convincing environments, characters, and so on. It never really mattered what kinds of games were being made, it was just assumed that players would want their games to have better graphics.

What the hell is videogame AI anyway?
Click to enlarge


AI, on the other hand, has never really received the same attention, never been pushed forward for its own sake. Instead its development has always been based on the needs of individual games. This is a shame, because when individual developers have experimented with new AI techniques, the consequences can be enormous. The entire stealth genre exists because Looking Glass Studios took the two default AI behaviours of "passive" and "aggressive" and sandwiched between them a third state of "alert", where the AI searches for the players presence but it's actively aware of their location.

Now you might be tempted to point to a game like Far Cry as an example of more recent evolutions of AI behaviour. But ultimately all these games do is combine different types of AI scripts that have existed for years. If we're to see radical changes in terms of the games we play, we need to explore new or at the very least rarely used types of AI. Either way, AI needs to be at the forefront of the developer's mind.

The good news is, there are a couple of games on the horizon which are prioritising AI. The first is Simon Roth's Maia, which tasks you with building and maintaining a colony on a hostile alien planet. Inspired by the classic Bullfrog management games, particularly Dungeon Keeper, Maia features autonomous colonists whose actions you can only indirectly manipulate rather than directly control. In addition, Roth plans for Maia to have a far more granular AI simulation than its inspiration. Colonists will have different moods and emotional states which are affected by their environment and can affect their behaviour.

What the hell is videogame AI anyway?
Click to enlarge


The second game in question is Clockwork Empires, which like Maia is a colony simulator, except set in colonial America. Again, it feature autonomous colonists who you cannot control directly, but it's approach to that autonomy is slightly different. Colonists have different personality traits which affect their behaviour with other colonists. They can also exchange ideas and preserve memories. The ultimate extension of this is that, if you leave your colonists with too little to do, they can become bored and will develop an interest in the occult, which can lead to them unleashing some ungodly terror onto the colony, leading to its destruction. But this system can also express itself in other, smaller ways, how colonists react in battle, how they cope with loss, so on and so forth.

Both games are still heavily in development, so it'll be some time before we see whether they can deliver on their promises. But in theory at least, both Maia and Clockwork Empires lean toward emergent AI that is rarely used in games, where the AI can "learn" through player response to its actions. The Creature in Black and White is the most famous example of this, and why, despite its problems, I have an enduring fondness for that game. But there are other prospects for this AI as well. A typical example would be an XCOM-style game where, instead of controlling your soldiers' actions directly, you train them in certain tactics before a battle, and then send them out to fight autonomously.

What the hell is videogame AI anyway?
Click to enlarge


Although the more experimental approaches of Maia and Clockwork Empires are exciting, they don't represent a unified push in AI development. Both games are still creating specific AI for specific games, it's just that AI is very much the primary system in those games rather than a secondary or tertiary consideration.

What's more, the importance of AI is only going to grow in the coming years, certainly as a focus of mainstream developers. As tech like VR headsets make games more immersive, while huge open worlds and pretty visuals become more and more commonplace, it will be those studios that can keep that level of immersion consistent using convincing AI behaviours which will garner the most attention. Eventually, game AI will have to stop cheating, and learn to cope with the worlds developers create.

10 Comments

Discuss in the forums Reply
edzieba 16th July 2014, 20:04 Quote
Quote:
No, the goal of technological AI is sentience.
No, the goal of STRONG AI, in a RESEARCH environment, is sentience. The goal of AI research everywhere else is creating systems that can solve problems in uncontrolled environments with a minimum of manual pre-programming. That goes for flight control computers able to deal with the loss of control surfaces, vision system that can identify objects that aren't placed directly ahead in a specific area with even lighting, etc.
Donteatmypanda 16th July 2014, 20:56 Quote
Half life was the last time game ai excited me... Lets hope alien isolation can break the mold a wee bit.
D B 17th July 2014, 02:36 Quote
the AI in the first FEAR was good .. I don't know what the hell happened to it the substituent ones ... disappointing is too weak a word
Gunsmith 17th July 2014, 02:48 Quote
FEAR is often mentioned in AI discussions but it was just an amazing use of smoke and mirrors as well as level design.
SchizoFrog 17th July 2014, 03:52 Quote
I don't get the praise for the AI in F.E.A.R at all. I absolutely loved the game it has to be said and I played it through time and time again but the AI was non existent. You walked through a series of corridors until you heard the 'baddies' talking over their radios and you instantly new that around the next corner you would have a gun battle. Apart from a couple of occasions, if you stopped walking as soon as you heard the radios the 'baddies' never came looking for you which after all, was exactly what they were supposed to do.
You could even work out 'markers' that set off a series of events such as when the invisible guys would appear and either ran away without you ever being able to shoot them or they attacked you in a very pre-defined routine of movements.
Another thing was that you could even count the bullets that it took to take down one of them, especially once you got the 'bolt' gun that usually pinned people to the wall (I LOVED that gun) and so I used to be able to count my bullets and know how many baddies were coming up and where, then plan my attack strategy.
Things never changed, the bad guys never reacted and responded to the differences in how you played the game as they either stayed where they were or their whole group engaged until the last one was dead and you carried on walking through to the next battle. Not a single guy ever ran off... and although they nearly always screamed out 'He's here... Back up... WE NEED BACK UP!', no back up was ever forth coming.
So my point is, where exactly is this AI I hear about?
Bede 17th July 2014, 10:28 Quote
Image links should be changed from .jps to .jpg.

"the AI searches for the players presence but it's actively aware of their location."
>>would have thought that the AI would be searching for the location while aware of player presence.

Dwarf Fortress appears to have pretty interesting AI, and is rather more developed than Maia or Clockwork Empires.

----

Other than that... AI is a catch-all term like netcode. Better to break it down to RTS AI, TBS AI, FPS AI etc.

Pathfinding is a pretty key element of most game AI. Anyone who made maps for old CnC games, or tried introducing bots to a game like Natural Selection knows the pain of creating paths for AIs.

In a game of Medieval 2 Total War I accidentally trapped the Timurids in a moment of indecision by fortifying all the cities and bridges near where they spawned to such a degree that even they were unwilling to attack them. So 8+ full stacks of Timurids and at least the same number of my own troops sat around in a stalemate until the end of the game.

FPS AI is (to my mind) rather easier than a strategic AI. The bot usually has one task - shoot the player, and it's relatively simple to introduce an element of random deviation into their targeting to keep the player happy. Where it falls down is getting bots to accomplish more complex tasks - hence the scripted companion AI sequences we see. Portal 2's, truly "on rails", Wheatley was pretty sound commentary on this.

RTS AI developers have perhaps the easiest job initially, but the hardest to improve. Success in most RTS games is heavily dependent on macro build orders combined with good micro. Build orders can be programmed, micro comes relatively easily to AI (see that Starcraft 1 swarming Mutalisk AI built by that American university). The trouble has always been that (like playing the same player over and over again) players learn the AI's various routines, and countering becomes natural.

As in all things gamey, the player's experience is key. Paradox appear to have largely overcome the AI problem of mundanity through sheer complexity - the number of AI actors in the worlds they create make the system so complex that the outcome is always different.

Perhaps what we need is a John Carmack of game AI...
tupera 17th July 2014, 20:03 Quote
Even before I finished the 1st paragraph, I was thinking of F.E.A.R.

I have to disagree with SchizoFrog. While it's been a while since I've played F.E.A.R., I do remember the AI spotting your flashlight if it's on even before you rounded the corner. I also liked that if you entered a room stealthily, you could pick off the 1st unsuspecting guy, but then all others were harder to kill because they were now "alert".
ferret141 18th July 2014, 10:54 Quote
What do you guys think of the AI in the first FarCry game?
If I remember correctly it was the first game I had encountered AI that would flank you and try to attack you from multiple directions simultaneously.
Then again I was young at the time and easily impressed so I could be wrong.
PaulJG 18th July 2014, 13:50 Quote
That was an interesting article.. for me it was Doom 2 that made me sit up and take notice of game AI (missed out on the first doom) - you could orchestrate a mass brawl between the AI monsters with a sneaky shot.

Agree with ferret above, farcry had some pretty clever AI - as did Black and White.. after that - yeap - it does seem things have been dumbed down, But is that because these days they are all using the same game engines, reusing the same in-built routines!?

All too often you can see the same mistake.. hide round pillar.. AI starts to come round, you move slightly to the other side.. Z1>Z2 - so reverse the direction! - its just poor.
Rob Lang 19th July 2014, 00:29 Quote
There's quite a lot wrong with the "technological AI" side of this article, here are some corrections.
Quote:
Originally Posted by The Article
The ultimate goal of technological AI is to give it an equal level of sentient intelligence as a human being

No. Sentience is act of being able experience sensations. Sentience requires sensation of the world outside of the simulation, so isn't really just about AI, it's about robotics and AI together.
Quote:
Originally Posted by edzieba
No, the goal of STRONG AI, in a RESEARCH environment, is sentience

No. Strong AI is about striving to make a machine intelligence indistinguishable from a human intelligence.
Quote:
Originally Posted by edzieba
The goal of AI research everywhere else is creating systems that can solve problems in uncontrolled environments with a minimum of manual pre-programming

No. This is a tiny subset of AI. I'll come onto why in a moment. Back to the article...

What game AI is
There is an area of AI called "Expert systems", which are probabilistic state machines (AKA Markov Models). They work like this: given your current state and a number of inputs, randomly choose a new state based on a probability. For example, if you're in the open and being shot, there is a 1% chance you'll run at the enemy, 60% change you'll find cover and 39% chance you'll just stand there and shoot back. Keep doing that for a few ticks of the game and then choose again.

Expert systems in games are complex things and are not to be sniffed at. Most industrial computing (financial models etc) are state machines. By having each agent (bad guy) have slightly different percentages or behaviours, you can make them appear intelligent and more interesting to fight.

What the rest of AI is
Most of the rest of AI is the pursuit of one or more of the following:
  1. Learning: changing what you do given the environment and what you tried last time.
  2. Generalisation: I've seen a tiger and a leopard, I can see that a cheetah is like those.
  3. Clustering: grouping similar things together
  4. Classification: being able to tell the difference between a dog and a cat
  5. Association: understanding that the reason you're hot is that you're on fire
  6. Prediction: Having watched children's TV, you know that B follows A most of the time
  7. Reasoning: (deductive and inductive) You're either at home or at work. You're not at work, therefore you're at home.
  8. Problem solving: What steps do I have to do to achieve a goal? (This is what expert systems are really good for). Evolutionary computing also does this by trying lots of different solutions simultaneously and picking the best.
  9. Abstraction: That cloud looks like a bus (this is way more complex than just pattern matching as it requires experience).

Uncontrolled environments
Every environment is bounded. It is always controlled at least within the boundaries of physics. Even the most complex AI algorithms perform a transform to the input data before they go to work. That transformation seeks to smooth out the data to make it easier to use. Some AI works on non-stationary environments, which is like changing the goal-posts. For example, you have a UT2K4 shooter where people have been running around the levels for a decade. The AI learns the maps, understands what players are likely to do. You then add a mutator that does something extraordinary, the AI then has to cope with the changing environment.

Emergent AI?
Emergence isn't very complicated. If you have enough agents all with very simple rules, complexity can "emerge" where the algorithm designer didn't think it would. A really good example of emergence is Conway's Game of Life, which has the simplest rules you can think of by complex patterns appear to emerge. Emergent AI happens all the time in loads of games.

A note about biological modeling
A bunch of games use biological models (e.g. flocking or the A* path algorithm) that mimic how nature works. Those algorithms are clever but without Learning, Generalisation, etc, they're not really intelligent as such.

Is proper AI used in games?
Not really. Maia and Clockwork Empires look like complex state machines. If they are able to change their probabilities, that's a bit like AI but I imagine the changes will be linear (like in Black and White); that means that when you do X then it changes the behaviour a bit. Do it more, the behaviour changes a little more.

Why not use academic/industrial-like AI in games?
You don't need to. In programming, it's best to solve your problem with the simplest tools at hand. Coding and training AI algorithms takes a huge amount of time and your players aren't necessarily going to see the benefit when a well constructed Markov model will keep them guessing, entertained, surprised and delighted.

Get the game out, keep it simple and make a profit. Players will appreciate content and features much more than the technical wizardry behind the scenes.
Quote:
Originally Posted by Bede
As in all things gamey, the player's experience is key. Paradox appear to have largely overcome the AI problem of mundanity through sheer complexity - the number of AI actors in the worlds they create make the system so complex that the outcome is always different.

This.

Know for sure that a game uses industrial/academic AI?
There might be a game out there that is proven to use AI that isn't an expert system, I'd be keen to hear about it! :)
Log in

You are not logged in, please login with your forum account below. If you don't already have an account please register to start contributing.



Discuss in the forums
The Evil Within Review

The Evil Within Review

21st October 2014

Wasteland 2 Review

Wasteland 2 Review

17th October 2014