Watching Level Designers Use Scripts to Disable Your Autonomous AI: Priceless

Alex J. Champandard on January 4, 2008

You’ve been building an autonomous AI to improve the gameplay on your next-gen title and everything is finally falling into place:

  • Bachelor’s degree and master’s research in AI, 4 years.

  • Two AAA titles of experience (plus prototypes), 5 years.

  • Revamping of the AI architecture with new features, 2 years.

  • Watching designers disable the AI with scripts, timeless!

“There are certain things in games that autonomous AI can’t handle, for everything else, there’s a level designer!”

Jokes aside, this problem is a common source of frustration for players and developers alike. This article looks into how AI is used in practice, including the problems that can occur. In particular, I’ll take the example from modern shooters and show how these kinds of problems can be resolved in practice.

Screenshot 1: Viewing the design of a level top-down in Halo 2.

Artificial Stupidity and How to Achieve It

A recent blog post by game programming veteran Nick Mascall (profile) kicked off a discussion about the use of scripting in Halo 3. He starts off describing a typical example from the game where the scripted behavior of an invulnerable marine plays an important role in the story while ignoring everything else.

Nick then discusses the divide between autonomous behaviors and scripting:

“What’s the difference between a good and a bad NPC AI? A good AI appears intelligent because it adapts to the player’s behavior and the situation in general. An NPC which fails to do this appears stupid, frustrating the player and undercutting the player’s immersion in the game world. […] Halo 3’s marines generally do a fair job of simulating intelligent behavior and cooperating with the player. Why, then, would any competent game-developer subvert this behavior for no significant gain?”

With a little jump in the argument, he attributes these in-game problems to an opposition between design and code:

“The cultural division in question is the one between programmers and artists. […] Adaptive AI behavior is created by software engineering, the province of programmers. […] To these artists, it’s an article of faith that creativity is their exclusive province, and any product or process of engineering is inevitably inferior to what they can produce. This conviction drives them to over-ride AI systems with scripting where it’s neither appropriate nor necessary, and subvert the established rules of the game world on a whim. Gameplay and immersion are routinely sacrificed to their bad judgement, arrogance, vanity and insecurity.”

Although he raises some great points, I personally don’t agree with Nick’s explanation based on conflict-ridden development teams. The rest of this article analyze the problem in more depth — for the sake of presenting a balanced picture if nothing else!

Screenshot 2: Finding the tradeoff between scripting and autonomous AI.

Who’s At Fault Here?

The industry has changed a lot in the last few years, and here are some (opposing) trends that I’ve noticed instead:

  1. Building autonomous behaviors is no longer just an engineering task. It takes multi-disciplinary teams of 2 or more people, including programmers who implement the AI algorithms, designers who create and edit the behaviors as data, etc.

  2. Experienced level designers are perfectly aware of the need for autonomous behaviors. Other level designers will just use whatever tools they have at their disposal to create the experiences they want…

So, if most level designers are aware of the tradeoff they make when crippling the AI, then why do we still see scripted sequences? What’s the underlying problem?

Symptoms and Real Causes

The mere symptom of the problem is that level designers override the default behavior when scripting by:

  • Shutting down senses to prevent information from reaching the AI.

  • Disabling actuators to prevent the behaviors from doing certain things.

The real cause of the problem isn’t the designer’s perfectionism or the need to do things themselves. It’s usually one of two things:

  1. Either the AI doesn’t provide way to combine autonomous behaviors with specific orders (i.e. it doesn’t provide a way to handle multiple goals).

  2. Or the AI does not provide a sensible way to specify how multiple behaviors should coordinate together (i.e. it can’t easily prioritize dynamically).

In practice, when you’re under the pressure to script a level that’s already built and the AI system doesn’t follow the orders you give it, then the only option is to shut it down. (The game’s story most often gets priority over the believability of the behaviors.) But what’s the solution?

Screenshot 3: A scripted explosion sequence in Halo 3.

The Easy Way

Incoherences with certain scripts can easily be fixed with other scripts!”

If you’re going to script part of your simulation explicitly, you need to lock down everything else that could possibly look stupid or unbelievable with scripts too. That includes scripting the behaviors of other actors, whether they’re opponents or allies, as well as potentially overriding the gameplay or changing story presentation itself.

The original problem in Halo 3 could be fixed rather easily given a little polish to that particular situation — either a level restructuring or reorganizing the story elements. Miguel Chavez points out this solution in the first reply to Nick’s post.

But obviously this approach takes a lot of time from the level designer! Luckily, there’s another solution…

The Hard Solution

The alternative is to build an AI that’s capable of taking multiple goals, for example orders from the level designers and the desire for survival from an autonomous AI. Once the AI can do that, and the level designers tweak the results by prioritizing goals, then they’ll never need to shut down the sensory system or override behaviors.

The fact that they had to do that in Halo 3 suggests that the AI system is still not quite there yet. As a matter of fact, no AI system I know of in industry could handle such scenarios perfectly yet. There are two big things to think about:

  • Goal directed behaviors that use a form of planning to work out the correct actions to execute. (See part 2 of my GDC talk about behavior trees to see how Halo 3 could do that better.)

  • Concurrent handling of behaviors using forms of synchronization and prioritizing. (Watch part 3 of my lecture about Next-Gen Behavior Trees for more details on this also.)

Certainly, the rise of goal-driven planners in industry (since F.E.A.R.) helps tremendously, but there’s a long way to go! Be sure to subscribe if you want to learn more about this.


The original podcast from that sparked the whole debate:

Podcast 1: Anger, Sadness and Envy Episode 4: The Storm

An analysis of the AI in the Halo games:

How do you feel about the integration of scripts with autonomous AI?

Discussion 1 Comments

blog on January 5th, 2008

[quote]You've been building an autonomous AI to improve the gameplay on your next-gen title and everything is finally falling into place: Bachelor's degree and master's research in AI, 4 years. Two AAA titles of experience (plus prototypes)[/quote] Read the [url=]full article[/url] on the blog.

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!