Hi I'm Tommy Thompson and welcome to AI 101: the series that explores artificial intelligence
tools and techniques used in video game development.
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 in this episode, 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.
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.
Crevates, mood swings, bitching about Netflix and obnoxious coffee orders aside, a directors
job is to ensure that the performance runs as intended, giving direction to all actors
of what their job is and then leave them to achieve it when the camera is running or the
curtain has lifted. But unlike a theatrical production or a film set, in video games there
is not only a lot less cocaine but also 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 - often scientifically referred to as 'every Call of Duty game every
made'. 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. 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 considers what the players should be experiencing at this point in time,
such as a temporary increase in difficulty, a dynamic event in the world that perhaps
has not occurred for a while, as well as what elements it can change or create right now
to inject some new activity for the player to experience. 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 player 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.
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.
[Geez, it's a philosophy, a methodology but no a technology, trying saying that three
times fast]
But unlike say navigation meshes, finite state machines, behaviour trees or planning - all
of which we've already covered on AI 101 - 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 is an interesting game in that everything you need to know about how it 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 lickers and hunters attack or hordes of zombies appear in force. Now the
directors job, is ensuring that players respect and follow those rules: by placing special
infected in the world, setting spawn locations for mobs, gradually increasing and reducing
the intensity of the game based on its internal clock and - more critically - 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 - which we covered back in episode 3 of AI 101 when
looking at the AI of Half-Life. 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 constantly maintaining a reference to the maximum number of zombies it can have,
respawning enemies after they're mowed down. 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
last 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. I'll leave instructions on how to configure
it in the video description.
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.
But for now, let's take a look at some other games that have used similar director style
approaches and how they're adopted to enhance the player experience.
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 arrogant douche mongers 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 actually 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 more recent entries in the Assassin's Creed franchise - Ori gins
and Odyssey - 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.
However, outside of these larger open world games, there are other games that use some
form of Director AI. One notable example is 2013's Payday 2 by Overkill.
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.
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.
And wrapping up, arguably the most famous example on this channel - surpassing even
that of Left 4 Dead - is Alien Isolation...
*RING THE BELL LADS HE'S TALKING ABOUT ALIEN ISOLATION AGAIN*
As has already been explained in great detail on this channel, 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.
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!
Thanks for watching this episode of AI 101. I hope you enjoyed finding out a bit more
about Director AI - and you may well have learned a thing or two a long way. Don't forget
you can go back and watch the actual episode of AI and Games dedicated to Left 4 Dead but
also Far Cry 4's director was covered in episode 16 and of course Alien Isolation has popped
up twice in episodes 15 and 50. Plus there were some games we've never seen before on
AI and Games in this video, let me know if some of these sound interesting, given we
could try and visit them in more detail in the future. AI 101 and all my other series
here on AI and Games are crowdfunded over on Patreon - and this episode was selected
by my supporters as one they wanted to see - with a special shout-out to patron Joey
Keilholz. If you want to join our community and have a say in future episodes on the show,
join the AI and Games patreon using the links on screen and in the description. Stay safe,
have fun and I'll be back!