Article
i/2008/04/dice-eight.thumbnail

Why Not More Simulation in Game AI?

Dave Mark on April 15, 2008

This week’s developer discussion on AiGameDev.com focuses on a favorite topic of Dave Mark — the AI guru at Intrinsic Algorithm. Let him know what you think about the ideas in his article by posting a comment below!

Back when I was young, when games were played with paper and pencil, a “die roll” actually involved rolling a die, a cut scene was something spoken by a DM, and in-game graphics fidelity was limited only by your imagination, the original and pleasantly concise book AD&D concept of the “Magic User” (with caps) was “a dude who could use magic.” Since those days the concept of a “magic user” (no caps) has been fractured into the specialties of abjuration, conjuration, divination, enchantment, evocation, illusion, necromancy, and transmutation. You can’t just be a “Magic User” anymore — at least not without severely limiting yourself.

In recent years, the field of game AI has become increasingly more sub-specialized. As I participated in formal or casual group conversations at the recent GDC, I found myself quietly making notes of how many times two different game AI programmers could have very different areas of expertise. Sometimes it got to the point of not even knowing each others’ terminology. And that was becoming obvious in the gatherings at GDC. If the conversations were an indication, it seems that you can’t just be an “AI Programmer” anymore — at least not without severely limiting yourself.

Differences and Similarities

While there were common threads amongst these people, there were also plenty of occurrences when there would be awkward exchanges between them. For example, a specialist in animation AI (necromancy?), someone who was using search algorithms for planning (divination?), and a behavioral AI designer (enchantment?) may have large areas that were not covered in the Venn diagram of their knowledge bases and associated job responsibilities. A comment that would be heard often enough in these conversations would be “Oh, I haven’t gotten into that kind of AI.”

Advanced Dungeons & Dragons

Not to say that we all weren’t curious about each other’s specialties. We were also somewhat evangelistic about our respective areas of interest or expertise. When speaking about my own work, I often found myself asking some form of “But why wouldn’t you want to add this to your AI?” Thankfully, for the most part, this question was well received by the other AI professionals I spoke with. Of course, I found myself asking the same question about what they spoke of. “Why wouldn’t I want to add [their nifty technique] into my own AI?” After all, that is what GDC is all about… not just learning about those nifty techniques but pondering the possibilities of how they can be used in our own projects.

The AI Elephant in the Room

Unfortunately, another comment that occasionally bubbled to the surface to burst with an uncomfortably sulfuric aire was something to the effect of “I just don’t see why [that concept] would be a big deal.” I paraphrase this, of course, for the sake of genericy and simplicity. Suffice to say, however, comments such as these evoked a palette ranging from uncomfortable shuffles to incredulous looks. Manners aside, on rare occasions I agreed with the speaker. However, more often than not I could not help but be a little baffled as to why this person would think that a particular idea was not useful. This was especially evident in the cases where the aversion seemed to be born out of either fear or misunderstanding of the technique itself. I wondered if this mentality was more pervasive “out there” in the industry. Perhaps this narrow-mindedness, regardless of it’s reasons, is what is holding the sub-industry of game AI back from achieving our ostensible collective goal of more realistic behavior. (Although the premise that we are trying to achieve “realistic behavior” is, itself, certainly subject to debate.)

While there were plenty of little things that I shook my head in consternation over, there was one theme that cut me deep. Why aren’t people more interested in using “simulation” techniques in the AI of individual characters? It seems to me that the concepts that make up — or at least underlie — simulation would be the spells that we could all cast. Everything we as AI programmers do should be based on the idea of simulating something.

The 2008 AI Programmers Dinner at GDC

The conversation at the 2008 AI Programmers Dinner was more than a meeting of the minds. Often, it was a meeting of differing disciplines entirely.

