Nav Mesh: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
m (Clarify what?)
 
(88 intermediate revisions by 34 users not shown)
Line 1: Line 1:
[http://winged.servemp3.com/pages/a1.htm a1] [http://endure.servemp3.com/giant-pandas.html giant pandas] [http://swung.servemp3.com/topic/cbssportsline.html cbssportsline] [http://sings.servemp3.com/article/minimotos.html minimotos] [http://marts.servemp3.com/yahoo-people.html yahoo people search] [http://winged.servemp3.com/pages/cougar.htm cougar] [http://winged.servemp3.com/pages/great-wolf-lodge.htm great wolf lodge] [http://swung.servemp3.com/topic/bartsimpson.html bartsimpson] [http://swung.servemp3.com/topic/steve-madden.html steve madden] [http://sizzle.servemp3.com/constructivism.html constructivism] [http://topas.servemp3.com/data/vellum-paper.html vellum paper] [http://sings.servemp3.com/article/greek-theater.html greek theater] [http://pittie.servemp3.com/styles/sims2-cheats.htm sims2 cheats] [http://swung.servemp3.com/topic/canon-s2-is.html canon s2 is] [http://sings.servemp3.com/article/living-dead-girl.html living dead girl] [http://swung.servemp3.com/topic/chely-wright.html chely wright] [http://topas.servemp3.com/data/prom-decorations.html prom decorations] [http://winged.servemp3.com/pages/plus-size-bra.htm plus size bra] [http://swung.servemp3.com/topic/id-badge-holders.html id badge holders] [http://winged.servemp3.com/pages/essential-fatty.htm essential fatty acids] [http://sizzle.servemp3.com/name-change.html name change] [http://winged.servemp3.com/pages/suzuki-intruder.htm suzuki intruder] [http://marts.servemp3.com/wwwrottoncom.html www.rotton.com] [http://winged.servemp3.com/pages/diversity.htm diversity] [http://winged.servemp3.com/pages/carmen-berg.htm carmen berg] [http://array.servemp3.com/long-nipples.html long nipples] [http://array.servemp3.com/lewis-and-clark.html lewis and clark expedition] [http://topas.servemp3.com/data/victorian-homes.html victorian homes] [http://swung.servemp3.com/topic/krishna.html krishna] [http://topas.servemp3.com/data/divination.html divination] [http://sizzle.servemp3.com/bengal-cats.html bengal cats] [http://topas.servemp3.com/data/bull-dog.html bull dog] [http://pours.servemp3.com/data/import-tuners.html import tuners] [http://endure.servemp3.com/taurus-firearms.html taurus firearms] [http://marts.servemp3.com/monster-magnet.html monster magnet] [http://array.servemp3.com/dc.html dc] [http://sings.servemp3.com/article/rhetoric.html rhetoric] [http://endure.servemp3.com/sephora.html sephora] [http://pittie.servemp3.com/styles/banana.htm banana] [http://sings.servemp3.com/article/mischa-barton.html mischa barton] [http://pittie.servemp3.com/styles/car-emblems.htm car emblems] [http://sizzle.servemp3.com/dielectric-filters.html dielectric filters] [http://winged.servemp3.com/pages/learn-french.htm learn french] [http://array.servemp3.com/head-hilton.html head hilton home] [http://endure.servemp3.com/two-piece-swimwear.html two piece swimwear] [http://endure.servemp3.com/tink.html tink] [http://swung.servemp3.com/topic/annualcreditreportcom.html annualcreditreport.com] [http://sings.servemp3.com/article/mystery-shopping.html mystery shopping] [http://winged.servemp3.com/pages/ludacris-act.htm ludacris act a fool] [http://pours.servemp3.com/data/thank-you-notes.html thank you notes] [http://sings.servemp3.com/article/atv-accessories.html atv accessories] [http://marts.servemp3.com/marine-aquarium.html marine aquarium] [http://sizzle.servemp3.com/jicama.html jicama] [http://swung.servemp3.com/topic/cameroon.html cameroon] [http://sings.servemp3.com/article/hair-products.html hair products] [http://swung.servemp3.com/topic/camp-site.html camp site] [http://array.servemp3.com/circumcision.html circumcision] [http://marts.servemp3.com/great-white-shark.html great white shark] [http://winged.servemp3.com/pages/etienne-aigner.htm etienne aigner] [http://winged.servemp3.com/pages/salt-water-aquariums.htm salt water aquariums] [http://sings.servemp3.com/article/missy-elliot-mp3.html missy elliot mp3] [http://array.servemp3.com/pinkfloyd.html pinkfloyd] [http://pittie.servemp3.com/styles/wicca.htm wicca] [http://endure.servemp3.com/seed-beads.html seed beads] [http://sizzle.servemp3.com/audiovox-ringtones.html audiovox ringtones] [http://pittie.servemp3.com/styles/upholstery-cleaning.htm upholstery cleaning] [http://endure.servemp3.com/nicole-hilton.html nicole hilton] [http://endure.servemp3.com/gemstone-beads.html gemstone beads] [http://winged.servemp3.com/pages/lacus-clyne.htm lacus clyne] [http://pours.servemp3.com/data/award-plaques.html award plaques] [http://winged.servemp3.com/pages/woodburning.htm woodburning stoves] [http://topas.servemp3.com/data/lance-armstrong.html lance armstrong] [http://topas.servemp3.com/data/aria-giovanni.html aria giovanni] [http://topas.servemp3.com/data/wholesale-printing.html wholesale printing] [http://sizzle.servemp3.com/pressure-cookers.html pressure cookers] [http://swung.servemp3.com/topic/free-online-casinos.html free online casinos] [http://array.servemp3.com/guilty.html guilty] [http://sings.servemp3.com/article/alps.html alps] [http://array.servemp3.com/time-of-your.html time of your life] [http://sings.servemp3.com/article/ornamental-iron.html ornamental iron] [http://sizzle.servemp3.com/pussycat.html pussycat] [http://swung.servemp3.com/topic/myspacecom.html myspace.com] [http://array.servemp3.com/mouse-traps.html mouse traps] [http://topas.servemp3.com/data/credit-bureau.html credit bureau] [http://topas.servemp3.com/data/state-of-hawaii.html state of hawaii] [http://sizzle.servemp3.com/expert-search.html expert search engine optimization] [http://winged.servemp3.com/pages/fossils.htm fossils] [http://sings.servemp3.com/article/buck-owens.html buck owens] [http://marts.servemp3.com/mest.html mest] [http://sings.servemp3.com/article/luftansa-airlines.html luftansa airlines] [http://swung.servemp3.com/topic/denmark.html denmark] [http://marts.servemp3.com/work-at-home.html work at home opportunities] [http://sings.servemp3.com/article/cnc-router.html cnc router] [http://sings.servemp3.com/article/hockey-jerseys.html hockey jerseys] [http://pours.servemp3.com/data/free-certificates.html free certificates] [http://swung.servemp3.com/topic/doh.html doh] [http://marts.servemp3.com/manchester-united.html manchester united tickets] [http://winged.servemp3.com/pages/life-after-death.htm life after death] [http://pours.servemp3.com/data/bobbie.html bobbie] [http://marts.servemp3.com/biaxin-xl.html biaxin xl] [http://sizzle.servemp3.com/muse-hysteria.html muse hysteria] [http://sizzle.servemp3.com/leeann.html leeann] [http://swung.servemp3.com/topic/mt-everest.html mt everest] [http://marts.servemp3.com/lusitania.html lusitania] [http://pours.servemp3.com/data/used-car-search.html used car search] [http://winged.servemp3.com/pages/ford-tractors.htm ford tractors] [http://winged.servemp3.com/pages/lennon.htm lennon] [http://endure.servemp3.com/kristi-cline.html kristi cline] [http://pittie.servemp3.com/styles/philadelphia-museum.htm philadelphia museum of art] [http://swung.servemp3.com/topic/bedroom-decorating.html bedroom decorating] [http://swung.servemp3.com/topic/microsoft-office.html microsoft office 2003 product key] [http://endure.servemp3.com/cameron-diaz.html cameron diaz] [http://pittie.servemp3.com/styles/bimini-top.htm bimini top] [http://swung.servemp3.com/topic/car-max.html car max] [http://winged.servemp3.com/pages/trans-siberian.htm trans-siberian orchestra] [http://sizzle.servemp3.com/mario-lanza.html mario lanza] [http://pittie.servemp3.com/styles/free-poker-games.htm free poker games] [http://sizzle.servemp3.com/the-futureheads.html the futureheads] [http://pours.servemp3.com/data/samantha-slopes.html samantha slopes] [http://winged.servemp3.com/pages/carly-simon.htm carly simon] [http://sizzle.servemp3.com/canon-20d.html canon 20d] [http://winged.servemp3.com/pages/irs-tax-relief.htm irs tax relief] [http://sizzle.servemp3.com/christopher-columbus.html christopher columbus] [http://marts.servemp3.com/bikinis.html bikinis] [http://marts.servemp3.com/help-desk.html help desk] [http://swung.servemp3.com/topic/files.html files] [http://swung.servemp3.com/topic/pedestals.html pedestals] [http://pours.servemp3.com/data/william-the-conqueror.html william the conqueror] [http://topas.servemp3.com/data/campsite.html campsite] [http://topas.servemp3.com/data/treatment.html treatment] [http://topas.servemp3.com/data/cdw.html cdw] [http://array.servemp3.com/wwwuniversalcardcom.html www.universalcard.com] [http://array.servemp3.com/lost-in-hollywood.html lost in hollywood] [http://swung.servemp3.com/topic/angeline.html angeline] [http://winged.servemp3.com/pages/lawyer-jokes.htm lawyer jokes] [http://pittie.servemp3.com/styles/paternity-test.htm paternity test] [http://pittie.servemp3.com/styles/mortgage-brokers.htm mortgage brokers] [http://marts.servemp3.com/medley.html medley] [http://pours.servemp3.com/data/computer-financing.html computer financing] [http://endure.servemp3.com/national-university.html national university] [http://sings.servemp3.com/article/fruit-pizza.html fruit pizza] [http://swung.servemp3.com/topic/attcom.html att.com] [http://swung.servemp3.com/topic/tower-record.html tower record uk] [http://sizzle.servemp3.com/acura.html acura] [http://array.servemp3.com/simple-machines.html simple machines] [http://endure.servemp3.com/save-me.html save me] [http://marts.servemp3.com/ashes-of-the.html ashes of the wake] [http://array.servemp3.com/arsenic.html arsenic] [http://pours.servemp3.com/data/eltron-printer.html eltron printer] [http://sings.servemp3.com/article/pond-plants.html pond plants] [http://array.servemp3.com/dietechcom.html dietech.com] [http://pours.servemp3.com/data/angel-of-music.html angel of music] [http://pours.servemp3.com/data/radar-gun.html radar gun] [http://array.servemp3.com/dining-room-furniture.html dining room furniture] [http://marts.servemp3.com/martinique.html martinique] [http://endure.servemp3.com/swiss-army-watches.html swiss army watches] [http://sizzle.servemp3.com/side.html side] [http://pittie.servemp3.com/styles/illuminated.htm illuminated rocker switches] [http://winged.servemp3.com/pages/church.htm church] [http://sizzle.servemp3.com/free-greeting.html free greeting card] [http://endure.servemp3.com/w-magazine.html w magazine] [http://sizzle.servemp3.com/calla-lilies.html calla lilies] [http://endure.servemp3.com/debbie-corrigan.html debbie corrigan] [http://array.servemp3.com/pulaski-furniture.html pulaski furniture] [http://topas.servemp3.com/data/emotions.html emotions] [http://endure.servemp3.com/cant-touch-me.html cant touch me] [http://swung.servemp3.com/topic/windows-help.html windows help] [http://endure.servemp3.com/nordstrom-rack.html nordstrom rack] [http://marts.servemp3.com/macon-telegraph.html macon telegraph] [http://pittie.servemp3.com/styles/ride-with-me.htm ride with me] [http://array.servemp3.com/amee.html amee] [http://array.servemp3.com/eli-whitney.html eli whitney] [http://marts.servemp3.com/audio-bible.html audio bible] [http://endure.servemp3.com/gathering-places.html gathering places] [http://swung.servemp3.com/topic/family-guy-quotes.html family guy quotes] [http://array.servemp3.com/yumi-lee.html yumi lee] [http://marts.servemp3.com/testosterone-cream.html testosterone cream] [http://array.servemp3.com/gas-fireplaces.html gas fireplaces] [http://endure.servemp3.com/rotavirus.html rotavirus] [http://array.servemp3.com/virus-protection.html virus protection] [http://pours.servemp3.com/data/jessica-simpson.html jessica simpson fakes] [http://pittie.servemp3.com/styles/word-of-the-day.htm word of the day] [http://sizzle.servemp3.com/dog-treats.html dog treats] [http://sizzle.servemp3.com/busen.html busen] [http://sizzle.servemp3.com/mesothelioma-cancer.html mesothelioma cancer] [http://swung.servemp3.com/topic/colonics.html colonics] [http://endure.servemp3.com/mens-thongs.html mens thongs] [http://pittie.servemp3.com/styles/free-puppies.htm free puppies] [http://swung.servemp3.com/topic/gary-paulsen.html gary paulsen] [http://sings.servemp3.com/article/custom-magnets.html custom magnets] [http://winged.servemp3.com/pages/sun-sentinel.htm sun sentinel] [http://topas.servemp3.com/data/emirates-airlines.html emirates airlines] [http://swung.servemp3.com/topic/ice-cream-machine.html ice cream machine] [http://marts.servemp3.com/greenday-boulevard.html greenday boulevard of broken dreams] [http://array.servemp3.com/acid-trip.html acid trip] [http://pours.servemp3.com/data/major-melons.html major melons] [http://sizzle.servemp3.com/frat.html frat] [http://pittie.servemp3.com/styles/flirt-for-free.htm flirt for free] [http://marts.servemp3.com/restoril.html restoril] [http://winged.servemp3.com/pages/san-diego-wild.htm san diego wild animal park]
{{LanguageBar}}
A ''Navigation Mesh'' represents the "walkable areas" of a map. This data is '''required''' by [[bot|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 <code>cstrike\maps\de_dust.bsp</code> is stored in <code>cstrike\maps\de_dust.nav</code>.
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:
# [[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.


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


== What is computed during generation ==
==NAV files ==
The following steps occur during Navigation Mesh generation:
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>.
* 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 ==
==Navigation Mesh Editing==
To start the generation process manually, type <code>nav_generate</code> from the console.
{{Main|Nav Mesh Editing}}
{{Main|Nav Mesh Commands}}
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}}).


