Gamasutra: The Art & Business of Making Gamesspacer
View All     RSS
November 1, 2014
arrowPress Releases
November 1, 2014
PR Newswire
View All

If you enjoy reading this site, you might also want to check out these UBM Tech sites:

Opinion: An AI Curriculum
Opinion: An AI Curriculum
July 18, 2011 | By Max Dyckhoff

[Blizzard Engineer Max Dyckhoff shares "The Three Laws of AI" and his thoughts on other essential lessons we should be imparting on the future generations of budding AI engineers, in this #altdevblogaday-reprinted opinion piece.]

Game AI engineering is a hard to define subject. A group I am a part of had a recent discussion about what we should be teaching the future generations of budding AI engineers, and there were various propositions flying around for potential 'curriculums'. Ultimately there can be no 'right' solution, but here I will share with you my views on the subject.

90 Percent Of Game AI Is A*

Game AI researcher Luke Dicken recently wrote about the differences between game AI and traditional AI, and brought up this obvious point. There are many very neat algorithms that we use in AI, but A* is the big one. I should give a quick shout out to finite state machines and behavior trees, which have treated me well over the years I'll even concede that planners (like GOAP) have a place in game AI but A* is used by every pathfinding system I have ever seen, and has other applications besides that.

To say A* is 90 percent of Game AI though is like saying a house is 90 percent bricks. What's missing is the finesse. Creating interesting game AI is about identifying interesting problems to solve and coming up with novel ways to solve them. When I interview someone for an AI engineering position I don't ask about their understanding of existing techniques that's what Google is for I identify whether or not they have the desire to assess a situation and break down what needs to happen either to make the AI more fun or more intelligent.

Make It Fun

A lot of discussion about AI ignores this fact: The difference between academic AI and game AI is that we're trying to make a game fun. The intelligence exhibited by NPCs in most games is inferred by their actions to make the game fun for the player, not actually codified by some extremely intelligent system.

A colleague and I came up with a list of 'Three Laws of AI' a few years ago:
  1. Make it fun.
  2. Make it not stupid, so long as it doesn't break #1.
  3. Make mistakes, so long as it doesn't break #1 or #2.
Notice that intelligence is never actually mentioned here. Making an AI 'not stupid' is extremely important for a believable experience. You could have the best looking graphics engine, the best physics simulation, beautiful voice acting and writing, but the second an AI character grinds into a wall or shoots himself in the foot with a rocket the illusion is broken. Making mistakes is also important; humans are fallible and to enhance the realism of an AI they should be too.

So how do you make something fun? Well that's a loaded question. What is fun depends on the audience: it might be an immersive AI that makes you believe they are truly alien, or human, it might be an RTS AI that simulates the greatest Korean players, it might be a driving AI that rubber bands to keep you constantly fighting for first place, etc.

Play Games, and Be Good

Ultimately the best way to know how to make a game fun is to play other games, and identify what is or is not fun about them. It sounds simple, but in this day and age of zoning out in front of an Xbox for two hours playing the latest AAA hit, you frequently will ask someone why they found a game enjoyable and they'll reply 'err the graphics were good'. Of course that's not what makes a game fun; sorry graphics engineers. Sit down and play the same encounter fifty times, then tell me if you know why it's fun.

And actually you don't really have to be good, but it helps to understand what makes someone good at games. Writing AI you are trying to get into the mindset of the NPC, and it is imperative that you understand movement in space and what is a 'good' decision to make. In an FPS game if I am low on health I try to minimize the distance I need to travel to break line of sight with a target. I don't go for a specifically tagged piece of cover; I just try and get anything I can between me and my attacker.

Game AI engineering, in my admittedly biased view, is the single feature that makes a good game great. It's what makes the experience immersive, and makes you want to come back for more of the experience. To encourage new AI engineers we need to be careful what we are teaching them. It's not enough to know the algorithms, you have to gain an understanding.

[This piece was reprinted from #AltDevBlogADay, a shared blog initiative started by @mike_acton devoted to giving game developers of all disciplines a place to motivate each other to write regularly about their personal game development passions.]

Related Jobs

Twisted Pixel Games
Twisted Pixel Games — Austin, Texas, United States

Senior Graphics and Systems Engineer
Twisted Pixel Games
Twisted Pixel Games — Austin, Texas, United States

Mid-level Tools and Systems Engineer
Sega Networks Inc.
Sega Networks Inc. — Madison, Wisconsin, United States

Mobile Game Engineer
Forio — San Francisco, California, United States

Web Application Developer Team Lead


Dave Mark
profile image
For 2 additional commentaries on exactly this subject, see the (FREE!) "AI Rants" video from the most recent GDC AI Summit. Specifically, Brian Schwab posits "There Can Only Be Fun" and I follow with "AI Devs, Get Your Head Outta Your Code!" Both are amusing, insightful, and passionate.

(While the other rants in that session are good, if you just want the two mentioned above, find the bookmark "Brian Schwab" about halfway through.)

Luis Guimaraes
profile image
"90 Percent Of Game AI Is A*", "Game AI engineering, in my admittedly biased view, is the single feature that makes a good game great."

The A of AI, in my admittedly biased view, is Game Design, and it's a great part of everything. While the assertion is true depending on context, it's also not true. There's no single feature that makes a good game great, because a game is the sum of it's parts.


AI is as important as everything else. If AI is subpar, then a potentially great game fall to being just good, but the same is for everything else. About AI, everything said in the article is more than right.

Glenn Storm
profile image
If I may, I believe Max is referring to A* ("A-star"), as in this path finding tactic:

Which makes the "90%" statement a little more provocative imho, but it's an interesting take on game A.I.; which seems to be saying, "Don't get caught up in the illusion. As long as the agent gets from point A to point B, and doesn't break the illusion itself by being unreasonable, it's functional game A.I."

This perspective seems to appropriately cater to the needs of the game, not the ideal of A.I. But, I'd hasten to add that leaves _plenty_ of room to grow.

One example is the reality that game A.I. typically performs two base functions almost completely independently: going and doing. This is a practical take on getting an agent to play properly, but it does put the design/engineering team in a position of re-coordinating the two concepts, whereas actual intelligent beings are capable of much more nuance than typical game A.I. because these activities are not treated separately.

Kudos for the shout out to FSMs and Decision Trees. :) Neat topic, Max, and nice writeup.

Luke Dicken
profile image
Yes, the original assertion (I really wish I could remember who made it or where, since I often quote it...) was that 90% of Game AI comes down to the A-star algorithm. It was a few years ago now, and I said in the article that Max linked, I think things have changed in the intervening time to some extent, but I felt at the time it was quite an interesting thing to hear and it stuck with me.

Max Dyckhoff
profile image
Thanks for your reply, and yes I was referring to "A-star". The subject of "A* being 90% of game AI" is actually a many faceted one, and of course something of an exaggeration. A* is definitely used for things other than pathfinding, it's a great search algorithm which can be applied in lots of domains.

The less talked about fact is that pathfinding is actually extremely important to how an AI behaves. You can build a lot of intelligence into an AI through their path selection evaluators, getting them to avoid lines of fire, go near friends or cover, and so on. Perhaps I'll write a blog about that later. :)

And yes, Behaviour Trees were the meat of my work at Bungie for the last five years, I love them!

Luis Guimaraes
profile image
Great. Thank's Glenn.

What I read from the "90% A" was that the ultimate goal (apart from fun) was that the agents have to create the perception of intelligence, more than actually being. The perception is everything in design of games.

Now let's read the all important A* algorithm.

Rey Samonte
profile image
I've had the previledge of doing some AI design/implementation work this past year or two. I must say, I've enjoyed it quite a bit. It's definitely a challenge to simulate some type of behavior that will provide a challenge to the player. Most of my experience with AI has been with 2D games only but learning how to use and implement the A* algorithm was a great learning experience.

Great little article! I'll have to try to adopt those rules and think about ways in how to make NPC's just as fallible as humans. If there are any good books or articles to read you could recomment regarding AI design for games, I would love to hear of them.


Max Dyckhoff
profile image
Thanks! It was rather a stream of consciousness article. I will be writing many more (hopefully more well thought out) articles on AltDevBlogADay every two weeks, make sure to stop over and check them out.

As far as books go, I personally have very little luck with books for AI. They sometimes have interesting solutions or investigations of very specific situations, which I have never been able to apply to my own work. Honestly, just try stuff.

Rey Samonte
profile image
They are basic little rules but often times, programmers get caught up with the technical aspect of just getting things to work that we miss the finer details of allowing NPCs to make mistakes too...behaviorial mistakes that are intentional that is.

Yeah, a lot of times, the learning process has been strictly from trial and error. Not to mention, having enough time and resources to tinker. Most of the games we make here at work has us on a tight schedule so even minor polishing can be tight.

Kevin Dill
profile image
I have to confess, I've seen it before - and I just can't get behind this "90 Percent Of Game AI Is A*" thing. It's like saying "90% of Game AI is animation." In fact - the latter statement strikes me as much more true. In my 10+ years of game development (all of it as an AI engineer), I have implemented A* exactly once. It's just not that interesting a piece of the AI that I do.

Path planning is important, yes. But so are lots of things. And A* is just one small piece of path planning, really the easiest piece (building your terrain representation, path smoothing, and path following are all *much* harder), and not the one most likely to make your AI look stupid if you get it wrong (that would be... well any of those other three, but especially the terrain representation). But even that aside... one guy is going to write your path planner. He's going to do it early in the project, and then it'll just be a tool you use - much like the animation system. Nobody else will even know the details of how it works. These days, quite often you outsource it - lots of middleware path planners exist, and it's the one part of the AI where middleware is widely used (mostly because of those other hard parts, not because folks can't handle the A*).

