Nav Mesh: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
No edit summary
Line 11: Line 11:
===What is Computed During Generation===
===What is Computed During Generation===
The following steps occur during Navigation Mesh generation:
The following steps occur during Navigation Mesh generation:
* Starting at a player spawn point, walkable space is sampled
* Starting at a player spawn point, walkable space is sampled by "flood-filling" outwards from that spot, searching for adjacent walkable points
* Rectangular ''Navigation Areas'' are constructed from the sampled data
* Rectangular ''Navigation Areas'' are constructed from the sampled data
* Hiding and Sniper spots are computed
* Hiding and Sniper spots are computed
Line 22: Line 22:
===Viewing the Navigation Mesh===
===Viewing the Navigation Mesh===
To see the resulting Navigation Mesh, type <code>'''nav_edit 1'''</code>.  To turn the mesh editor off, type <code>'''nav_edit 0'''</code>.
To see the resulting Navigation Mesh, type <code>'''nav_edit 1'''</code>.  To turn the mesh editor off, type <code>'''nav_edit 0'''</code>.
===Explicity Marking Walkable Areas (ie: "There's no mesh upstairs")===
Some maps that have very steep stairs, ramps, or hills may confuse the generation system, resulting in the Navigation Mesh not covering the entire map.  To solve this, you can manually place additional ''walkable markers'' that tell the generator to search outwards from that point during its sampling phase.
To add one or more walkable markers, first aiming your view towards a known walkable spot in your map, then type <code>'''nav_mark_walkable'''</code> in the console.  When you are finished placing markers, type <code>'''nav_generate'''</code> to re-generate the mesh.
===Quickly Generating Meshes for Testing===
The analysis phase of the generator can be quite time consuming.  To skip it, type <code>'''nav_quicksave 1'''</code> in the console.  '''NOTE:''' "Quicksaving" skips the analysis phase, and the resultant nav mesh will be missing important data required by the CS Bots and Hostages higher-level planning and attention systems.  While useful for testing, editing, and tuning a nav mesh, be sure to do a full analyze (ie: with <code>nav_quicksave 0</code>) before publishing your nav file to others.


----
----


Addition information can be found [http://www.turtlerockstudios.com/forums/csbot/viewtopic.php?t=725 here].
Addition information can be found [http://www.turtlerockstudios.com/forums/csbot/viewtopic.php?t=725 here].

Revision as of 16:11, 28 June 2005


Introduction

A Navigation Mesh represents the "walkable areas" of a map. This data is required by Bots and Hostages in Counter-Strike:Source, allowing them to "know" how to move around in the environment.

Navigation Mesh data is stored in a .nav file corresponding to the map file (.bsp) for which it is used. For example, the nav mesh for cstrike\maps\de_dust.bsp is stored in cstrike\maps\de_dust.nav.

Automatic Navigation Mesh Generation

To support the many community-created maps, Counter-Strike:Source includes an automatic mesh generation system. The first time you attempt to play a custom map with bots, the generation system will build a .nav file for that map. Depending on the size and complexity of the map, this may take a few minutes to a few hours. Most maps take about 5 minutes to auto-generate a .nav file. Once the generation is complete, a .nav file is saved to your hard drive for future use.

What is Computed During Generation

The following steps occur during Navigation Mesh generation:

  • Starting at a player spawn point, walkable space is sampled by "flood-filling" outwards from that spot, searching for adjacent walkable points
  • Rectangular Navigation Areas are constructed from the sampled data
  • Hiding and Sniper spots are computed
  • Encounter Spots and Approach Points are computed (this can take awhile)
  • Initial Encounter areas are computed

Manually Starting the Generation Process

To start the generation process manually, type nav_generate from the console.

Viewing the Navigation Mesh

To see the resulting Navigation Mesh, type nav_edit 1. To turn the mesh editor off, type nav_edit 0.

Explicity Marking Walkable Areas (ie: "There's no mesh upstairs")

Some maps that have very steep stairs, ramps, or hills may confuse the generation system, resulting in the Navigation Mesh not covering the entire map. To solve this, you can manually place additional walkable markers that tell the generator to search outwards from that point during its sampling phase.

To add one or more walkable markers, first aiming your view towards a known walkable spot in your map, then type nav_mark_walkable in the console. When you are finished placing markers, type nav_generate to re-generate the mesh.

Quickly Generating Meshes for Testing

The analysis phase of the generator can be quite time consuming. To skip it, type nav_quicksave 1 in the console. NOTE: "Quicksaving" skips the analysis phase, and the resultant nav mesh will be missing important data required by the CS Bots and Hostages higher-level planning and attention systems. While useful for testing, editing, and tuning a nav mesh, be sure to do a full analyze (ie: with nav_quicksave 0) before publishing your nav file to others.



Addition information can be found here.