The Director

The Director, sometimes referred to as the AI Director, or simply as AID is the artificial intelligence of Left 4 Dead that features a dynamic system for game dramatics, pacing, and difficulty.

Instead of set spawn points for enemies, the Director places enemies in varying positions and numbers based upon each player's current situation, status, skill, and location, creating a new experience for each play-through. The Director also creates mood and tension with emotional cues such as visual effects, dynamic music and character communication. Moreover, the Director is responsible for spawning additional health, ammo, weapons, and Special Infected, like the Witch or the Tank.

It should be noted that there is another Director in the game, which controls the music on a per-player scale, called the Music Director. This article will only deal with the main one, the Director in charge of spawning enemies and items.

Enemy spawning
The Director's most immediately obvious influence is of the spawning and managing of Infected. In general, the Infected are spawned out of sight from the Survivors, and de-spawned after the Survivors move out of range (although there are exceptions). The Director categorizes enemies as Wanderers, Mobs, Specials, and Bosses.

Common Infected
The Director divides Commons into two types - Wanderers and Mobs. Wanderers are spawned in front of the Survivors, with the highest concentration being on the main path, but with decent amounts placed in side routes and in unreachable locations (known as background wanderers). These Commons will "wander" (as per the name), and will attack upon noticing the Survivors.

Mobs, on the other hand, are usually spawned to the side or behind the Survivors. Mobs consist of 10 - 30 Commons, and generally spawn in intervals of 1-4 minutes (varying with difficulty). In certain instances the Director will be unable to find a suitable spot to spawn a Mob, granting the Survivors momentary reprieve from the Horde. However, the Director will continue to "queue" Mob infected untill the Survivors leave this spot, effectively punishing them with a larger Mob. Unlike Wanderers, Mobs will immediately hunt down the Survivors upon spawning.

A maximum of 30 Commons can be spawned by the Director at any one time. A higher amount of Commons may exist on the map, but the Director will not spawn any more until their number drops below this amount.

Special Infected
Special Infected (or SI) are spawned in random locations near the Survivors. Each kind of SI has its own spawn timer, at about 45 seconds with a random delay at the start of the map. Normally, a maximum of 3 Specials are allowed at once (4 in Versus, controlled by players), and only one of each type. However, certain maps will change this rule (see below).

In Campaign mode, the Director will kill off any Special Infected that are too far from the Survivors. This can be seen by turning on Full Captions. Specials can spawn inside the ending Safe Room, effectively locking them inside until the Survivors open the door.

Boss Infected
Witch and Tank spawns are handled very differently by the Director. Throughout each map there are a select number of "Threat" locations - spots where the Director will spawn a Tank or a Witch. These Threat spots are normally on the main path, and are always the same - no matter how many times you go through a map, Tanks and Witches can only spawn in these areas.

Tanks will turn hostile immediately upon making line of sight with a Survivor. This can become problematic for the Tank if the map is particularly maze-like and/or loops back on itself. The Director will also turn the Tank hostile if the Survivors manage to get past it unnoticed. Special Infected are prevented from spawning while the Tank is in play (only in Co-op, but a string for this exists telling the Infected to wait for the Tank battle to end).

Sometimes, even in normal difficulty, the Director can be infamously "sadistic" as it can spawn a tank after activating a Crescendo Event or when the Survivors have reached an area in which they cannot retreat easily (e.g. falling down into the sewers)

In Versus mode, the Director imposes a "Flow Limit" upon Bosses, stopping them from spawning too close to one another or to the Safe Zones / Checkpoints. This limit is not used in Co-op and can result in a Tank and Witch spawning together, and/or inside a Safe Room.

Events and Finales
Many map events will change the rules of Infected spawning, especially Finales. They can change the limit and rate of Special spawning (e.g. the Dead Center Finale), the rate and size of Mob spawns (e.g. the Dark Carnival 4 onslaught) and even force Boss Infected to spawn (e.g. the numerous Tanks in the Sacrifice Finale).

Item Spawning
Upon loading a map, the Director immediately populates it with items by selecting a limited number of pre-placed spawn points. In reality, the Director has very little control over where items will spawn, mostly limiting the number of similar items spawning close to each other.

The sole exceptions is Pain Pills, which the Director can swap into Medkits if the survivors are doing badly, and into Defibrillators and Adrenaline Shots (Left 4 Dead 2 only) if the Survivors are critical.

Dynamic Maps
A feature only implemented in Left 4 Dead 2, dynamic map design allows the Director to measure how well the Survivors are doing, and change the map accordingly. These changes can include small path tweaks, object and item spawns, weather patterns, even re-pathing of entire events. Here are a few examples:

The Hotel

 * Logic exists in the map files that indicates the elevator was going to have multiple stops, one of which would be chosen by the Director. However, it appears this idea was scrapped.