== Viewing the navigation mesh ==
==Game Specific SubVersions==
To see the resulting Navigation Mesh, type <code>nav_edit 1</code>.  To turn the mesh editor off, type <code>nav_edit 0</code>. You will need to have <code>sv_cheats 1</code> to be able to view the navigation mesh.
{| 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
|}


== Explicitly marking walkable areas (i.e: "There's no mesh upstairs") ==
==See also==
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.
* [[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]]


To add one or more walkable markers, first aim 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.
==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)]


== Quickly generating meshes for testing==
[[Category:Source]]
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: <code>nav_analyze</code> with <code>nav_quicksave 0</code>) before publishing your nav file to others.}}


= Editing the navigation mesh =
[[Category:Level Design]]<!--Why?-->
[[Image:nav_edit.jpg|thumb|300px|right|Enabling the Navigation Mesh editor in de_dust]]The automated Navigation Mesh generator does a reasonable job of constructing a mesh, allowing you to start using Bots and Hostages on custom maps easily.
 
However, careful hand-tuning of the Navigation Mesh can markedly improve the performance of Bots.  In addition, manually decorating the mesh with ''Place Names'' allows the Bots to tell others where events occur, enhances the Counter-Strike radar and includes Place Names in all radio messages.
 
== The navigation mesh editor ==
To enable the editor, type <code>nav_edit 1</code> in the console (type <code>nav_edit 0</code> to disable it).
 
