Sorting out navigation flow: Difference between revisions
Yar Kramer (talk | contribs) No edit summary |
|||
Line 19: | Line 19: | ||
==Console Commands== | ==Console Commands== | ||
To start editing the navigation mesh, type | To start editing the navigation mesh, type ''exec nav_mode'' into the console. This sets up Valve's configuration for nav editing and is very useful in accessing all the commands you will need to use. To quit the nav editing mode, press ''Page Down;'' note that this doesn't always seem to remove all editing functions, so you may need to type ''exec config_default'' afterwards to reset your controls to the default configuration. | ||
The best way to get to know the commands is to open up the ''nav_mode.cfg'' file yourself and make a list of the keys. However, some very useful editing commands are below: | |||
* '''z_spawn''' (default ''1'') - This spawns a normal zombie at your crosshair. If you add a parameter after the command the relevant zombie will be spawned; for example, "z_spawn tank" will spawn a tank. | |||
* '''noclip''' (default ''n'') - Allows you to fly around the map and through objects. Very useful in positioning yourself for editing high-up areas or for getting to a specific area of your map quickly. | |||
* '''nav_save''' (default ''TAB'') - Saves your navigation mesh. ''Do this often,'' as there's no function for undoing changes if you mess things up! | |||
* '''director_start/stop''' (default ''F3'') - Toggles the director's enabled/disabled state. If enabled (and your flow is valid), wandering zombies will spawn, tanks and witches will spawn, etc. | |||
* '''respawn_bot''' (default ''Numpad DEL'') - This respawns a random bot. Note that this is a custom alias created in the ''nav_mode.cfg'' file and so will not function unless you have exec'd the file. The alias "respawn_bots" respawns all four bots but is not bound to a key by default. | |||
* '''warp_all_survivors_here''' (default ' [apostrophe]) - Warps all survivors (including you) to the spot under your crosshair. | |||
* '''nb_delete_all''' (default ''2'') - Deletes all NPCs (zombies, specials, survivors) from the world. | |||
* '''nb_move_to_cursor''' (default ''3'') - Tells all NPCs to move towards the point under your crosshair. The target point is marked temporarily with a small green cross. | |||
* '''nav_simplify_selected''' (default ''F7'') - Attempts to merge any nav areas you have selected to simplify them. ''Don't'' try this with the whole map selected as the game will crash. | |||
* '''nav_gui''' (default ''F6'') - Opens up the nav-editing GUI with some advanced options. Note that the ''nav_gui'' command will need to be typed again to close the window and re-enable movement. | |||
* '''nav_trouble_report''' (default ''PgUp'') - Runs a check for the common problems present in navigation meshes. Any problem areas will be highlighted and the number of errors displayed in the console. Try typing the command in the console and add a space to see the different parameters that can be given. | |||
There are also some other very useful commands that are not included in the config: | |||
* '''z_show_flow_delta 1/2''' - This enables flow arrows on the nav sector that you're looking at (if set to 1) or all nav sectors in the area (if set to 2). | * '''z_show_flow_delta 1/2''' - This enables flow arrows on the nav sector that you're looking at (if set to 1) or all nav sectors in the area (if set to 2). | ||
* '''z_show_flow_distance 1''' - This enables the flow distance to be displayed: '''xxxx/xxxx'''. These numbers relate to the units | * '''z_show_flow_distance 1''' - This enables the flow distance to be displayed: '''xxxx/xxxx'''. These numbers relate to the units increasing towards map goal/units increasing from start. If '''-9999/-9999''', the flow to this nav area is broken. | ||
* '''nav_recompute_flow''' - This is your best friend. If you type this into the console, the game will attempt to recompute the navigation flow of the map. If there's no errors, you're fine - if there are errors, they are usually one of the following three: | * '''nav_recompute_flow''' - This is your best friend. If you type this into the console, the game will attempt to recompute the navigation flow of the map. If there's no errors, you're fine - if there are errors, they are usually one of the following three: | ||
Revision as of 10:48, 22 January 2010
Getting the nav flow right is one of the hardest parts in creating a good, working Left 4 Dead map. If the flow from the start to the end of the map isn't valid, survivors may not be able to reach the end safe room or finale, rescue closets might not work and the wandering infected will not spawn.
This is a checklist that I have compiled as I've overcome problems in my nav mesh generation. Please feel free to add to this if you discover any other useful methods/pieces of information.
Introduction
Firstly, the standard Left 4 Dead campaigns consist of five levels. The first level contains the original player spawn area (referred to in the navigation mesh as PLAYER START) and proceeds to a safe room (CHECKPOINT). The next three maps go from safe room to safe room and the last map ends in a finale (FINALE). Any campaign you build is not limited to five maps, but using the standard campaign basis as an example, this is the general flow:
- PLAYER START to CHECKPOINT - eg. l4d_airport01_greenhouse.bsp - "Player Start" map.
- CHECKPOINT to CHECKPOINT - eg. l4d_airport02_offices.bsp - "Checkpoint" map.
- CHECKPOINT to CHECKPOINT - eg. l4d_airport03_garage.bsp - "Checkpoint" map.
- CHECKPOINT to CHECKPOINT - eg. l4d_airport04_terminal.bsp - "Checkpoint" map.
- CHECKPOINT to FINALE - eg. l4d_airport05_runway.bsp - "Finale" map.
Depending on how many maps your campaign has, the CHECKPOINT to CHECKPOINT does not necessarily have to exist. You could have PLAYER START to CHECKPOINT and then CHECKPOINT to FINALE, or just plain PLAYER START to FINALE.

Console Commands
To start editing the navigation mesh, type exec nav_mode into the console. This sets up Valve's configuration for nav editing and is very useful in accessing all the commands you will need to use. To quit the nav editing mode, press Page Down; note that this doesn't always seem to remove all editing functions, so you may need to type exec config_default afterwards to reset your controls to the default configuration.
The best way to get to know the commands is to open up the nav_mode.cfg file yourself and make a list of the keys. However, some very useful editing commands are below:
- z_spawn (default 1) - This spawns a normal zombie at your crosshair. If you add a parameter after the command the relevant zombie will be spawned; for example, "z_spawn tank" will spawn a tank.
- noclip (default n) - Allows you to fly around the map and through objects. Very useful in positioning yourself for editing high-up areas or for getting to a specific area of your map quickly.
- nav_save (default TAB) - Saves your navigation mesh. Do this often, as there's no function for undoing changes if you mess things up!
- director_start/stop (default F3) - Toggles the director's enabled/disabled state. If enabled (and your flow is valid), wandering zombies will spawn, tanks and witches will spawn, etc.
- respawn_bot (default Numpad DEL) - This respawns a random bot. Note that this is a custom alias created in the nav_mode.cfg file and so will not function unless you have exec'd the file. The alias "respawn_bots" respawns all four bots but is not bound to a key by default.
- warp_all_survivors_here (default ' [apostrophe]) - Warps all survivors (including you) to the spot under your crosshair.
- nb_delete_all (default 2) - Deletes all NPCs (zombies, specials, survivors) from the world.
- nb_move_to_cursor (default 3) - Tells all NPCs to move towards the point under your crosshair. The target point is marked temporarily with a small green cross.
- nav_simplify_selected (default F7) - Attempts to merge any nav areas you have selected to simplify them. Don't try this with the whole map selected as the game will crash.
- nav_gui (default F6) - Opens up the nav-editing GUI with some advanced options. Note that the nav_gui command will need to be typed again to close the window and re-enable movement.
- nav_trouble_report (default PgUp) - Runs a check for the common problems present in navigation meshes. Any problem areas will be highlighted and the number of errors displayed in the console. Try typing the command in the console and add a space to see the different parameters that can be given.
There are also some other very useful commands that are not included in the config:
- z_show_flow_delta 1/2 - This enables flow arrows on the nav sector that you're looking at (if set to 1) or all nav sectors in the area (if set to 2).
- z_show_flow_distance 1 - This enables the flow distance to be displayed: xxxx/xxxx. These numbers relate to the units increasing towards map goal/units increasing from start. If -9999/-9999, the flow to this nav area is broken.
- nav_recompute_flow - This is your best friend. If you type this into the console, the game will attempt to recompute the navigation flow of the map. If there's no errors, you're fine - if there are errors, they are usually one of the following three:
- GetGoalArea: Cannot find SPAWN_RESCUE_CLOSET area in FINALE, thus cannot guarantee reachability of goal area.
This means: either you have not inserted a survivor closet into your finale map (see fourth section of checklist below) or the game has not detected two distinct CHECKPOINT areas (see 5th section of checklist below).
- ComputeFlowDistances: ERROR - Cannot compute flow.
This means that your navigation flow is broken somewhere - there are nav sectors that are not connected to each other and so do not complete the flow from the beginning to the end of the map. Nav_trouble_report orphan will usually highlight where the break is - if not, manually check through your intended route for any vital connections that are missing. Left 4 Dead commonly mucks up stair meshes - these would be your first suspects.

- GetGoalArea: Cannot find end area - no checkpoint or finale located.
This means that none of your nav areas have been marked with either CHECKPOINT or FINALE. If you want a checkpoint, you've probably done something wrong concerning your safe rooms - see the third item on the cheklist below. If you want a finale, you need to apply the mark FINALE attribute liberally to the navigation sectors in your finale area.
Checklist
For me, this is my complete nav flow checklist:
- If on Player Start map (see top) of campaign, needs a PLAYER START nav surrounded by CHECKPOINT where the players will spawn. If not starting map (a Checkpoint or Finale map, see top), just needs CHECKPOINT areas inside the safe room.
- Prop_door_rotating_checkpoint in the spawning safe room needs to be named checkpoint_exit, and in the final safe room named checkpoint_entrance. These names are important: I have unconfirmed speculations, but I think that the navigation flow is invalid if these names are not followed correctly. They are the opposite way around to they way you'd expect: the starting door exits the previous safe room, the ending door enters the next one.
- A trigger_changelevel needs to be put into the ending saferoom and needs to touch at least the majority of floor space in the room. This is so that, when computing the navigation mesh, the game knows where to mark the CHECKPOINT areas. Note that the trigger_changelevel does not necessarily need to point to a valid map but does need to have something in the map field, otherwise the navigation flow may not be computed correctly. Should usually be used in conjuction with a trigger_transition and info_landmark, named identically to each other.
- After recent investigation, I've found out that the placement of weapons and items is important when computing navigation flow. The game uses these entities to further help distinguish safe rooms from the rest of the map. It's recommended to have at least one weapon_ammo_spawn, four weapon_first_aid_kit_spawns and either a Pump Shotgun and SMG or the three power weapons in each safe room or starting area.
- It is recommended that each map has at least one survivor closet: a room, completely sealed apart from a prop_door_rotating, and housing three info_survivor_rescue entities. Note that PLAYER START to CHECKPOINT (Player start) or CHECKPOINT to CHECKPOINT (Checkpoint) maps don't necessarily need one, as the safe room acts as a closet on the next map load [can someone confirm this?]. However, for finale maps it is essential that a survivor closet exists, since there is no final saferoom for the survivors. If you do not put a survivor closet in a finale map, there will be an error when computing the flow - see the first nav_recompute_flow error above.
- If all the navigation sectors in your map are marked "Missing Checkpoint" by nav_trouble_report checkpoint, this is either because you haven't set up one/both of your checkpoints properly, or because some areas of navigation mesh are either preceding your first checkpoint or succeeding your last checkpoint. If there are nav areas beyond either of these checkpoints, the safe room areas are not going to be marked explicitly as the beginning and ending areas of your map - for example, if there was some mesh succeeding your ending safe room, the end of this extra mesh area would become the end of the map and the safe room area would only be 99% of the way there, which is not what we would want. Since the nav generation process sometimes isn't the smartest, it'll think that all the mesh in-between your beginning and ending safe rooms should belong to one safe room only - the one at the start. Hence, it wants you to have a massive safe room spanning the entirety of your map, just to have the actual playable section as that tiny, unmarked bit right at the end. Luckily, if you delete these extra areas the problem should go away. Correct me if I'm wrong, of course.
- Finally, if all else fails, re-generate your mesh using nav_generate and tweak it to your liking. This sometimes solves problems that you cannot find a solution to.
In Conclusion
If anyone's having problems they can't sort out, drop me an e-mail at jonathan[.]poncelet[@]talk21[.]com and I'll try to help. Happy mapping!