The Streets

 * After the event, the Director will turn on some car alarms if the Survivors do particularly well.

The Mall

 * The path to the Crescendo Event changes, leading to either a security door or the window of a toy store.
 * The event itself is subject to numerous path changes depending on the Survivor's skill.

The Barns

 * At the beginning of the level, the Director may spawn a fence along the main path.

Mill Escape

 * Torrential rain will occur randomly through the map, obscuring vision and muffling the voices of other Survivors. Mobs will often spawn during this time.

The Park

 * According to Developer Commentary, the park area was originally going to have dynamic pathing. However, through playtesting it was discovered that players found it more enjoyable to simply have the whole area open to them.

The Cemetery
Any and all dynamic map changes are kept the same for both teams when playing Versus mode.
 * Many of the graves in the cemetary are dynamic, forcing the Survivors to take longer routes if they are doing well.

Director Phases
While playing through a map, the Director goes through a number of "phases", relating to the state of the Survivors. This adds an ebb-and-flow dynamic to the game, allowing the Survivors to recover after a nasty incident, or meet heavy resistance when rapidly progressing through a map. Experienced players will be able to predict the current Director phase, and act accordingly.

Build Up
Upon leaving the safe zone, the Director enters Build Up mode. In this mode, Commons and Specials will spawn normally, and Mobs will appear regularly.

Peak
The Director reaches "Peak" when the Survivors are at maximum Intensity (see below). It usually occurs at the peak of combat. Infected normally stop spawning at this point.

Relax
During Relax phase, Survivors may rest and recouperate after passing through Peak phase. No Wanderers, Mobs or Specials will spawn. In Left 4 Dead 2, a feature is introduced where Wanderers may still spawn during Relax mode - the harder the difficulty, the quicker they will start spawning again.

Relax normally lasts about 30-45 seconds, but will finish quicker if the Survivors start moving again. After Relax mode has finished, the director returns to Build Up mode.

Survivor Intensity
The Director constantly measures how much pressure each individual Survivor is under by monitoring their Intensity. A Survivor's Intensity increases when attacked by an Infected, and by killing Infected that are close by. Survivors will immediately reach maximum Intensity when incapacitated. Survivors will not gain intensity through friendly fire, or when sniping distant Infected.

Quieting the Director
In certain instances, the Director, for all intents and purposes, is turned off. During this time no Common or Special Infected may spawn, although their timer still counts down, allowing them to instantly spawn when the Director returns to normal.

Normally this only occurs in Crecendo Events and Finales. Before the Survivors start the event, so long as they are all in the event area, the Director will wait until the event finishes before returning to regular spawning. The Director also returns to regular spawning if a Survivor leaves the area before starting the event.

Difficulty and Game Modes
Infected get stronger, smarter and more resistant as the difficulty increases. Some of the Director's functions also change with the difficulty. The following functions increase with the difficulty:
 * The speed at which Commons appear during Relax mode.
 * The rate of Mob spawns.

​Versus Mode
In Versus Mode, certain variables are changed to make sure the game is balanced for Infected players, as well as when the teams are swapped over:
 * Tanks and Witches spawn in similar spots for both teams.
 * Any dynamic paths are kept the same when teams swap.
 * Bosses have a chance of spawning in Intro and Finale maps, where they normally don't in Co-op mode.

Reading the AI Director
With a bit of practice, it is possible to anticipate moves by the Director;
 * Listen out for music cues. The AI Director works in conjunction with the Music Director. Each campaign has unique tones for Build Up and Relax modes, as well as Incoming Attacks / Mob spawns.
 * After a particularly nasty attack, you can expect the Director to take it easy for a while. Use this to your advantage to heal up.
 * The Director sometimes de-spawns Wanderers in order to make room for incoming Mobs. If you don't see many Wanderers, be on your guard.

Console Commands
A number of console commands exist that allow the observation and editing of the Director's functions. Most of these are protected by sv_cheats and thus cannot be used in regular play. Note - the developer console can only be used with the PC version of the game.

Debug commands

 * director_debug​ - Set to 1 for a monitor of the Director's current thought process.
 * director_debug_scavenge_items - Indicates the location of all possible item spawns, and which ones the Director has chosen for this particular run.
 * z_debug - Shows the location and status of all Infected, as well as a preview of the Navigation Mesh, which indicates Threat zones and places where Wanderers and Mobs cannot spawn.
 * z_show_flow_delta - Set to 1 or 2 for an indicator of the general "flow" of the map, which the Director uses to determine where to spawn Infected.

Cheat commands

 * z_common_limit - Change the maximum number of Common allowed in a map at any one time.


 * director_special_respawn_interval  - The time it takes for Specials to respawn.


 * director_tank_bypass_max_flow_travel - The Director will alert the Tank if the Survivors get this far past him.