For example, if you are tasked with modeling an NPC, certainly you would have to take into account the pathfinding, steering, perception, interaction with objects, reaction, and the various animations that make all of those visible to the player. Admittedly, all of the above can get exceedingly complicated these days. In the most recent (4th) book in the AI Game Programming Wisdom series alone there are 12 separate entries just on improving pathfinding — including one by Chris Jurney dedicated entirely to turning vehicles. These advances that cut through complex issues are all well and good, but what about simulating the decisions that either result from those aspects (like perception and reaction) or drive them (like the interaction and animation)? We spend a lot of time modeling what the NPC can do and how he/she/it does it. But what about the why? Put another way, we model what their bodies do, but what about what their brains are doing?

There are strides being made with this at various levels of complexity. It started with random “die rolls” to determine state transitions and most recently has advanced with a sojourn into various forms of planning algorithms. Still, it is amazing to talk to AI programmers that say “Well, I haven’t gotten into that sort of thing; I don’t do simulations.”

“I haven’t gotten into that sort of thing; I don’t do simulations.”

This statement represents a great curiosity to me. Are these sorts of advanced, often multi-layered, calculations and algorithms only relegated to the Starcrafts and Civilizations of the game world? If there is a resistance to using complex mathematical bases to determine the behavior of individual NPCs, from whence does that come? It used to be a lack of processing power but Dr. Moore is coming to the rescue on that front in grand exponential fashion. (Although Ray Kurzweil may argue that it is logarithmic instead.) Another common answer is that “our NPCs don’t live long enough to exhibit those behaviors”. But is that an excuse for not developing deeper behaviors or rather a result of the fact that we haven’t? Perhaps the very fact that our NPCs are dying so quickly is an effect of the limited amount of behavioral depth we are putting into them? To be argumentative, one could say that the NPCs don’t live long enough to show off all those pretty animations either.

Is Simulation the Common Thread?

So where are we? As much as the knowledge-hungry part of me would like to argue otherwise, I have to concede that we can’t do everything in AI anymore. The field has gotten too big and too specialized. While we may all be “magic users”, we have our own individual disciplines and even our own languages to some extent. But are those programmers who choose to venture off into the more esoteric pursuits sometimes doing it at the expense of what AI truly needs as its bedrock? Should even the most basic decision simulation algorithms be the among the cantrips that we all draw from regardless of our AI speciality? Do we owe it to our craft to remember that we are breathing life into our creations — not just so that they are animated zombies without a soul… but thinking entities?

Discussion 12 Comments

NinjaItachi on April 16th, 2008

Good topic, it just got me thinking about : "Our NPCs don't live long enough" In most FPS these days an NPCs last just a few seconds, practically stupid throw away agents. And we use 100s of them to build our games. However thinking back about it in another way, why do we do this? I mean there used to be fighting games, and NPCs we're kinda smart, or more precisely they lived longer (say 30 seconds to a minute each each). And each 30second play would become an engaging excersice in dancing with the AI, and occasionally we'd even be amazed or had memorable moments(interactions with these AIs). Remember Halo's devs' experience that NPCs that lived longer seem smarter? Maybe we should be worried about making our NPCs live longer, it'll take some effort to convince designers, but I'm sure everyone (especially AI and Artists) would like less NPCs but each living a longer life.

Ian Morrison on April 16th, 2008

Absolutely. If the AIs isn't getting enough time to show off their fancy behaviours, that's not an argument against the behaviours, its an argument against killing 'em off so quickly! As much as I liked COD4, I really felt like a one man army the entire time, mowing down legions of (supposedly) highly trained troops, taking ridiculous amounts of punishment, and generally finding my teammates to be nothing more than an excuse to add more bullet tracers to the battlefield. This is a really old fashioned way of doing things, to be honest. While I appreciate the "one man army" bit, even that requirement doesn't mean your enemies need to be pushovers. ...at the very least, they could stop standing in the open begging to be shot like gun-toting drool dispensers. [edit]Damnit. Alex, the comments on your blog and the comments in the thread don't contain all the same posts, so my comment looks a little out of context!

