Introduction to AI

From Valve Developer Community
Revision as of 13:46, 29 June 2005 by Tom Edwards (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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!

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.

Example map (VMF)

This alone has fully set up your AI for a map.

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.

Example map (VMF)

Note that the example map does not have any info_nodes. They are not needed to have AI follow a path.