Nav Mesh: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
m (Clarify what?)
 
(167 intermediate revisions by 46 users not shown)
Line 1: Line 1:
[[Category:Level Design]]
{{LanguageBar}}


==Introduction==
A [[w:Navigation mesh|'''Navigation Mesh''']] ('''NavMesh''' or '''nav mesh''') is a data structure that stores data used for path finding, which is typically used by bots. In {{source|4}}, navigation meshes are used by the following entities:
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.
# [[Bot]]s and Hostages in:
#* {{css|4}}
#* {{csgo|4}}
# [[NextBot]] entities in:
#* {{l4d|4}}
#* {{l4d2|4}}
#* {{gmod|4}}
#* {{tf2|4}}
#* {{p3|4}}
#* {{jb3|4}}
#* {{bms|4}}
…to realize what's navigable in their environment, and path to their desired destination.


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.
==NAV file format==
{{Main|.nav}}


==Automatic Navigation Mesh Generation==
==NAV files ==
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.
Navigation Mesh data is stored in a [[NAV]] file corresponding to the map file ([[BSP|.bsp]]) for which it is used. For example, the nav mesh for <code>cstrike\maps\de_dust[[.bsp]]</code> is stored in <code>cstrike\maps\de_dust[[.nav]]</code>.


==What is Computed During Generation==
==Navigation Mesh Editing==
The following steps occur during Navigation Mesh generation:
{{Main|Nav Mesh Editing}}
* Starting at a player spawn point, walkable space is sampled
{{Main|Nav Mesh Commands}}
* Rectangular ''Navigation Areas'' are constructed from the sampled data
The Navigation Mesh Editing is done in-game. A (new) .nav file can be generated with <code>nav_generate</code> (which requires {{Command|sv_cheats|1}} and {{Command|nav_edit|1}}).
* Hiding and Sniper spots are computed
* Encounter Spots and Approach Points are computed (this can take awhile)
* Initial Encounter areas are computed


==Manually Starting Mesh Generation==
==Game Specific SubVersions==
To start the generation process manually, type ''nav_generate'' from the console.
{| class="standard-table"
! Game !! Nav Mesh Class !! Subversion !! Notes
|-
| {{source|2}}
{{gmod|2}}
| TheNavMesh
| 0
| Garry's Mod uses the base navigation mesh (It doesn't use its own implementation unlike Valve games)
|-
| {{css|2}}
{{csgo|2}}
| CSNavMesh
| 1
| * Appends approach area data to each area.
|-
| {{tf2|2}}
| CTFNavMesh
| 2
| Appends TF2-specific attribute flag to area data.
|-
| {{l4d|2}}
| TerrorNavMesh
| 13
|
|-
| {{l4d2|2}}
| TerrorNavMesh
| 14
|}


==See also==
* [[Nav Mesh Commands|Navigation Mesh Console Command Reference]]
* [[List of L4D Series Nav Mesh Attributes]]
* [[L4D Level Design/Nav Meshes]]
* [[L4D Level Design/Nav Flow]]
* [[L4D Level Design/Advanced Nav Editing]]


Addition information can be found [http://www.turtlerockstudios.com/forums/csbot/viewtopic.php?t=725 here].
==External links==
* Official forums for the bot system (down) - [http://web.archive.org/web/*/http://www.turtlerockstudios.com/forums/csbot/ Archived version].
* [https://www.editlife.net/tutorial.php?tutid=60 Waypointing for CS:S Bots/Hostages (Edit Life)]
 
[[Category:Source]]
 
[[Category:Level Design]]<!--Why?-->

Latest revision as of 00:14, 8 July 2025

English (en)Deutsch (de)Esperanto (eo)Español (es)日本語 (ja)中文 (zh)Translate (Translate)

A Navigation Mesh (NavMesh or nav mesh) is a data structure that stores data used for path finding, which is typically used by bots. In Source Source, navigation meshes are used by the following entities:

  1. Bots and Hostages in:
  2. NextBot entities in:

…to realize what's navigable in their environment, and path to their desired destination.

NAV file format

Main article:  .nav

NAV files

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.

Navigation Mesh Editing

Main article:  Nav Mesh Editing
Main article:  Nav Mesh Commands

The Navigation Mesh Editing is done in-game. A (new) .nav file can be generated with nav_generate (which requires sv_cheats 1 and nav_edit 1).

Game Specific SubVersions

Game Nav Mesh Class Subversion Notes
Source Source

Garry's Mod Garry's Mod

TheNavMesh 0 Garry's Mod uses the base navigation mesh (It doesn't use its own implementation unlike Valve games)
Counter-Strike: Source Counter-Strike: Source

Counter-Strike: Global Offensive Counter-Strike: Global Offensive

CSNavMesh 1 * Appends approach area data to each area.
Team Fortress 2 Team Fortress 2 CTFNavMesh 2 Appends TF2-specific attribute flag to area data.
Left 4 Dead Left 4 Dead TerrorNavMesh 13
Left 4 Dead 2 Left 4 Dead 2 TerrorNavMesh 14

See also

External links