andreialex on April 16th, 2008

As academic AI research "leeks" into the industry, so does the monstrous split between AI academic fields; that means you are probably going to see more of the "I haven't gotten into that sort of thing" attitude, but it is rather sad to hear the associated phrase: "I don't do simulations". The gamer inside me shouts back an answer: "Yes you do, silly!" Forget for a second the trivial "smoke and mirrors" you are using and just play any game as a teenager does. It's nothing more that a simulation, a good one if it survives the initial curiosity of the player, and a bad one if you can "figure a way around" the AI and beat the "automaton" out of it. A few "Monster" objects with 10 (automaton) states (enum{walk, run, kill, ...}) can make for "an entertaining gaming experience" if you limit yourself (read "the player") to thinking or acting in 10 or so ways on a few very limited paths. I know that it's very hard to do more, but one should, at least, try if one is not programming by the old traditional cookbook. I find one smart AI buddy much more entertaining than shooting 20 stupid bots you can just wait for around the corner or you can just shoot one by one as they open the door. You can try to script such a behavior but the illusion is going to last just as long as player can fool himself that it's real interaction. One you encounter these limitations (I do pretty soon in games) then the magic is over, so "turn off the lights", uninstall and play another game. (just one more paragraph... :) one other thing on my mind.) I do not personally blame the industry for using bottom-up approaches almost all the time. That is you spend all the resources on "primitive" actions like "path finding, steering, perception, interaction with objects, reaction, and the various animations that make all of those visible to the player". In the end that's what is most obvious to the player. But I'm telling you that dumb AI characters are going to make all the artwork and finite states spend an eternity forgotten in cardboard boxes, no matter how many scripts and complicated graphics you use. We've seen it all before, we play it once so that we don't feel like we've wasted money on the game and it's goodbye. That's not going to make me enjoy the game more or play it again, but a good fight and lively NPCs, good teammates and a world full of surprises sure will!

Dave Mark on April 16th, 2008

@ Andrei Uh... wow. Well put, sir. @ Alex We may need to change from weekly "developer discussion" to weekly "rant catalyst".

RyanP on April 16th, 2008

Maybe it is me, because I am "new" to the community but I see quite a few things that I feel are horrible ways to look at these issues. Call me idealistic but AI is an advanced topic you need to know a majority of the overall issues and problems, perhaps you know some better than others but focusing on a tiny part of AI in general seems very close minded. The fact that so many people admit or say, "That isn't what I do..." or "I don't do simulations..." seems fairly close minded and silly. The first one reminds me of a quote from Office Space, "So what is it ya say ya DO here at Inatech?" If all you do is a tiny part of the whole who is doing the rest? Is the rest even being done? With the sorry state of how I see AI in games today I am doubting it. The second one, "I don't do simulations..". So how do you test anything? AI is one of the main things you HAVE to simulate to show what is done, its unpredictable if it is written correctly, how can you even think you will know what it will do? You have to test it to see and find out. Over all I do find the article well written and I compliment the author however what is described seems to be a community full of close minded individuals that are unwilling to learn a broader perspective of the issue they are all dealing with. This may be as I said as I am new to the community in general and have yet to attend a GDC sadly, though I will attempt to make the one next year.

Andrew on April 16th, 2008

