Over the past 6 years since Valve released LEFT 4 DEAD, the concept of AI Directors has not only gained traction in the games industry but established itself as a best practice for building the highest quality gameplay. Coincidentally, it's the very topic of our AI & Game Design Workshop in Vienna on July 7th, so here are some of the lessons we've picked out.
There are increasingly many games using ideas from AI Directors, and many examples to study and learn from. Given our recent interview about SAINTS ROW with Aaron Canary (watch the replay here if you're a member), one of Volition's AI Programmers, it seems like an ideal addition to our fast-expanding collection of case studies. This article is broken down into the three main domains of any artificial intelligence: SENSE, PLAN and ACT — which applies equally well to AI Directors too.
The Saints Row series has included a notoriety system since its very first iteration. When you cause trouble in the game, your notoriety level escalates and the game throws law-enforcement units, S.W.A.T. teams, even the army to keep things under control. In Saints Row IV, the system evolved from a deterrent for the player's bad behavior into its own separate gameplay (and narrative) that the player can enjoy.
Figure 1: The open world combat system in Saints Row is called Notoriety. It's not only a core gameplay system but also has its own narrative arc.
1. SENSE: Player Monitoring
By definition, all AI Directors need to observe what the player is doing to adapt dynamically, otherwise they're just regular scripts! That's the "SENSE" part of the equation...
SAINTS ROW IV handles increases and reductions in notoriety by observing key actions the player can perform. These are monitored either from events dispatched from the game simulation (e.g. combat) or at the mission/script level (e.g. entering trigger areas). According to the Saints Row wiki, the following actions specifically increase notoriety:
- Killing civilians or enemy officers/soldiers.
- Failing or exiting certain "diversions" (e.g. Store Hacking).
- Entering certain restricted zones (e.g. Sierra Point).
Conversely, the game reduces notoriety also for performing specific meta-level actions in the game, such as exiting the Simulation or an activity. Notoriety also decreases over time, with a non-linear decay process that was carefully tweaked!
2. PLAN: Experience Planning
You can think of games with AI Directors as a combination of emergent gameplay with a scripted experience; the game provides the players freedom but is at the same time driving them towards a specific goal. That goal is the second part of the equation, the "PLANNING" component.
The experience defined for notoriety follows a fixed structure, which escalates over time and reaches a climax — assuming the player choses to pursue this. Of course, this experience is very specifically crafted by the game's designers, and in fact the climax was added as a natural resolution for notoriety in Saints Row IV.
“We really wanted to have the player beat Notoriety, as a Saint would. To do this we looked at having a dramatic arc, so you can climax and falloff, and have a victory condition that's satisfying as you completed something.
The problem was we didn't want to reward the player for slaughtering the police left and right... Surprisingly, we have morals. In Saints Row IV, we changed Notoriety to include Aliens, so it was perfectly acceptable to reward players for killing them!”
— Aaron Canary, GDC 2014.
For Saints Row IV, the entire spawning system was replaced and unified with a wave-based spawning system, in particular to address issues with difficulty spikes and afford the designers better control over the spawning of enemies. (In Saints Row: The Third, separate systems spawned their own waves alone did not coordinate.)
At each of the notoriety levels, different waves are spawned depending on which missions have already been completed. These waves include a selection of enemies, from the easiest to the hardest:
The implementation of this spawning is done in C++ gameplay code, using the current notoriety level to look-up one of multiple possible waves that should be spawned. All that's left, is to make sure these waves actually reach the player successfully...
3. ACT: Game Orchestration
The third part of the AI Director's equation is the "ACTING" component. In this case, making sure the AI Director's plan can be executed at runtime, for a fast-pace open-world game like Saints Row IV, is not a trivial task! As Aaron explains:
“Saints Row has always been a really fast pace game, and with IV we introduced super powers. So our typical response of spawning a car 100m away and have it drive to you was completely obsolete. We needed to find new ways to bring the action to the player almost instantaneously.
An additional problem was that players could simply jump over buildings, and exit all AI combat. AI had no ability to follow them or chase them over the top of buildings...
In practice, Saints Row IV uses a variety of creative solutions to be able to execute in-game:
- ALIEN PORTALS
- These "monster closets" can be spawned right in front of the player, and begin releasing enemies very quickly. Previous iterations of the game would rely on using roads, but the system in IV use the navigation mesh to determine good places to spawn these portals.
- Used as alternative to spawning new enemies, existing actors in the game can be "upgraded" from civilians or low-level enemies to more powerful aliens. This is done with a very obvious custom animation!
- DROP-IN FROM SKY
- Finally, the game can simply drop enemies in from the sky. Camera tricks are used to both focus the player's attention, also covering up discontinuities in the game.
In general, the techniques used by Saints Row IV will probably not work for any other game, but fit extremely well with the game's story. Aaron recommends you be creative when it comes to spawning, and we'd extend that advice to carrying your AI Director's intentions at runtime.
There are no miracle solutions for writing AI Directors, just many little tricks and techniques to borrow from other games, and new ones you'll need to invent for your own game. Saints Row IV's notoriety system is particularly effective at this; it's not about the technology but the sum of the decisions that make up a memorable experience.
If you're interested in these topic, and are curious about another dozen games using such patterns/principles, then we'd highly encourage you to attend our AI Design & Games workshop that will cover these topics in depth, ranging from player profiling to experience management, including orchestrating the components of the game together.
See you in Vienna on July 7th! (Find the workshop tickets here.)