Infantry NavMesh Generation for Vertical Ladders

Overview

This article outlines the principles behind NavMesh generation for vertical ladders and discusses common errors that prevent NavMesh from being generated for ladders.

Warning

Vertical ladders are often problematic for gameplay. Think carefully before adding them to a level. However, if there is no alternative, please review this article and consider the important nuances of designing ladders from the perspective of AI navigation.

How NavMesh Generation for Vertical Ladders Works

The pathfinding for vertical ladders functions as follows. Each ladder has a gameObj file like ladder_template.gameObj.blk, which contains:

  • volumeType:t="box" – The type of primitive displayed in daEditor.

  • boxSz:r=0.5 – The size of the base primitive.

  • isLadder:b=yes – A flag indicating that this is a ladder.

  • ladderStepsCount:i=13 – The number of steps on the ladder.

This gameObj is used to describe the geometry of the ladder along which a character can climb vertically.

Example of a composite object: ladder geometry + its gameObj:

../../../_images/navmesh_gen_vert_ladders_01.jpg

During NavMesh generation in the location, each such gameObj is identified, and the zones near the ends of the gameObj are analyzed: if there are NavMesh polygons within a radius of <0.5m from the ends of the gameObj, a link is created between the polygons through the vertical ladder.

This link is used by AI for pathfinding across NavMesh through vertical ladders.

Examples of NavMesh link generation through vertical ladders:

Conditions met Conditions not met
../../../_images/navmesh_gen_vert_ladders_02.jpg ../../../_images/navmesh_gen_vert_ladders_03.jpg

Common Design Errors for Vertical Ladders

Let’s examine design errors that prevent link generation. These are typically specific cases where the conditions for NavMesh generation are not met. To create a NavMesh link through a vertical ladder, NavMesh polygons must be generated within a radius of <0.5m from the ends of the gameObj.

Incorrect Ladder GameObj

The gameObj dimensions prevent the link from being generated.

Problem Solution
The gameObj has insufficient dimensions to meet the conditions for link generation. Adjust the dimensions of the gameObj or set up a proper composite object with a gameObj that satisfies the link generation conditions.
Scheme Example
../../../_images/navmesh_gen_vert_ladders_05.jpg ../../../_images/navmesh_gen_vert_ladders_04.jpg
Problem Solution
The gameObj has excessive dimensions, preventing the conditions for link generation from being met. Adjust the dimensions of the gameObj or set up a proper composite object with a gameObj that satisfies the link generation conditions.
Scheme Example
../../../_images/navmesh_gen_vert_ladders_07.jpg ../../../_images/navmesh_gen_vert_ladders_06.jpg
Problem Solution
Two ladder composite objects with gameObjs are placed consecutively. Since there is no NavMesh at the junction of the gameObjs, the link cannot be generated. Only one gameObj should be used per ladder segment.
Scheme Example
../../../_images/navmesh_gen_vert_ladders_09.jpg ../../../_images/navmesh_gen_vert_ladders_08.jpg

Problematic Ladder Geometry

The ladder geometry prevents the NavMesh generation conditions from being met.

Problem Solution
The ladder has additional structural elements that obstruct NavMesh generation at the necessary distance to meet the link conditions. To resolve this, experiment with the design – solutions vary depending on the ladder and the adjacent platform. In some cases, moving the elements is enough, while in others, the ladder geometry must be modified or replaced.
Scheme Example
../../../_images/navmesh_gen_vert_ladders_10.jpg

Problematic Environment Geometry

The ladder leads to a location where NavMesh cannot be generated.

Problem Solution
Obstacles block access to the ladder, or other geometry obstructs NavMesh generation. It is important to clear the path to the ladder so that NavMesh can be generated nearby. Technically, obstacles do not prevent link generation, but the path will remain blocked for AI until the obstacles are destroyed.
Scheme Example
../../../_images/navmesh_gen_vert_ladders_12.jpg ../../../_images/navmesh_gen_vert_ladders_11.jpg
Problem Solution
There isn't enough ceiling height for the attic floor to be suitable for NavMesh generation. This is often a geometry issue, so it's important to plan for sufficient ceiling height in advance. Incorrect NavMesh generation settings could also be the issue, such as setting the minimum ceiling height too low for NavMesh generation.
Scheme Example
../../../_images/navmesh_gen_vert_ladders_14.jpg ../../../_images/navmesh_gen_vert_ladders_13.jpg
Problem Solution
Complex geometry on steep slopes is unsuitable for NavMesh generation. This is generally a geometry issue, so during the blocking phase, make sure the geometry along paths is suitable for NavMesh generation. Incorrect NavMesh settings, such as an overly restricted slope angle, may also be the cause.
Scheme Example
../../../_images/navmesh_gen_vert_ladders_16.jpg ../../../_images/navmesh_gen_vert_ladders_15.jpg
Problem Solution
No NavMesh is available for link generation. The ladder is placed so that the player can climb it and clear a railing, but for link generation, NavMesh polygons are required. NavMesh does not generate on railings due to their size, and the end of the gameObj is too far from the nearest NavMesh polygons. The solution is to ensure the ladder leads to a properly generated NavMesh polygon. In this case, remove the railing or adjust the ladder length appropriately.
Scheme Example
../../../_images/navmesh_gen_vert_ladders_18.jpg ../../../_images/navmesh_gen_vert_ladders_17.jpg
Problem Solution
NavMesh will not generate in water deeper than 2m, which prevents the creation of a link. The water depth needs to be reduced.
Scheme Example
../../../_images/navmesh_gen_vert_ladders_20.jpg ../../../_images/navmesh_gen_vert_ladders_19.jpg

Code Limitations

Cases not supported by the code:

Problem Solution
Links cannot be generated for intermediate platforms. The code does not account for intermediate platforms along the ladder's path. Each platform must have its own ladder for AI navigation. However, since an overabundance of vertical ladders is undesirable, plan more convenient paths in advance. In this case, you can keep the vertical ladder for climbing to the middle level and create ramp-like geometry for reaching the top level.
Scheme Example
../../../_images/navmesh_gen_vert_ladders_21.jpg