Haha, Dave, you're the one doing it now, you're the catalyst for the outbursts and arguments :) I am not too sure of what the discussion actually...is...but certainly, making actors less then dummies is a virtue! Simulation is key to this, since it would model the real world much more closely. Then again, strictly one genre exemplifies the "dumb" aspect - the shoot 'em up, regularly a FPS (sometimes a TPS though). Funnily enough, add in RPG elements ala Deus Ex, and you do get better, longer-living, real-people opponents. So there are some counter examples to the "no one is trying" parts. RTS and other strategic games are getting much better too, adding personality on top of high and low strategy, especially in turn based games (like Civilization). Some FPS games do work too - Republic Commando has your squad able to perform 90% of the player's actions (either you, or your allies, can take position sniping for instance). There is, of course, no ladders or climbing involves however, and the enemy NPC's are pretty dumb :) In any case, typically the problem might be down to the NPC's vulnerabilities. They don't have Iron Bodies, and don't regenerate health. They can't retreat, since they can barely walk around, nevermind climb ladders or ropes, or even jump over obstacles. Sometimes they can't even duck behind cover, or lean out of cover (although the player can!). These basic problems mean, of course, even with more health, the standard NPC enemy in a shoot 'em up gains no benefit from being more a simulation of real life - since they can't simulate the basic actions any player can do! I think once there are more games which have high degrees of NPC movements and actions available, we'll have better opponents and allies. No more hordes - instead, enemies can retreat over barriers or up ladders, and have self-preservation as an intention as well as "gunning the player". Give them the capacity to do melee attacks, or to change weapons, and see them do things that previously only Unreal bots do, such as pick a weapon appropriate to the situation. Have them stage ambushes, because like a player, they can place down trip mines and take cover. Halo might taut it's NPC's own vehicle use - and so it should, since NPC's usually can't man things the PC can. Simulating the thoughts requires the actions to be available, and this is the main problem with it. You can, obviously, simulate in code a lot, but if there is no animation or art to complement it, most games will not add it in, since they want to retain picture perfectness (for instance; if there is no animation for the alien to get in a vehicle, no way the AI person will be able to add functionality to get the AI to drive said vehicle!). This is obviously a good way of doing things since for the player since it provides the needed action feedback, but it is highly limiting. Hopefully more games will expand animation sets to match up with many more NPC actions (especially if those animations can be used in third person, or in multiplayer for players), allowing the simulation that is wanted. With this, I fully expect that AI will improve and simulate more of real life as required, and hopefully we'll see better NPC's as a result.

alexjc on April 16th, 2008

[B]Ryan,[/B] There's certainly a history of "pragmatism" in the game development industry -- which is a euphemism for hacking away at a problem without really considering the big picture. However, my perspective is not as cynical as Dave's is in his article. I think the situation is getting a lot better, with developers increasingly coming from more academic backgrounds and being open to modern techniques. Also, you'll probably find the most open-minded and keen to learn individuals reading this blog and in the forums :-) As for the quote, I'm presuming it's either taken out of context, or there was a possible misunderstanding about its meaning. All games are simulations to some extent! So when it comes to bridging the gap, people might not realize they are doing it, but it happens every day. The question if there should be more open-ended emergent behaviors, however, is still up for debate. My take on the whole thing is that it just depends what kind of game you're building! But adding more Sim to FPS games is becoming increasingly popular with S.T.A.L.K.E.R. and Crysis -- among others. Alex

andreialex on April 16th, 2008

It's true, I should give some people a break :D and keep it a developer discussion. Sorry! The simulation problem is AI-complete anyway and the industry will probably stick to some efficient workaround that will do the trick, unless some magic brings the NeuronShader :)) and AI hardware mainstream. There is this hope I am holding on to, that the game industry can somehow boost the interest in AI research, at least related to various kinds of simulations, because the Weak AI (that concerns very specialized behavior) is extremely popular compared to the more general (simulation) AI. The ideas behind Google were there in "weak AI" academic research and uncountable many other systems are using the wealthy amount of work done in these almost divergent subfields (from fingerprint recognition to word sense disambiguation and expert systems). This is an outstanding body of work but it seems to be walking the path of automating very particular human behaviors, the same problem as that of developers reluctantly going into higher level AI and randomly using primitives. The gaming industry gives such a good reason to address the issue of Simulation in Game AI that I get outraged when the steps for making Game AI more mature are ignored. The wonderful thing is that some people are really taking these steps and the the Game AI stone age is clearly over, nobody can deny that, right? :)

