Condition Zero - Advanced navmesh editing guide

A Tutorial for Counter-Strike: Condition Zero

An illustrated tutorial about bots navigation meshes

Preface
As I can't make navigation files for my whole life, I would like to share my knowledge with navmesh creators, mappers, fans, retro-gamers, and other interested people like you maybe! ;)
I would like to precise that I learned navigation mesh editing by myself, with this guide as only resource. So I hope you will find this tutorial clear and informative. Feel free to leave a comment.

Before reading more, please read both links (by Glock18) to accommodate with basic navmesh edition commands:
How to Modify NAV Files
So you think Bots are stupid?

Table of contents:
Introduction
- What a navmesh is?
- How it works?
- How can I create a correct .nav file?

Part 1 - Common navmesh edition
1.1 - Finding and fixing bugs
1.1.1 - Remove unreachable areas
1.1.2 - Set crouch/jump markers
1.1.3 - Set no_jump/precise markers
1.1.4 - Connect and disconnect areas
1.1.5 - Ungenerated zones
1.2 - Optimize the navmesh
1.2.1 - Merge areas
1.2.2 - Decrease file size
1.3 - Add places names
1.4 - Test your navmesh

Part 2 - Special situations
2.1 - The bot ladder bug
2.2 - Water zones
2.3 - Unconnected ladders
2.4 - Doors
2.5 - Special stairs
2.6 - Special jumps
2.7 - Create sniper/hiding spots

Introduction
When I talk about CS bots, I refer to CZ bots and Z-Bots, not PoD bots!

- What a navmesh is?
A navmesh, contraction of navigation mesh, is a data structure that contains information used by an Artificial Intelligence to move in a 2D or 3D environment.
It is often represented by 2D rectangular or triangular polygons. A navmesh enable bots to "know" the map, that is to say what are walkable areas and routes to travel on a level, among others.
Most of games which have bots use a navigation mesh system, including for example:
Minecraft, Oblivion, Skyrim, Unity, Counter-Strike serie of course, and so on.

In Counter-Strike, the navmesh data is contained in .nav files, located in your czero/maps/ folder.

- How it works?
As a navmesh represents walkable space on a map, it allows the use of pathfinding algorithms, like Dijkstra and A*, to find all routes from a point to another. The game engine then selects a route according to specific criteria. Common criteria are the shortest, safest, and cheapest of the itinerary.
For example, if we need to defuse the planted bomb, a bot will take the shortest way, in order to save time. If he is wandering on the map, a bot will try to avoid dangerous paths. And if he needs to reach an objective without constraints, he will take the cheapest route.

Keep in mind that in Condition Zero, each nav area have a "cost" or a "weight", depending on the "Danger level" and the "Base area cost" of a nav zone.
Danger level increase when a teammate is killed near a nav area, and base cost increase with several markers, like "jump" ones.
When bots seem to wander or hunt enemies, they choose a random point on the navmesh, and move to it.
There is also other information in a .nav file, which are:
- Map objectives (bomb targets, hostages position, escape zone...)
- Encounter zones (Where T and CT teams will meet)
- Approach points (Where there is some danger, like intersections)
- And hiding/snipers points (green, red and purple lines)


- How can I create a correct .nav file?
If you just would like to create a simple correct navmesh, without have a headache or spend too much time, at least follow these steps:
1.1 - Finding and fixing bugs
1.2.2 - Decrease file size (for errors analyse)
1.3 - Add places names (not necessary, but very useful)

Part 1 - Common navmesh edition

Auto-generating process:
When you start a map which haven't got a .nav file for the first time with bots, the navmesh auto-generation process start. It may take a while, depending on the map size and complexity, but it is usually about 2-10 min.

Let's the game do his work, it will make you save a lot of time! Of course, if you want, you can create a navmesh from zero, but it will increase time needed to realize your .nav file.
It is easier to modify and existing buggy navigation mesh than create your own, and the amount of time needed to modify it is about 2-6 hours for a majority of maps.
To switch into navigation mesh edition mode, enter the console command "bot_nav_edit 1". Before editing the .nav, kick all bots with "bot_kick" command.
I advise that you save frequently your work during navmesh edition, every 10 min for example.

