Introduction to AI

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

AI stands for Artificial Intelligence and controls the behavior of all but the simplest of NPC actions in the Source engine. Regardless of how easily you might have torn through the Combine it won't be long after you start working with Source's AI that you recognise its power, intelligence and flexibility. This introductory guide will give you a brief overview of the AI from the implementation perspective. Please be aware that there is currently no official AI documentation: nearly everything you see in this category was researched and written by the community. This means mistakes and omissions are inevitable.

Map Components

The following are all entities or groups of entities a level designer might place in a map to manipulate the AI. A map doesn’t require any of them for the AI to function, but the more the better.

Nodes

These give the AI bearing in the world besides other NPCs or the player. They are required for all but the simplest of AI actions. When combined, these nodes form a node graph and act as a "roadmap" for NPCs. Info_nodes are required for enemies on the ground, and info_node_airs are required for enemies that fly.

Path_corners

The most direct way of influencing AI is through the path_corner entity. It bluntly instructs the NPC to go to it, and they do so in the most direct manner possible.

Goals

Goals give the AI a task to fulfill in a semi-scripted manner. For example, a metrocop guarding a doorway.

Hints

Hints give AI contextual pointers that it would not be able to work out on it’s own: areas safe to crouch and reload, objects of interest, or even places for birds to perch.

Assaults

Assaults are the less scripted and combat orientated sisters of path_corners. Use them to move NPCs while retaining their tactical routines.

Standoffs (Battle Lines)

Standoffs give AI the specific instruction to fight hostiles. When in a standoff, NPCs will cooperate in holding certain areas while advancing into others. Standoffs are a method of battle management for Source games.

Squad Name

Organize your NPCs into squads for increased efficiency and teamwork. Squads will share information on their surroundings and take turns covering each other. Applied to each individual npc entity under class info.

Miscellaneous

Other components including relationships, speech, and more.

General AI Events

Blank image.pngTodo: Research events.