Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:Source Navigation Mesh (NAV)

From ReverseEngineering.wiki
Format
Developer Valve
Magic CE FA ED FE (u32 0xFEEDFACE, little-endian)
Extensions .nav
Endianness little
On this wiki Facts · Code · Notes · Topics

Binary navigation mesh written next to a Source engine map (maps/<map>.nav), magic 0xFEEDFACE. Areas are axis-aligned quads with per-direction adjacency, hiding spots, encounter paths, place names, ladders and (in Left 4 Dead 2) Director spawn attributes and a potentially-visible-area list.

Layout (Left 4 Dead 2: version 16, subversion 14)

All integers little-endian; coordinates are f32 Source units (x, y, z with z up).

Header

Field Type Notes
magic u32 0xFEEDFACE
version u32 16
subversion u32 14 in L4D2
bsp_size u32 size of the BSP the mesh was built for
analyzed u8 0/1
place_count u16 followed by place_count entries of (u16 length, then length bytes including the NUL)
has_unnamed_areas u8 0/1
nav name (L4D2) NUL-terminated string "default" in retail files
unknown (L4D2) u16 0 in every retail file checked
area_count u32 number of area records that follow

Area record

Field Type Notes
id u32 nonzero
attribute_flags u32 NavAttributeType (crouch, jump, ...)
nw_corner 3 x f32
se_corner 3 x f32
ne_z, sw_z 2 x f32 heights of the other two corners
adjacency 4 x (u32 count, count x u32 area id) north, east, south, west
hiding spots u8 count, 17 bytes each u32 id, 3 x f32 position, u8 flags
encounter paths u32 count; each 10 bytes, then u8 n and n x 5 bytes from/to area ids and directions, then spot id + timing byte
place index u16 0 = none
ladder ids 2 x (u32 count, count x u32) up, down
occupy times 2 x f32 one per team
light intensity 4 x f32 one per corner
spawn attributes (L4D2) u32, then u16 Director flags, see below
visible areas u32 count, count x (u32 id, u8 attributes) may reference ids that no longer exist after area edits
inherit visibility from u32 area id or 0

Ladders and trailer

After the areas comes u32 ladder_count, then one record per ladder:

Field Type Notes
id u32 nonzero
width f32
top 3 x f32
bottom 3 x f32
length f32
direction u32 0..3
top areas 4 x u32 forward, left, right, behind
bottom area u32

The file ends with one more u32.

L4D2 spawn attribute bits

Conventional names; the values were checked by drawing them over retail maps, where saferoom areas carry CHECKPOINT and finale arenas carry FINALE.

Bit Name
0x2 EMPTY
0x4 STOP_SCAN
0x20 BATTLESTATION
0x40 FINALE
0x80 PLAYER_START
0x100 BATTLEFIELD
0x200 IGNORE_VISIBILITY
0x400 NOT_CLEARABLE
0x800 CHECKPOINT
0x1000 OBSCURED
0x2000 NO_MOBS
0x4000 THREAT
0x8000 RESCUE_VEHICLE
0x10000 RESCUE_CLOSET
0x20000 ESCAPE_ROUTE
0x40000 DESTROYED_DOOR
0x80000 NOTHREAT
0x100000 LYINGDOWN

Pitfall: NO_MOBS and the other Director bits are in this spawn-attribute field, not in attribute_flags; bit 0x2000 of attribute_flags is a different engine flag.

How to verify

A reader that follows this layout consumes every byte of the retail L4D2 maps/*.nav files of exe build 10097 (24 in the client install, 25 in the dedicated server install, all v16/14) with no trailing data, and the ladder total across them is 990.

Observed in