Binding keys:
I highly recommend that you create a config file to bind keys in order to ease your navmesh editing, it will make you save time.
Here you can find Micro-Storm binding keys: Easy Navigation Meshing Scripts
Here are my binding keys

1.1 - Finding and fixing bugs
1.1.1 - Remove unreachable areas
The first thing to do when you want to create a correct navmesh is to remove unreachable areas. So, I recommend that you roam the map looking for these zones, cut the nav at the limit ("bot_nav_split"), taking care that at most the white 3D cursor fit in the area when you are looking your feet. The white line shows where it will be splitted. If more of the area is in the unreachable zone, that mean the game will create snipers/hidding points that will be out of reach!
Then, you can delete unreachable zones ("bot_nav_delete"). If you can't see all areas to remove, restart the map and join as spectator to move freely.

Game engine doesn't show walls with special "Clip" texture as obstacles, so it will create navmesh in these zones. Be careful of fences, grids and handrails, because mappers usually use "Clip" walls with blocks using texture transparency. It is also used with model entities (.mdl files), to avoid players going through objects like trees, lamps and others.


1.1.2 - Set crouch/jump markers
Secondly, we will set several markers on areas, in order to say bots to jump or crouch correctly. Game often put crouch zones, represented with a diagonal line inside, where it is not needed. To check, crouch in the marked zone, and release the crouching key when you are under the lowest point. If you stay crouch, it means that the crouch marker is correctly set. Otherwise, you can remove it with "bot_nav_crouch" command. Use the same command to set the marker on zones you need to crouch.

Do the same with jump markers (with a cross inside, "bot_nav_jump" command), if you need to jump, bots will need too. Sometimes, auto generated areas size will not fit correctly with obstacles. In such case, you have 3 solutions:
- The zone is too complicated to be used by bots, so just delete concerned areas;
- This isn't an important zone, but you would like that bots can go in. Look at your feet when you are blocked and need to jump, and set the jump marker in this nav zone. Repeat the operation for all the path. You must avoid to set jump marker on 2 consecutive areas, because bots will give a very huge cost/weight for the route. Try to alternate between jump and normal area (normal -> jump -> normal -> jump -> normal...).
- The way is important, so you must create nav zones by yourself. Remove auto generated areas and see the 1.1.5 - Ungenerated zones section.


If you don't know what to do, unset all markers, and leave the zone as a normal one. When bots feel stuck, they try to jump and move randomly. Game also don't set jump markers to generate a sniper/hiding spot, if you find the spot useful or if there is no other spots near, you can leave it.

Note: You can see used markers in the chat zone, when you select/hover an area. It may be not easy to see areas with both crouch and jump markers set!

1.1.3 - Set no_jump/precise markers
Thirdly, you can avoid bots from taking fall damages with the "bot_nav_no_jump" command. A diamond mark is present in the center of no_jump areas. Put this marker on high places, like rooftops, highest crates, ramps, stairs, and ledges where bots will jump from.

Don't set the no_jump marker if the following area is a jump one, and the 3d cursor is in the no_jump zone when you look your feet. Otherwise, bots will no jump and get stuck.
You can also set a precise marker with "bot_nav_precise" console command. This will disable bots automatic obstacle avoidance, and may be useful on short paths.


1.1.4 - Connect and disconnect areas
Game automatically create connections between nav areas. Two-ways ones are represented by a cyan line, and one-way connections by a blue line. It may happen that game connect high areas to lower zones when there is a "Clip" block. Bots can stuck in fences, crates, or they can take many damages jumping to a ramp. Go in these zones like bots will do, to check if the connection is good. If not, disconnect areas by marking the first with "bot_nav_mark" command, select/hover the second one and type "bot_nav_disconnect".

On the contrary, if you want to add a connection, do the same but use "bot_nav_connect" at the end to create a one-way path. Process again inverting areas to create a two-way connection. You can also connect areas when there is not enough space left to create a new one. Bots will jump automatically when there is a sufficient high difference between 2 areas, but take care of no_jumps markers in such a situation.


1.1.5 - Ungenerated zones
Sometimes, auto generation system will not create navmesh in all places, and you must do it by yourself. When a nav area is missing between 2 existing ones, mark one of them, select the other an type "bot_nav_splice" to create a zone connecting them. If you need to connect this new area with others, use connect commands seen before.

