AIN

From Valve Developer Community
Jump to: navigation, search
English (en)
Edit

Stub

This article or section is a stub. You can help by adding to it.

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];