AIN

From Valve Developer Community
Revision as of 12:28, 16 December 2018 by Donkie (talk | contribs) (Added nodetype table)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Not to be confused with ANI.

An AIN file is a nodegraph for Source engine games. It stores information relating to info_nodes and their proximity and visibility for use by the AI for movement around a map. AIN files are automatically generated by the game. If there is no existing AIN file specific to that map, or if it was generated for an older version of that map, the AIN file ( <MAP_NAME>.ain ) is generated by the game. The message "Node graph out of date. Rebuilding..." is printed to the screen when a build or rebuild is occurring.

The graph files are stored in the ..\<game>\maps\graphs directory.

File Format

Structs

struct ain_header // Probably incorrect header name
{
	int ainet_ver; // AI Net version
	int map_ver;   // Map version
};
struct ain_node // Probably incorrect header name
{
	Vector3 pos; // 3 floats (x, y, z)
	float yaw;
	float flOffsets[NUM_HULLS];
	byte nodeType;
	ushort nodeInfo;
	short zone;
};
struct ain_link // Probably incorrect header name
{
	short srcId;
	short destId;
	byte moves[NUM_HULLS];
};

NUM_HULLS is set to 10 for most maps tested.

These structs were based on AI Net version 37, might differ between games and versions.

Node types

Type Name
2 NODE_TYPE_GROUND
3 NODE_TYPE_AIR
4 NODE_TYPE_CLIMB
5 NODE_TYPE_WATER

File layout

ain_header header;
int numNodes;
ain_node nodes[numNodes];
int numLinks;
ain_link links[numLinks];
int lookup[numNodes];