When there isn't any generated area, create new ones placing the cursor on the ground, leaving the 3D cross space between obstacles, then enter "bot_nav_begin_area" to start, and "bot_nav_end_area" to finish. Note that created areas are a little smaller than this representation in light blue. Don't forget to connect these nav zones to others. You absolutely must avoid overlapping when you hand-create areas, otherwise, bots may be very confused!

If you need to adjust corner elevation of an area, mark this one, use the "bot_nav_corner_select" command to select a corner, shown by a short blue line, and use either "bot_nav_corner_lower" or "bot_nav_corner_raise" commands to adjust elevation.



1.2 - Optimize the navmesh
1.2.1 - Merge areas
Each navigation area is 568 bytes size, so when it is possible and if that don't break bots movements, I try to merge adjacent areas. Usually, game engine will make a lot of small zones when there is a little relief on the ground, stairs, or an object. But if bots can walk on, you can merge navs without problem. Try to keep the general shape. This operation may take a while on some maps, about 30% of the total time!

Note that I don't merge small areas when they are too close from an object (wall, crate, tree...). Thus, I can delete them easier if needed or if bots stuck in there.


1.2.2 - Decrease file size
When you finished to edit the navfile as you wanted, you must perform a navmesh analyse to remove errors that appear in console. These errors cause a game crash when a bot try to reach a deleted nav area, or a sniper/hiding spot.
- save the nav file with "bot_nav_save"
- restart the map with 1 bot
- before joining the game, type in console "bot_nav_analyse"
- join the game: the new navmesh will be analysed, errors will be removed, and the file size will decrease!

Tip: if you want to reduce more the size of a nav file, move the .nav in your czero_downloads folder before restarting the map, then after map analyse, an improved .nav will be created in czero folder.

1.3 - Add places names
A nice functionality added by bots is places names situated under the radar. Bots use these names in radio locations, and this is very interesting to add this tweak in your navmesh. To switch into place edit mode, use the "bot_nav_toggle_place_mode". Areas without name appear in red. Select a name with "bot_nav_use_place NAME". To see all available names, enter in console "bot_nav_use_place", or refer to the first steam guide of this tutorial.
Then, paint places by hovering them with "bot_nav_toggle_place_painting" switch command. Places with the current selected name are in green, and those with other names are in blue. You can use "bot_nav_place_pick" command to change the current used name by the one of the selected area.

When you have finished, don't forget to save the nav file. After, restart the map in spectator mode, switch in normal edit mode, and use "bot_nav_mark_unnamed" and "bot_nav_warp" commands to see unnamed areas. Only one nav area is marked, so repeat as many times needed. Give them names, or delete them if they are out of the map.
Save the navmesh at the end, and perform a "bot_nav_analyse" if you deleted some areas to remove errors.

1.4 - Test your navmesh
It is very important to try your nav BEFORE posting it. It enables you to find some bugs you missed, and if your fix are functional. Play about 20 rounds with bots is a good mean to check for bugs. Be particulary attentive about bots stuck zones and suicide zones, maybe you forget something.
If you would like to check how a bot move to a specific nav area, you can use these commands:
Enter "bot_zombie 1" to make bots your slaves, they will now only follow your orders ;)
Select an area you want that the bot goes to using "bot_nav_mark".
Then, type "bot_goto_mark", and a bot will reach your marked zone. When the bot stuck while reaching the marked area, he stops. So you need to re-enter the command, but it is not a problem unless you type the command more than 5-10 times. In this case, it may be useful to fix the concerned zone.

Sometimes, you need to see the real bot behavior reaching a nav area. Personally, I run a game, join the T team, and add bots only on T side ("bot_add_t"), I get the bomb by killing the carrier, and then I drop the bomb on the nav zone I would like to check.


Part 2 - Special situations

2.1 - The bot ladder bug
Here we are, the famous "Bot ladder bug". Game engine automatically generates ladders for bots, and when a wall is not present behind the func_ladder, it creates a path for bots on the wrong side. It is very difficult to fix without removing completely ladder path, and bots will not use the ladder at all. To see it, type "bot_nav_edit 1" in console, bot ladder path is drawn by a blue line.
However, some approaches exist to try fixing this bug, but they are not perfect. Personally, I use the one where you create an area at the ladder's bottom, in such a way that the blue line that clings to the navmesh is oriented to the face that bots must climb. To do this, the center of the newly created area must be nearest, or in front of the grip face represented by a purple line.

