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 are 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 (Hordes), 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 until the Survivors leave this spot, effectively punishing them with a larger Mob. Unlike Wanderers, Mobs will immediately hunt down the Survivors upon spawning. It should be noted that Mobs can spawn inside safe rooms, so long as the door is open and no survivors are, or can see, inside.

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 is 0.

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. With the exception of Versus mode, Special Infected are prevented from spawning while the Tank is in play (a string for this exists, telling the Infected to wait for the Tank battle to end). However, if a Survivor(s) are very far from the Tank when it is alerted to their presence, the Director will remove this string to have Special Infected intercept the runners.

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.

In Finales, the Director summons Tanks after two hordes have been defeated. Once the second Tank is defeated and the rescue vehicle arrives, this string is removed and the Director will send both Tanks and hordes at the team, although it can occasionally glitch out where the Tank or neither Tank and horde arrives.

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 Director is still capable of changing items based on the team's performance; for example, if they are low on health, it may spawn health kits nearby at the pre-placed spawn points.

The sole exception is Pain Pills, where the Director will put them in first aid cabinets. The Director will change this to either Medkits (if survivors are on low health, but not in black and white) or Defibrillators if someone is about to die.

Several items are always static and will always be there, regardless of the team's performance. The Director cannot change the items. Such examples include the Silenced Submachine Gun when Survivors start The Hotel's Crescendo Event and the two Health Kits under the tent in The Park.

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 Crescendo Event, the Director may place an alarm on one of the two red cars at Liberty Mall's parking spot.

The Mall

 * The path to the Crescendo Event changes, leading to either a security door or the window of a toy store. However in versus the path will always default to the toy store to keep the match fair.
 * 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 play-testing 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 cemetery 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 recuperate 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 Crescendo 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.
 * Item placement is always the same for both teams. (e.g if a Laser Sight upgrade is found at the second to last house in The Milltown by the human team, upon teams being swapped those players will find it at the same house too)
 * 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 idle Infected to make room for incoming mobs; the same also appears when a Witch or Tank is nearby. Be on guard if you do not see a lot of idle Infected.
 * However, this acts as a double-edged sword for the Director as well; since mobs spawn in the closest spot when it spawned the horde, their spawn points will be around the area the lead player was at the time. Passing through that area quickly results in less Infected to deal with along the main path due to the capacity the Director can hold, but they may counter it by spawning Special Infected along the path.
 * If two or more players have low health, expect the Director to be more generous on healing items. This can be manipulated into the Director spawning many health kits (e.g the Bridge's saferoom, where the Director can spawn anywhere from 4-10 Health Kits inside).

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 re-spawn.


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


 * director_stop/director_start - Turn the Director off or on.