Introduction to AI: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
 
m (Nesciuse moved page Introduction to AI/en to Introduction to AI without leaving a redirect: Move en subpage to basepage)
 
(33 intermediate revisions by 16 users not shown)
Line 1: Line 1:
Simply place an AI controlled entity into a map and it will have a good chunk of it's features in place without any other actions. Place some info_node entities too and you've got fully functional AI characters who will use your map to hide, flank, flush out and assault. On top of this basic framework comes scripted and semi-scripted behaviour to add extra punch. In many situations, that's all you have to do!
{{LanguageBar}}


==info_node==
Create an interesting map, place some AI entities in it, and run it. Don't kill them straight away but turn on mat_wireframe and watch their actions as you move around. You'll see them, more or less, run straight at you and shoot. This is because they have no bearings in the world other than your position.


Leave the game and lay down info_node entities across the map (what is the optimum density?) then recompile and do the same as last time. You should now see them group and attack together if they need to, seek cover, throw grenades at far more suitable times, try to get around you and more - all because you added a few nodes.


[http://www.btinternet.com/~varsity_uk/VDC/Source_AI/info_node_demo.zip Example map (VMF)]
AI stands for [[Wikipedia:Artificial Intelligence|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.


This alone has fully set up your AI for a map.
==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.
===[[info_node|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_node]]s are required for enemies on the ground, and [[info_node_air]]s are required for enemies that fly.


==path_corner==
===[[path_corner|Path_corners]]===
There are two ways to forcibly move AI: through path_corner entities or choreography. Choreography goes beyond the scope of this document and will be ignored. We shall instead focus on path_corners, which are simple: make one, name it, then shift+drag it to create the next path_corner in the chain.  
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, [[Police_stander|a metrocop guarding a doorway]].
===[[info_hint|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|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.
===[[Squads|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.


To manually make a chain (or link one up in a circle), edit the 'Next stop target' property. Note that the 'Train Speed' values are obsolete unless you are making a path for a func_train.
===Miscellaneous===
Other components including relationships, speech, and more.


Once you have the path laid out, go to your AI entity and set 'Target Path Corner' to the path_corner you want it to enter at.
==General AI Events==
 
{{todo|Research events.}}
[http://www.btinternet.com/~varsity_uk/VDC/Source_AI/apc_drive.zip Example map (VMF)]
 
Note that the example map does not have any info_nodes. They are not needed to have AI follow a path.


[[Category:AI]]
[[Category:AI]]

Latest revision as of 07:38, 12 July 2024

English (en)Deutsch (de)Русский (ru)中文 (zh)Translate (Translate)


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

Todo: Research events.