Login x
User Name:
Password:
Social Links Facebook Twitter YouTube Steam RSS News Feeds
Watch MODSonair

Members Online

»
0 Active | 279 Guests
Online:

LATEST FORUM THREADS

»
New BF2 Mod
BF2 General

Tutorials

»
Left 4 Dead
ratings:
Awful Rating
Poor Rating
Average Rating
Good Rating
Excellent Rating
Setting Up Nav Meshes
Versions: You must be logged in to view history.
In this tutorial I am going to show you how to set up nav meshes. Nav meshes allow the AI Survivors and infected to move though out the level.

Your First Nav Mesh

In Hammer, open your map file

Press F9 and click on the OK Button to compile it.

Getting Started

When the level loads, You will see an error message appear.

nav_meshes_1_300

Click on CONTINUE to close the message.

Bring down the console and this time type "nav_edit 1" and press Enter

Generating a New Nav Mesh

Hide the console and select a spot on the floor by aiming at it with your crosshair

nav_meshes_2_400 

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".

nav_meshes_3_400

Bring down your console again and type "nav_generate" and press Enter.

This will generate a nav areas around the nav_mark_walkable and it should generate throughout your level.

nav_meshes_4_400 

Note: If you have a bigger level, you will need to place more of the nav_mark_walkable markers throughout your level. Each nav_mark_walkable has a radius that it creates areas around. In general, build nav areas for one section at a time to keep the nav mesh clean.

Nav_generate automatically saves the nav mesh when it is run. If you want to save manually, use "nav_save" from the console.

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.

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 left4deadcfg 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]

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.

nav_meshes_5_400

Press your bound key to see the result.

nav_meshes_6_400 

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.

nav_meshes_7_400

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).

nav_meshes_8_400

Now bring down your console and type "mark PLAYER_START" and press Enter.

nav_meshes_9_400

This will turn the selected area into a Player Start position for the survivors. It should turn a purple color.

Note: if you mark an area with an attribute and you want to remove it later, select the area and use "clear_attribute [attribute name]" in the console to remove it.

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.

nav_meshes_10_400

Bring down the console and type "mark FINALE" and press Enter. 

nav_meshes_11_400

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.

nav_meshes_12_400

Bring down the console and type "mark EMPTY" and press Enter. 

nav_meshes_13_400

This will prevent "wandering" common infected from appearing in these areas when the map starts.

Note: It will not prevent mobs from spawning in these areas later. You will need to add the attribute "NO_MOBS" for that.

Save the nav mesh by using "nav_save".

Note: If you make a mistake or if you find that the auto generation of the nav mesh has mistakes, you can delete nav areas by binding a key to "nav_delete". In the config file provided, this key is the Delete Key. For example, the weapons table doesn't actually need a nav area on top of it. It may cause survivors to stand on which might not be desirable.

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.

nav_meshes_14_400 

Your scene should look something like this now.

Adding Nav to a Ladder

Do create nav on a func_ladder, position your cursor over it in nav_edit mode and use "nav_build_ladder".

nav_meshes_15_400

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.

nav_meshes_16_400

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.

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.

nav_meshes_17_400

Click the nav_end_area key to see the result.

Note: Creating your own nav areas will not automatically connect them to the rest of the nav mesh. Use nav_connect to connect them to adjacent areas.

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.

Tip: It can be useful to bind a key to "incrementvar nav_snap_to_grid 0 2 1" (which is what the [ key is bound to in the nav.cfg file). This will change the grid size when you press the bound key and continue to toggle through the sizes as you continue to press the key.

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.


That's it for this tutoria, Hope it help

Welshy/Valve

Source http://www.l4d.com/LevelDesignDocs.zip

 

Latest Syndicated News

»
Codutility.com up and runn...
Nice, and there still using the logo and template for the screenshots, which...
Codutility.com up and runn...
dundy writes...Quote:Call of Duty modding and mapping is barly alive only a ...
Codutility.com up and runn...
Mystic writes...Quote:It seems to me the like the site is completely dead? ...
Codutility.com up and runn...
It seems to me the like the site is completely dead?

Partners & Friends

»