* The white cross in the center of your view is the ''cursor''.
* The Navigation Area you are pointing at is the ''selected area'' and is shown with a yellow outline.
* Navigation Areas that can be reached from the selected area are shown in red.
* The white line in the selected area denotes where the area will be split if the <code>nav_split</code> command is executed.
 
=== Area types ===
[[Image:nav_jump.jpg|300px|thumb|left|'''Jump areas''' (marked with green X's) tell bots that they must jump to reach the higher connected area, and that this area is not usable as a hiding/sniping spot.]]
[[Image:nav_crouch.jpg|300px|thumb|left|'''Crouch areas''' (marked with a blue diagonal slash) force bots to crouch when moving through this area.]]{{clr}}
 
=== Connection types ===
[[Image:nav_connections.jpg|300px|thumb|left|'''Bidirectional (two-way) connections''' (marked with light blue lines at the area edges) allow bots to freely move between the two areas.]]
[[Image:nav_jump_down.jpg|300px|thumb|left|'''One-way connections''' (marked with dark blue lines) are usually used for "jump-down" links from a high ledge to the ground.  This tells the bots that they can jump down, but they can't jump back up.  One-way links can also be useful for forcing bots to travel a specific direction, perhaps to set up for a tricky jump.]]{{clr}}
 
== Using mesh editing commands ==
Although all of the mesh editing commands can be typed in the console, in practice it is far easier to ''bind'' these commands to keys.  For example, <code>bind del nav_delete</code> binds the delete key to the command nav_delete.  After this binding, pressing the delete key will delete the nav area under your cursor (if you are nav editing mode).
 
You can temporarily bind many commands at once by using a CFG file.  This is useful for bot navigation editing, because there are many commands, and you will probably not want them to be permanently attached to your keys. See [[Editing Bot Navigation CFG File]] for a pre-made file and instructions on its use.
 
See [[Counter-Strike: Source Navigation Mesh Console Command Reference|Navigation Mesh Console Command Reference]] for a list of all commands related to bot navigation.
 
== Basic mesh editing commands ==
=== Save ===
Currently, there is no "undo" command in the Navigation Mesh editing system.  Therefore, it is very important to '''save your work often''' via the <code>nav_save</code> command.
 
=== Split ===
To split an area into two adjacent, inter-connected areas, aim your cursor at an area and execute the <code>nav_split</code> command.
 
[[Image:nav_edit.jpg|300px|thumb|left|Before split]]
[[Image:nav_split.jpg|300px|thumb|left|After split]]{{clr}}
 
=== Merge ===
To merge two adjacent areas:
# Aim your cursor at the first area and execute <code>nav_mark</code>
# Aim your cursor at the second area and execute <code>nav_merge</code>
 
Note that both areas must be the same size along the edge to be merged.
 
[[Image:nav_mark.jpg|300px|thumb|left|Marked first area]]
[[Image:nav_pre_merge.jpg|300px|thumb|left|Aim at second area]]
[[Image:nav_post_merge.jpg|300px|thumb|left|Merged]]{{clr}}
 
The resulting area will retain all of the connections of the original two areas, and inherit properties (i.e: Place Names, etc) from the marked area.
 
=== Splice ===
Splicing creates a new area between two existing areas.  Splicing is a powerful tool, and can be used to easily create sloped areas, as shown in the example below.
 
To splice a new area in between two existing areas:
# Aim your cursor at the first area and execute <code>nav_mark</code>
# Aim your cursor at the second area and execute <code>nav_splice</code>
 
[[Image:nav_prep_splice.jpg|300px|thumb|left|Marked first area]]
[[Image:nav_pre_splice.jpg|300px|thumb|left|Aim at second area]]
[[Image:nav_post_splice.jpg|300px|thumb|left|New area spliced between]]{{clr}}
 
=== Delete ===
To delete an area, aim your cursor at it and execute <code>nav_delete</code>
 
=== Creating a new area ===
To manually create a new area:
# Place your cursor at where a corner of the new area should be
# Execute <code>nav_begin_area</code>
# Move your cursor to drag out the area's extent
# Execute <code>nav_end_area</code>
 
[[Image:nav_begin_area.jpg|300px|thumb|left|Start dragging area at first corner]]
[[Image:nav_drag_area.jpg|300px|thumb|left|Drag area extent]]
[[Image:nav_end_area.jpg|300px|thumb|left|Area created]]{{clr}}
 
=== Adding and removing connections between areas ===
The connections between areas define whether an agent can move from one area to another. Usually these connections are ''bidirectional'', meaning agents can move back and forth between two areas at will.  However, sometimes the connection is ''one way'', as in the case of high ledges that can be jumped down, but not back up.
 
To make a one-way connection from area A to area B (meaning you can move from A to B):
# Place your cursor on area A
# Mark area A with <code>nav_mark</code>
# Aim your cursor at area B
# Execute <code>nav_connect</code>
 
To make a bidirectional connection, repeat the above steps reversing the roles of A and B.
 
To remove all connections from areas A and B:
# Aim at area A
# Mark area A with <code>nav_mark</code>
# Aim at area B
# Execute <code>nav_disconnect</code>
 
== Adding place names ==
''Place Names'' can be assigned to areas to label that region of the map.  For instance, if there is a prominent house in the map, all of the nav areas in the house can be tagged with the "House" Place Name.
 
Place Names are used by the CS Bot chatter system to announce where they are, as well as by the radar to show the current location of the player, and is appended to the player's name when they use text chat or radio commands.
 
To enter and leave "Place Painting Mode", execute <code>nav_toggle_place_mode</code> (assuming <code>nav_edit</code> is set to "1").
 
For a list of all available Place Names, execute <code>nav_place_list</code>.
 
Select a Place by typing <code>nav_use_place (name)</code>.  Then aim your cursor at an area you want to label with that Place Name and execute <code>nav_toggle_place_painting</code>.  While "place painting" is active, each area you point at will be tagged with the current Place Name.  To stop place painting, execute <code>nav_toggle_place_painting</code> again.
 
There are several additional commands that provide tools for picking, flood-filling, replacing, and so on.  For a complete reference, see [[#Place Name Commands|Place Name Commands]].
 
=== Place name commands ===
;nav_use_place
:If used without arguments, all available Places will be listed. If a Place argument is given, the current Place is set.
 
;nav_place_replace
:Replaces all instances of the first place with the second place.
 
;nav_place_list
:Lists all place names used in the map.
 
;nav_toggle_place_mode
:Toggle the editor into and out of Place mode. Place mode allows labelling of Area with Place names.
 
;nav_set_place_mode
:Sets the editor into or out of Place mode. Place mode allows labelling of Area with Place names.
 
;nav_place_floodfill
:Sets the Place of the Area under the cursor to the curent Place, and 'flood-fills' the Place to all adjacent Areas. Flood-filling stops when it hits an Area with the same Place, or a different Place than that of the initial Area.
 
;nav_place_pick
:Sets the current Place to the Place of the Area under the cursor.
 
;nav_toggle_place_painting
:Toggles Place Painting mode. When Place Painting, pointing at an Area will 'paint' it with the current Place.
 
== Common mesh problems and solutions ==
=== Extraneous areas on stairs and ramps ===
The automatic generation system tends to build areas that hang off the side of stairs and ramps.  These should be removed to force the bots to take the stairs or ramp straight-on.
 
=== Railings ===
Railings can be a problem for the current bot navigation system.  Including jump-down links that must pass over railings should be avoided unless necessary.  The bots will eventually make these jumps, but they are not terribly elegant while doing so.
 
=== Preventing excessive jumping ===
Mark an area with <code>nav_mark</code>and use the <code>nav_no_jump</code> command to flag the area to discourage jumping.
 
=== Dealing with rotating doors ===
Carving out empty space in the nav mesh to allow for the rotating door.
 
== Advanced editing techniques ==
=== Ladders ===
Ladders can be manually built against climbable surfaces.  Your editing cursor will turn green when pointing at a climbable surface.
 
'''Using <code>nav_build_ladder</code>'''
 
The easy way to build a ladder is to simply point at a climbable surface, and execute <code>nav_build_ladder</code>.
 
[[Image:nav_build_ladder_before.jpg|300px|thumb|left|Point at a climbable surface]]
[[Image:nav_build_ladder_after.jpg|300px|thumb|left|Ladder created]]{{clr}}
 
'''Using <code>nav_begin_area</code> and <code>nav_end_area</code>'''
 
If <code>nav_build_ladder</code> isn't what you need, you can manually create a ladder:
#Place your cursor at where a corner of the new ladder should be
# Execute <code>nav_begin_area</code>
# Move your cursor to drag out the ladder's extent
# Execute <code>nav_end_area</code>
 
This can be useful to get bots to start going up the ladder, and jump off halfway up, onto the crate:
 
[[Image:nav_begin_ladder.jpg|300px|thumb|left|Start dragging ladder at first corner]]
[[Image:nav_drag_ladder.jpg|300px|thumb|left|Drag ladder extent]]
[[Image:nav_end_ladder.jpg|300px|thumb|left|Ladder created]]{{clr}}
 
=== Reversing ladders ===
Sometimes a ladder will be created facing the wrong way.  If a ladder is drawn in red, you are looking at it from the back.  The ladder is drawn in green if it is facing you.  To change the orientation of a ladder, simply point at the ladder and use <code>nav_ladder_flip</code>.
 
[[Image:nav_ladder_backward.jpg|300px|thumb|left|Ladder facing into the wall (incorrect)]]
[[Image:nav_ladder_forward.jpg|300px|thumb|left|Ladder facing away from the wall (correct)]]{{clr}}
 
=== Obstacle avoidance and precision movement ===
Using <code>nav_precise</code>, <code>nav_walk</code>, and <code>nav_stop</code> to disable local obstacle avoidance behaviors and control bot movement.
 
=== Marking areas to avoid ===
Using <code>nav_avoid</code> to tell bots to avoid the area unless the normal route has become too dangerous.
 
=== Controlling where bots Can hide ===
Using <code>nav_no_hide</code> to prevent bots from hiding in that area.
This can be used to force the creation of hiding spots during the analysis phase.
 
=== Setting up sniper spots ===
Mark an area using <code>nav_walk</code> and execute <code>nav_make_sniper_spots</code>. This will break the area into small sub-areas which are used internally by the navigation mesh to encourage sniping.
 
=== Lining up tricky jumps and narrow doorways ===
Arranging nav areas to force specific paths.
 
* If the bots are getting hung up on the sides of a door or window, you can carve out a narrow path through the middle of the opening.
* The highest a bot will try to jump is 58 units.  If the top of a jump is 59 or more units above the bottom, bots will give up as soon as they jump.  If this happens in a spot that the bots can actually jump up to, use <code>nav_corner_lower</code> to lower the upper nav area slightly.
 
[[Image:MaximumJumpCrouch.jpg|300px|thumb|left|Highest possible crouchjump]]{{clr}}
 
= See also =
* [[Counter-Strike: Source Navigation Mesh Console Command Reference|Navigation Mesh Console Command Reference]]
* [http://www.turtlerockstudios.com/forums/csbot/ Official forums for the bot system].
 
{{otherlang:en}} {{otherlang:en:jp|Bot Navigation for Counter-Strike:Source:jp}}
 
[[Category:Level Design]]

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