You can find more alternative methods on the Sand Storm Z-Bots ladder guide.

2.2 - Water zones
Bots don't know how to swim in water, and usually drown. Well, it is preferable to restrict access to these zones if possible. In case they aren't under water when crouched, you can process as if there was no water.

2.3 - Unconnected ladders
It may happen that a ladder is not connected to the navmesh, because nav zones are too far from the top or the bottom. Try to create an area nearest to the ladder, and connect this new one to the existing navmesh.

In some rare cases, you will need to create a zone at the ladder's bottom, and raise the area to the top.
Just save the .nav file, and reload the map to check if game created new ladder connections.

Note: You can't connect ladders by the middle.

2.4 - Doors
Bots sometimes get stuck in doors, when they are open and block the bots route. To fix this problem, cut area and remove the occupied space by the door on the navmesh. Thus, bots will avoid the opened door.


2.5 - Special stairs
Corner stairs are more complicated than straight ones. First, make bigger zones by merging little areas. Then, fix elevation level with commands seen in 1.1.5 - Ungenerated zones. And finally, don't forget to re-create one-way connections at the end.

If bots fall from stairs because they try to take a shortcut in an 90° angle, you can establish a rising and a falling direction. Place the descending direction on the side of the 90° angle.


2.6 - Special jumps
When you placed a jump area near a no_jump one, bots will not jump correctly if the area is not under their feet. In a such case, you must increase the area size. Create a new temporary larger zone with some space in front of the jump nav you want to extend, delete the jump area, and then create a new one using "bot_nav_splice" between the temporary created and the one you want to connect. After remove the temporary zone, and connect your jump area to the navmesh.

If you make a jump zone go through a hole, take care that the area start before the hole and end after.


2.7 - Create sniper/hiding spots
You can force the game to generate spots by splitting and disconnect them from one or more side. You can also create small zones yourself if there is enough space left.


Sign up to access this!

Posts

  • Can u make the classic inferno map nav? Make the nav using the (nos) version of the map. The map wap was made by Logitechh. Bots tried to jump over the fence on ct spawn when bomb is planted. Fix it plz. Make them ignore to jump on fence and just move on. And can u plz fix Overpass map by tatu eugen too? Sometimes bot cant defuse the bomb at B because they are stuck beacause of the wooden plank thing. Thx bro
    Bananite
    URL to post:

Embed

Share banner
Image URL
HTML embed code
BB embed code
Markdown embed code

Credits

Key Authors
Tigre11ify
Tigre11ify Joined 1y ago
Offline
4,708 points Ranked 1100th
11 medals 1 legendary 1 rare
  • Submitted 50 Gamefiles Medal icon
  • Submitted 20 Gamefiles Medal icon
  • Submitted 5 Gamefiles Medal icon
  • One month a member Medal icon
  • Received thanks 5 times Medal icon
  • Reached 1,000 Points Medal icon
Navmesh editor

Submitter

Tigre11ify avatar
Tigre11ify Joined 1y ago
Offline
4,708 points Ranked 1100th
11 medals 1 legendary 1 rare
  • Submitted 50 Gamefiles Medal icon
  • Submitted 20 Gamefiles Medal icon
  • Submitted 5 Gamefiles Medal icon
  • One month a member Medal icon
  • Received thanks 5 times Medal icon
  • Reached 1,000 Points Medal icon

Tigre11ify
Creator
  • Paypal Donate
Sign up to access this!
Sign up to access this!
Sign up to access this!

Game

Sign up to access this!

Category

Details

Difficulty Level
Intermediate

Attributes

Share

  • Share on Reddit
  • Share on Twitter
  • Share on Facebook
  • Share on Google+

Stats

  • 134 Views
  • 2 Posts
  • 19dSubmitted
  • 17dModified

Scores

90 bScore
10 Rating

1 voter

Sign up to access this!

WiPs by Submitter

More Other/Misc Tutorials

bcp.crwdcntrl.net tracking pixel