In contrast, a modern game often has a very large AI team (Red Dead Redemption was over 5 full time engineers at one point). So... say 3-6 man months on A* (and that's extraordinarily conservative) vs. anywhere between 24 and 250 man months on the rest of the AI... doesn't look like 90% to me. :)

Max Dyckhoff
profile image
That's exactly what I was saying Kevin. A lot of the algorithmic stuff that you read about before starting a career in the AI industry is irrelevant, apart from A*. "To say A* is 90 percent of Game AI though is like saying a house is 90 percent bricks. What's missing is the finesse."

Ron Newcomb
profile image
Hi Max,

"90 Percent Of Game AI Is A*"

Maybe if 90% of the games you make are spatial navigation. My most popular post at Gamasutra is how walking kills interactive narrative:

And as a bonus round, I just posted an article about how to use a character's planning tree to generate dialogue:

So in regards to your overall post about what to teach budding AI programmers, I would say first familiarise themselves about a few more genres than FPS and RTS. I swear, 90% of my blog is about AI in interactive fiction where we have pathfinding built-in to the authoring tools, but it isn't all that useful. Because, *walking is not interesting.*

I don't mean to scream at you, and I agree that AI is more important to many game genres' success than it's credited for, but I find your (admittedly biased) opinion to be a bit myopic.