L4D Level Design/Nav Meshes
- Getting Started
- Your First L4D Level
- Ladders
- Visibility
- Nav Meshes
- Checkpoints
- Checkpoint Rooms
- Outdoor Levels
- Level Organization
- Level Standards
- Clip Brushes
- Elevators
- Panic Events
- Breakable Walls
- Finale Events Part 1
- Finale Events Part 2
- Finale Events Part 3
- Additional Finale Components
- Nav Flow
- Advanced Nav Editing
- Versus Maps
Contents[hide] |
[edit] Your First Nav Mesh
In Hammer, open your first map file "tutorial01.vmf"
Go to File > Save As and rename it to "tutorial04.vmf"
Press F9 and click on the OK Button to compile it.
[edit] Getting Started
When the level loads, bring down your console (`) and use "director_stop" and press the Enter Key. Then, use "nb_delete_all" and press the Enter Key. Hide the console (`).
You will see an error message appear.
Click on CONTINUE to close the message.
You will notice that you are outside of your level – probably below the first room you created.
Bring down your console (`) and type "noclip" and press the Enter Key. Then hide the console (`).
Look up at the first room and move there with your move forward key. Once you're inside the first room, you can type "noclip" again in your console to turn off noclip. You should be standing in the first room you made.
Bring down the console and this time type "nav_edit 1" and press Enter.
[edit] Generating a New Nav Mesh
Hide the console and look at the floor in the middle of the hallway between the two rooms.
Bring down the console and type "nav_mark_walkable" and press Enter.
When you hide your console you should see a pyramid-like shape where you are pointing.
You have just placed a nav generation marker called a "nav_mark_walkable".
Bring down your console again and type "nav_generate_incremental" and press Enter.
This will generate a nav areas around the nav_mark_walkable and it should generate throughout your level.

Nav_generate_incremental automatically saves the nav mesh when it is run. If you want to save manually, use "nav_save" from the console.
[edit] Nav Area Selection
First of all, when nav_generate_incremental is run, all of the new nav areas it creates stay selected. This comes in handy if you make a mistake and want to run the generation again. You can just type "nav_delete" in the console to delete all nav areas that are selected. To deselect them, type "nav_clear_selected_set".
To select a nav area, point at the area with your cursor and type "nav_toggle_in_selected_set"
This will select the nav area you are pointing at.
[edit] The Nav Config File
As you can tell, editing the nav uses all console commands. The most effective way to edit, instead of typing a console command each time, is to bind hot keys to these commands.
A cfg file has been enclosed that might make it easier to start with. Place "nav.cfg" in your left4dead\cfg directory.
Bring down your console and type "exec nav" and press Enter.
To bind your own keys, bring down your console and type:
bind [key] "[console command]"
For example, if you want to bind the z key to "nav_toggle_in_selected_set", type this in your console:
bind z "nav_toggle_in_selected_set"
To save your config, bring down your console and type:
host_writeconfig [name of config]
[edit] Splitting Nav Areas
You will also notice that the nav in your level currently has large areas that cover the entire room. Sometimes, it's necessary to split those large areas into smaller ones. For example, if you want to add an attribute like where the survivors start and you want the area to be right in front of the weapons table.
You can split up nav areas by using "nav_split".
First, bind a key to "nav_split". In the included nav.cfg file, nav_split is bound to the "v" key.
As you point at the nav areas, you will see a white line that moves either North/South or East/West with your cursor. Position the cursor so that a line draws to the right of the weapon table in the first room you created.
This line shows where the split will happen if you use nav_split.
Press your bound key to see the result.
Now, position the cursor so that the new area you just split in front of the weapon table is split in half in the other direction.
Press your nav_split bound key to see the result.
[edit] Adding Attributes
Nav areas may contain attributes that designate specific purposes. For example, a nav area marked with the attribute "EMPTY" means that a common infected cannot spawn on it. Let's say that you have a kitchen with a counter in it, and you don't want infected to be standing on the counter top when the player gets there because it looks weird. You can mark this area as "EMPTY".
First, type "z_debug 1" to allow the attributes to be viewed.
In our first nav mesh that we're creating, we need to designate where the Survivors are going to start when they appear in the map. Let's mark the area in front of the weapon table that we just split as "PLAYER_START"
Point your cursor at the area in front of the weapon table and use "nav_toggle_in_selected_set" or your bound key to this command (default z).
Now bring down your console and type "mark PLAYER_START" and press Enter.
This will turn the selected area into a Player Start position for the survivors. It should turn a purple color.

Left 4 Dead requires certain nav areas in its levels for the director to work properly. For this simple test level, we will use another attribute called "FINALE".
Walk down to the 2nd room in this level and select the area that occupies it.
Bring down the console and type "mark FINALE" and press Enter.
This will turn this room into a finale area and it will turn blue.
Now, the level has all it needs for the director to work properly. The director can create a "flow" from the starting point to the destination point.
To make the level a little more playable, let's mark the areas around the Player Start area as "EMPTY" so that the player won't get mobbed right after jumping into the map.
Select all the areas around the Player Start.
Bring down the console and type "mark EMPTY" and press Enter.
This will prevent "wandering" common infected from appearing in these areas when the map starts.

Save the nav mesh by using "nav_save".

[edit] Analyzing the Nav
Now that we have a basic nav mesh, we need the game to analyze it so that the director knows where it can spawn infected.
Bring down the console and type "nav_analyze" and press Enter.
This might take a few seconds and then the level will reload.
To test spawning infected, use "director_start" in the console and reload the level with "map tutorial04".
Your scene should look something like this now.
[edit] Adding Nav to a Ladder
If you open up tutorial03 in the game, and switch to nav_edit 1, you'll see how a ladder looks with nav placed on it.
Do create nav on a func_ladder, position your cursor over it in nav_edit mode and use "nav_build_ladder".
[edit] Connecting Nav Areas
While a lot of the nav areas will be connected properly when you use nav_generate_incremental, there are some that you might want to tweak or change. For example, the catwalk we created in tutorial03 might not have connected properly to the areas below it.
To connect 2 nav areas, select them and use "nav_connect" in the console. The X key is currently bound to this in the nav.cfg file.
This will connect the areas in both directions and form a light blue line as seen in this image. Infected can climb up (they can climb to any area 180 units or lower) and they can drop down. Survivor bots can also drop down.
To connect 2 areas one-way only, you will need to select the one you want to be able to connect to the other and then point to the second with the cursor but don't select it. Then, use "nav_connect".
Make sure in both cases that the 2 areas you want to connect are not layered on top of one another. This will cause infected to bump their heads when they try to climb up.
[edit] Drawing Your Own Nav Areas
Sometimes the nav_generate_incremental leaves out areas that you want to have nav on. In these cases, you will need to draw your own nav area.
First, you'll need to bind 2 keys. One key should be bound to "nav_begin_area" and the other should be bound to "nav_end_area". The nav.cfg file has nav_begin_area bound to the left mouse button and "nav_end_area" bound to the right mouse button.
Point to the area you want to create an area and click the nav_begin_area bound key. As you move the mouse around, you can see where the nav area will draw if you press the nav_end_area key.
Click the nav_end_area key to see the result.

If you accidentally press the nav_begin_area bound key when you don't want to draw a nav area, you can press the same key again and it will cancel the nav creation.
You might notice that the cursor doesn't snap to a grid when you're in this mode. You can set the snapping properties using "nav_snap_to_grid" in the console.

It is also possible to draw a ladder using nav_begin_area and nav_end area. Simply point at a corner of the ladder and move the cursor vertically to go to the opposite corner.