tedv on April 17th, 2008

I think you bring up some really good points. Fundamentally the point we're all discovering is that writing good AI is extremely time consuming, and the only way to ship a good product is focus on the (relatively) more important parts. But as you hint at, all of it is important. From my work on Quake 3 AI, for example, I did delve a little deeper into the "motivation" for a players. In particular, the bots play to maximize their score (kills, minus the percent of deaths the leading player scores against you). So there's slight variations in play in that bots play more conservatively when they have fewer opponents, because the penalty for death is larger. But when it comes right down to it, a first person shooter is still just glorified chess played in real time. Your objective is to "win" according to the game's defined rules. Building convincing AI for characters you aren't supposed to kill is far harder than enemy combatants. In other words, it's harder to make a beggar than a dragon. I really liked your point about how the lifespan of many NPCs is too short to show real intelligence. As others have mentioned, this is in large part a way of minimizing the otherwise enormous problem of creating convincing characters. I remember that iD software used a lot of zombies in Doom 3 after all the effort that went into Quake 3: Arena, and they specifically stated it was due to lower expectations for the intelligence a zombie must exhibit to be convincing. We'll get there some day, but right now I feel like there's just a lot of programming "mileage" to do. Think of how much aviation changed in 100 years from the Wright brothers to today's jet engines and stealth bombers. Convincing AI is our jet engine. It's certainly possible, but I think it will take decades to get there.

andreialex on April 18th, 2008

@ Ted Vessenes So this is basically your answer to "Why Not More Simulation in Game AI?". The developers should wait decades for the sake of shipping "a good product [and] focus on the (relatively) more important parts"? A project manager is going to be very happy with your post, it is extremely politically correct, but what you are saying is that we should experiment with good AI for 100 years and then ask about implementing that into games. But for the love of cute (artificial) kittens, this is a real problem that is not going to be solved in the next 100 years if people just wait for it to be solved elsewhere and then apply it to games. The game industry is a world full of bright people that have made awesome visual simulations possible in less than 100 years, less then 30 I should say. So this is the perfect environment to make the great leaps along with the academia for the development of better (real) AI systems.

ChrisJRock on April 18th, 2008

One of the downsides to specialization is that the experts begin pursuing their field for the mere sake of their field. Well, AI isn't worth anything just for the sake of having it. There must be some objective, like simulation, for example. However, I think simulation is only one objective. "Everything we as AI programmers do should be based on the idea of simulating something." That kind of statement makes me uncomfortable. It's too sweeping and the "should" seems to make it an ethical issue when it really isn't. What's more, simulation is a fancy way of saying copying. You'll probably take inspiration from all kinds of outside sources, but why should you be limited to simulating things when you are capable of inventing brand new concepts? Well, one reason is that the job at hand might call for a simulation. But sometimes, it won't. Also, a true simulation of every aspect of your target will probably be impossible, so you are required to invent ways to fill the gaps anyway. I don't see anything wrong with knocking down the walls to those gaps while you're at it.

Dave Mark on April 18th, 2008

I would have to agree a little with Andrei's (somewhat animated) argument that the rate of change is far faster than "decades". Combine the progress of theoretical research with the logarithmic rate of change in processing power and the state of the industry is changing at a rediculous rate. One major holdup, however, is that development cycles and publisher expectations have not changed nearly as rapidly. I believe that reusable tools and even reusable behaviors will tend to streamline the more mundane aspects so as to allow us to focus on the cutting edge. For example, once people had A* down (along with all the automatic nav mesh generation tools), we didn't have to putz with pathfinding all that much anymore. The same will happen for a lot of other AI aspects. Thanks for dropping by, Ted. Make sure you read a number of the past columns!

If you'd like to add a comment or question on this page, simply log-in to the site. You can create an account from the sign-up page if necessary... It takes less than a minute!