Skip to main content

Module detour

Module detour 

Source
Expand description

The DayZ .nm navmesh set file and its Detour tile layout (spec 8.1, 9 and 7.2).

A .nm file (NavMeshSet) is a header, an offset table and tile records. Each record holds one Detour tile blob (TileData): standard Detour tile data (version 12, 64-bit polygon refs) with a 4-byte header extension, 44-byte off-mesh connections and a trailing extra section (TileExtra). All integers and floats are little-endian.

Every reader treats its input as hostile: counts are checked with checked arithmetic against the bytes available before anything is allocated, and errors are returned instead of panics.

Structs§

BvNode
A dtBVNode (16 bytes).
CreateParams
The inputs of create_tile_data, mirroring dtNavMeshCreateParams.
Link
A dtLink (16 bytes).
MeshHeader
The 104-byte dtMeshHeader of a tile (spec 9.3).
NavMesh
A tiled Detour navigation mesh (dtNavMesh) with 64-bit polygon references: salt 16 bits, tile 28 bits, polygon 20 bits (spec 8.1).
NavMeshParams
dtNavMeshParams as stored in the set header.
NavMeshSet
A .nm file: the mesh parameters and the tile records in file order.
Obstacle
A tree obstacle of the extra section (16 bytes).
OffMeshConnection
A DayZ dtOffMeshConnection (44 bytes).
OffMeshInput
One off-mesh connection of the input (a jump, climb or ladder link).
Poly
A dtPoly (32 bytes).
SetTile
One tile record of a set file (spec 9.2).
TileData
The sections of one Detour tile blob, in file order (spec 9.3).
TileExtra
The extra section of a tile blob (spec 7.2).
TilePart
A TilePart of the extra section: one object part (16 bytes).
TilePartPoly
A TilePartPoly of the extra section (8 bytes).

Constants§

NAVMESH_MAGIC
The tile magic 'DNAV'; the stored bytes are VAND.
NAVMESH_VERSION
The Detour tile version DayZ uses.
SET_MAGIC
The set file magic: the bytes TESM.
SET_VERSION
The set version DayZ 1.30 accepts; the only one written.
SET_VERSION_OLD
The set version of DayZ 1.29 and earlier. Same layout; accepted when reading.

Functions§

create_tile_data
Builds one Detour tile (version 12) from a poly mesh, the DayZ way (spec 7.3).
decode_poly_ref
Splits a polygon reference into (salt, tile, poly).
encode_poly_ref
Packs a 64-bit polygon reference: salt << 48 | tile << 20 | poly (16, 28 and 20 bits; wider values are masked).
find_nearest_poly
dtNavMeshQuery::findNearestPoly: the polygon of the mesh nearest to center within the box center plus or minus half_extents, and the nearest point on it.