Navmesh Creation and Editing - nZombies-Time/nZombies-Rezzurrection GitHub Wiki

Introduction

What is a navmesh and why do i need it?

A Navigation Mesh represents the "walk-able areas" of a map. This data is required by Bots [...] 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.

Source: https://developer.valvesoftware.com/wiki/Navigation_Meshes

The zombies in the gamemode use the same system, so i recommend reading the linked article as an introduction.

Navmesh creation

To create a navmesh you can press the generate navmesh button in the settings drop-down of the F1 menu. This will trigger an auto generation. The generation takes some time depending on map size and your PC specs, so be patient even if your gMod is not responding (It's a performance hungry operation). Once the generation is finished the map will be reloaded automatically. You can test if the generation was successful, by entering nav_edit 1 in your console, if you see colored squares on the ground the generation was successful. Those colored squares a called Nav areas, and represent a walk-able space, that means the zombies can move everywhere those areas are present.

The auto generated navmesh is enough to make the zombies move, but since its auto generated it will have some issues. Read the following sections to learn who to resolve those issues.

Navmesh Editing

It's highly recommended to apply the information of the following sections to your navmesh, to lower the chance of zombies getting stuck.

First of all make sure that nav_edit is set to 1 or you won't be able to see your changes.

Blocked areas

Sometimes the auto generation will generate areas under objects and therefore marks them as walk-able for bots even though they can't walk through the object. Once again you need to delete this areas and leave a clear space around those objects so bots can evade them. Most often you will see this at corners of rails.

You will need to remove those areas by using the nav_delete command in console or by choosing the delete mode on the nav editor tool (Tool Page)

Examples:

Example 1 Fences/Rails: blocked_1 blocked_1_after

Example 2 Poles: blocked_2 blocked_2_after

Unreachable areas

There will be some areas on top of objects or walls that are not reachable by bots (and players), they should be removed by using nav_delete or the delete mode in the nav editor.

Examples:

Example 1 Boxes: unreach_1 unreach_1_after

Advanced Editing

Attributes

There are several attributes that can be applied to single nav areas, that will have impact on the zombies behaviour. While there are many attributes you can set on nav areas the following sections will only list those that have impact on zombies.

Jumping

While zombies have a build in jumping logic, that enables them to do basic jumping. This logic can fail sometimes especially on difficult(very high jumps). You can improve this behavior by setting the NAV_MESH_JUMP attribute on a navmesh area. To do that look at the mesh in nav edit mode and use the nav_jump command. If you want to remove the attribute you can use the nav_no_jump command.

Zombies that enter a nav area with the jump attribute set will jump immediately on entering.

Example:

Example

A Zombie entering the crossed area from the ground would jump on top of the boat. A zombie entering the navmesh from on top of the boat would not jump down. That means those jumps only work in one direction(up) unless the area is not on flat ground (height change is 0). So if you want a zombie to jump all directions the navmesh must be placed on flat ground, so that every adjacent mesh is on the same level.