AI 101: Managing the Experience with Director AI
How we use AI systems to govern the mood and flow of a game.
AI and Games is made possible thanks to our paying supporters on Substack . Support the show to have your name in video credits, contribute to future episode topics, watch content in early access, and receive exclusive supporters-only content on Substack.
If you'd like to work with us on your own games projects, please check out our consulting services provided at AI and Games. To sponsor our content, please visit our dedicated sponsorship page.
One of the most demanding aspects of creating large, complex games that have expansive environments and various types of friendly and enemy characters, we need something to help handle that experience for players. Quite often games employ numerous background systems to help maintain the ambience, be it to change the background audio, trigger in-world events, spawn enemies to fight against or give the player a break after completing an immense task. And one of these systems is what is commonly known as a Director - a term popularised by Turtle Rock and Valve's Left 4 Dead series, in which an AI system maintains the difficulty and pace of the game, deciding when and where to create new enemies and decides not only if players deserve a break but will deliberately target players who don't abide by the rules of the game.
So let's explore what Directors are, how they're used in a variety of modern games and take a closer at the system used in the Left 4 Dead series.
Follow AI and Games on: BlueSky | YouTube | LinkedIn | TikTok
What is a Director?
So let's start by discussing what a Director system is. The name is derived from the likes of film, television and theatre, where a performance is being put on display for the audience. Their job is to ensure that the performance runs as intended, giving direction to all actors and related personnel such that the desired outcome arises when the camera is running or the curtain has lifted. But unlike a theatrical production or a film set, in video games the audience is also an active participant in the production, and impacting the story as it happens. Hence the directors system in a game needs to be a lot more dynamic: responding to what the player is doing and then re-shaping the game world around them so that it continues to feel fresh and novel.
This is all largely an antithesis to more tightly scripted and procedural gameplay, where you cross an invisible line in the game - often a trigger volume - that then results in something happening. This can be a cutscene or something in-game that is entirely pre-programmed such that you always experience it the same way each time. Think of most Call of Duty campaigns, where this is a typical approach. By injecting a director, it helps provide a sense of novelty, and in-turn longevity for a game when it's in the hands of players, even if they begin to figure out what it's going to do and when.
So a director is for all intents and purposes any system in a game that makes decisions on in-game settings or behaviours that impact pacing and difficulty and is influenced by what players are doing in either a single or multiplayer context. Now this isn't necessarily an AI system, although you tend to find there is some simple AI formulation in many cases given it's making some for of intelligent decisions. Ultimately, it boils down to a fairly straight forward process:
The system records information about the players current activity.
This could include where they are in the world, what activities they are currently doing and how well they're doing it.
The system then makes changes to the game to impact the player’s experience. This can include things like a temporary increase in difficulty, or a dynamic event in the world that perhaps has not occurred for a while. Conversely, it could actually do the opposite and give the player some respite, allowing for you to catch your breath, take a moment to re-assess the situation and what you want to achieve.
Lastly, it's checking whether the player is playing the game as it is intended.
Quite often a director is useful for creating situations that ensure the player adheres to what the designer intended. As we'll see in a moment, Left 4 Dead is a fantastic example of this, given the director deliberately targets players who fail to adhere to the rules that the game communicates to you.
How is a Director Used?
So given we've covered the basics, how are they built and what purpose do they serve across different titles. What's important to acknowledge is that a Director is more a philosophy of game design than any sort of methodology or technology for that matter. There is no definition on how a director should work. Instead it's simply a term given to systems that reflect the design principles I've already discussed.
So we'll start by explaining how Left 4 Dead's director works, but after that, we'll also briefly look at games that have since applied a similar principle and why it proves useful to them.
Left 4 Dead
Left 4 Dead is an interesting example in that everything you need to know about how the game works is communicated in the opening video. Players need to stick together, try to navigate the space without causing a ruckus, and support one another when things go wrong as special infected like boomers or hunters attack, while hordes of zombies appear in force.
Now the directors job is ensuring that players respect and follow those rules. It does this in various ways:
Spawning individual zombies into the game world.
Setting spawn locations for mobs, where numerous zombies rush out at once.
Placing special infected in the world
Gradually increasing and reducing the intensity of the game based on its internal clock
Reinforcing the tension and drama of four people trapped in the zombie apocalypse by explicitly targeting players that don't obey the rules.
So, wind back for a second and if we look at the directors behaviour more abstractly, it's essentially a finite state machine.
Now this finite state machine operates in three states:
The build-up, where the game is trying to challenge players ability. In this state, the director is maintaining a reference to the maximum number of zombies it can have, respawning enemies after they're mowed down on a timer. As well as introducing mobs that appear from outside of the players line of sight and of course, the special infected such as Hunters, Smokers, Boomers etc. The whole time, the game is measuring how intense the game is becoming for each player and prioritising not just those with the lower stress values, but also players that are farther away from the pack, given they're not in-line with the directors expectations for how someone plays the game.
Next up, there's the peak. This is where the system recognises it has reached a level of perceived 'stress' across all players - having thrown everything and the kitchen sink at you and will cease spawning more zombies into the game world. The music changes accordingly, and the game gives you a real run for your money.
And lastly, the relax phase. This is your period of respite. The game will either ensure no zombies spawn or in the case of Left 4 Dead 2, less zombies than usual. This only lasts for a short period of 30-45 seconds, at which point it will restart the process back at the build-up. However, the rate of the build-up can be influenced by how the player progresses through the map. Notably the speed at which you're moving through it. Hence if you reach a relax phase and immediately start sprinting across the map, the game will restart in build-up much faster than usual and the rate with which enemies are spawned will increase as well.
Ultimately, the Left 4 Dead director is responsible for managing how many zombies are in the game at once so it stays performant, but does so in a way that builds this rollercoaster of player experience. However with each pass the intensity and length of the cycle will vary. And as stated, it relies on the perceived stress of the player, which is calculated based on the rate at which enemies are being killed at close range. So if zombies are being picked off from a far, then the stress levels are quite low. However, if you're taking damage, using close range fire or even melee attacks to kill them zombies then your stress value will be increasing.
All of this is actually visible for those who play Left 4 Dead on PC, with the developer debug modes being a feature you can turn on when playing in single player. You can see the stages of the director, the spawn rates of the zombies, the stress levels of each character and more. You can even manipulate parts of the directors behaviour and trigger specific actions that it would usually do.
Now this is but a quick overview of how Left 4 Dead's director works, but way back in episode 7 of AI and Games, I dedicated an entire episode to it. So go and check out that video to found out even more details.
Directors in Open-World Games
While Left 4 Dead is a fixed and relatively linear experience, the one area they're arguably used the most is in large open-world games. One of the reasons for this is the scale of the environment. Open-world games require the game engine to constantly load in assets for regions of the map as players visit them, while also unloading assets that are longer being used. This is really important for non-player characters, given it's a waste of CPU and memory to have a character that is five miles away standing around and not doing anything important. Hence most-open world games have a director of some sort to ensure ensure AI characters are spawning in the world, but also de-spawn if they're too far away from the action.
One of the most well-known examples is the Far Cry franchise, where the director has became increasingly more complex over time. Its primary function is ensuring characters are added and removed to the world, given that no characters in the world exist outside of a roughly 250m radius of the player. Plus it introduces vehicle patrols, wildlife such as tigers and bears, as well as more focussed elements such as enemy checkpoints or unlocked outposts being attacked.
Meanwhile games such as Watch Dogs 2 have a system that spawns in non-player characters based on personality profiles, while also paying close attention to where the player is in the world. Hence you find college students near the Stanford campus, tech bros over in Silicon Valley and tourists when you're down on the Embarcadero.
Similarly, CD Project Red's The Witcher 3: Wild Hunt has a similar process known as Spawn Tree's. This isn't more than a simple director system, given it's a larger gameplay system that is integrated not just into the open-world, but is synced into all of the systemic gameplay and mission systems. This helps the game to spawn in non-player characters - be they friend or foe - that fit the context of where Geralt is in the world and can is highly customisable so that it can adapt and shift to specific designer needs.
There are numerous permutations of director AI in open world games, with varying depth and complexity in each instance. What is interesting however, is that these systems are now beginning to evolve, with the the likes of Assassin's Creed Origins introducing a process known as virtualisation, where some NPCs - even when they're not visible in the world - continue to update their logic and make decisions about what they're doing and where they're going instead of being outright deleted. More critically, they also remember their interactions with the player, such that if you meet them again later, you they how things went down previously and that influences future behaviour.
Payday 2
In Payday 2, the director revolves around the risk level: the difficulty setting applied to a particular mission. There are nine different risk levels ranging from ‘Easy’ all the way up to ‘Death Sentence’. The risk level influences your mission requirements, the types of safes and security deployed with the level. But while it can change the mission you're about to run, it has a much larger impact on how law enforcement attempt to bring you down. Your risk level will influence not just how effective law enforcement is in combat, but the number of assault waves, the frequency with which they spawn in, what enemy types spawn and where they spawn in the map.
Rocksmith
Yeah that's right, here's one you probably didn't expect: Rocksmith - the music game developed by Ubisoft San Francisco and first released in 2011, helps players learn the guitar tracks for a variety of songs. However, in the updated edition released in 2014, Rocksmith introduced Session Mode: where instead of playing along to an existing song, you can jam and play your own tunes. However, the director pays attention to what you're playing and uses that to inform the AI musicians in the session, be it the drummer or the bass player what pace to play it, the intensity as well as what notes and scales to play that would better compliment the music you're playing.
Alien Isolation
As I have explained in my previous analysis of the game, while the xenomorph has a behaviour tree that enables it to respond to sensory inputs, hunt the player and attack them when spotted, there is also a director system that is tasked with giving the alien locations to visit. Hence it will not only encourage the alien to continue to move around the map so that the player can proceed with their mission, but it will also re-direct the alien back to the player periodically in the event they have escaped it for too long. All of this ensures that the alien doesn't overwhelms the player, keeping them trapped in a locker for 8 hours... though I understand why you may well still do that.
Closing
Director AI is not a precise technological process, but rather a philosophy for how a gameplay system can make intelligent decisions that influence a players experience. As we've seen throughout this video, the range of titles they're used in is fairly broad and the purposes for which they're adopted can vary even between similar games. But critically, it's all about keeping the player at the heart of gameplay and ensuring that you are experiencing the game in the way that designers intended and hopefully having some fun as well while you're at it!