Difference between revisions of "Source AI"

From Valve Developer Community
Jump to: navigation, search
(Added info_node example, some corrections)
(Redirect to the new category)
 
Line 1: Line 1:
This document will provide an overview of how to implement and manage AI in your Source game or map.
+
#REDIRECT [[:Category:AI]]
 
 
==Introduction==
 
AI stands for Artificial Intelligence ([http://en.wikipedia.org/wiki/Artificial_intelligence Wikipedia]) and controls the behaviour of all but the simplest of NPC actions. Source's AI is not to be confused with Half-Life 2's implementation of it: it is very powerful and very clever. 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.
 
 
 
==Basics: 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)]
 
 
 
This alone has fully set up your AI for a map. There's far more to it than that, though.
 
 
 
==Moving AI: path_corner==
 
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.
 
 
 
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.
 
 
 
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.
 
 
 
[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.
 
 
 
==More soon==
 
More soon...
 

Latest revision as of 13:47, 29 June 2005

Redirect to: