NAV (file format): Difference between revisions
Jump to navigation
Jump to search

Tip:NAV creation is an open-source task available in the SDK.
Note:This is reverse engineered data. Reverse engineered format code can also be found here.
m (Added lang, and minor changes.) |
(Cleaned up page.) |
||
Line 1: | Line 1: | ||
{{lang|NAV}} | {{lang|NAV}} | ||
{{ | {{back|Nav Mesh}} | ||
{{ | {{distinguish|AIN}} | ||
A '''NAV''' file is a map specific [[ | A '''NAV''' file is a map specific [[Nav Mesh|'''<u>Nav</u>'''igation Mesh]] file that defines the walkable space in a level for [[bot]]s in [[Source]] games. They usually reside in <code><game folder>/maps</code> and can be integrated into [[BSP|BSPs]] in some [[Source]] games.{{clarify}} | ||
<br /><br /> | |||
In {{game name|css|name=Counter-Strike: Source}} and {{game name|csgo|name=Counter-Strike: Global Offensive}}, the file is generated automatically when bots are played for the first time on a specific map. | |||
{{tip|NAV creation is an open-source task available in the SDK.}} | |||
NAV creation is an open-source task available in the SDK. | |||
== File format == | == File format == | ||
{{ | {{note|This is reverse engineered data. Reverse engineered format code can also be found [https://github.com/mrazza/gonav/blob/master/parser.go here].}} | ||
{{ExpandBox|<source lang="cpp"> | |||
{{ExpandBox| | |||
<source lang="cpp"> | |||
unsigned int magicNumber; // Magic number to check if the file is a .nav file | unsigned int magicNumber; // Magic number to check if the file is a .nav file | ||
unsigned int version; // Version of the .nav file, for example GMod and TF2 has 16 | unsigned int version; // Version of the .nav file, for example GMod and TF2 has 16 | ||
Line 97: | Line 90: | ||
==See also== | ==See also== | ||
* [[Nav Mesh Editing]] | * [[Nav Mesh Editing]] | ||
* [https://github.com/mrazza/gonav Nav file parser in Go] | * [https://github.com/mrazza/gonav Nav file parser in Go.] | ||
* [https://github.com/Blackfire62/TF2_NavFile_Reader Nav | * [https://github.com/Blackfire62/TF2_NavFile_Reader Nav file parser in C++.] | ||
[[Category:Level Design]] | [[Category:Level Design]] |
Revision as of 07:19, 16 September 2021


Not to be confused with AIN.
A NAV file is a map specific Navigation Mesh file that defines the walkable space in a level for bots in Source games. They usually reside in <game folder>/maps
and can be integrated into BSPs in some Source games.[Clarify]
In Template:Game name and Template:Game name, the file is generated automatically when bots are played for the first time on a specific map.

File format

unsigned int magicNumber; // Magic number to check if the file is a .nav file
unsigned int version; // Version of the .nav file, for example GMod and TF2 has 16
if ( version >= 10 ) {
unsigned int subVersion; // Sub version of the .nav file, for example GMod has 0, TF2 has 2. This is usedt
}
if ( version >= 4 ) {
unsigned int saveBspSize; // Size of source bsp file to verify that the bsp hasn't changed
}
if ( version >= 14 ) {
unsigned char isAnalyzed;
}
if ( version >= 5 ) {
// Places data. This is the "Mid", "Banana", etc stuff that is used in this nav mesh
unsigned short count;
for( int i = 0; i < count; ++i ) {
unsigned short len; // length of the name
char name[len]; // The name. Maximum len is 256
}
if ( version > 11 ) {
unsigned char m_hasUnnamedAreas;
}
}
{
// Load custom data pre area
// This is by default is completely unused, it is left for mods to store custom data
}
unsigned int count; // number of CNavAreas
{
// PreLoadAreas( count )
// This is by default is completely unused, it is left for mods to store custom data
// Assuming that the data is per nav area
//for( int i = 0; i < count; ++i ) {
//}
}
for( i = 0; i < count; ++i ) {
// Per CNavArea data
unsigned int id; // ID of the CNavArea
// Attribute flags
if ( version <= 8 ) {
unsigned char attributeFlags;
} else if ( version < 13 ) {
unsigned short attributeFlags;
} else {
int attributeFlags;
}
Vector m_nwCorner; // size is 3 * float(x,y,z), North-West corner of the area
Vector m_seCorner; // size is 3 * float(x,y,z), South-East corner of the area
// More data...
}
if ( version >= 6 ) {
unsigned int count; // number of CNavAreas
for( i = 0; i < count; ++i ) {
// Ladder data
}
}
{
// Load Custom Data
// Again, by default this is unused
}