Give the AI a place to roam free.
Lets set up a simple box level to test these things out.
First thing we need is an AI Volume, a few AIPatrol Nodes and an
AIMarine (cause they're our heroes)
AI Volumes
Most of the AI must have an AI Volume to function within. This basically tells the AI where they can go. This is most important,
don't have AI volumes intersect with geometry. As a general rule keep
them 16 units away from crates, walls, fixtures. This will protect them
from getting stuck on walls and things. And AI volumes should not pass
through walls and geometry like doors or vehicles, otherwise you can
find yourself looking at a AI trying to run through a closed door and
getting stuck. There is a method to remedy this and we'll look at it.
Now.
The AI Volume is textured with an AI texture, purely for
recognition purposes, so when you look at the brush in Dedit you know
its an AI Volume. Bind the brush to a volume, standard
MARKERTOSELECTION, centre the object in the brush. All the stuff we
already know, because of standard mapping practices. (oh you're one of
the guys that jumped straight to this section, well you'll have play a
quick game of catch up cause I'm not gonna stoonfeed yah)
First thing you notice about the AIVolume, its away from
the wall at least 16 units. Save yourself any chance for grief and the
potential for your AI to to clip and get snagged on the geometry by
controlling their movement with the volume.
AI Nodes
Nodes are more specific points within AI Volumes that give
specific purpose to the AI. So in this scenario we'll add four 4 AINodes
and we'll choose the patrol nodes from the other options like
AICOVERNODE, AI SNIPE NODE, AI PATROL NODE, AI ALARM NODE. So we have
one patrol node in each corner. Simple enough. Well we want to relate
these nodes to eachother, and in the process create a path. The Nodes
Objects have this options.
By linking each of the nodes you create a path. At each
node you can give the AI a message. It can be a script, it can be
something more random. You could even set up an explosion that blows
him up when he gets there. The choice is yours. Its your level.
In our particular case, I'm just setting him up to loop
around the four nodes. So Well set Circular=TRUE. Note that it
defaults to False. You should set cycle or circular accordingly. And
you should figure they are mutually exclusive. We want him stopping at
every node for four seconds, so we'll add 4.00 in the wait time
field. Shugi will stop, wait, and then proceed on the patrol.
AI Character
The AI Chracter himself is important to the process as
well. He has to be set to behave the way we expect him to. Let's make
our AI Shugi, by scrolling through the availbale options.
Ignore all the extra names, they're character in the LAST
ONE OUT Expansion pack and are only one our computers so you wont have
them.
First thing you want to make sure of, is that your AI has a
weapon. AI's behave differently if they are armed. The default
setting for all Marines is the PULSERIFLE as PrimaryWeapon, which is
fine. Change it if you want. Just scroll and change.
The other thing you want to make sure of is that the AI is
set to ACTIVE =TRUE . You could easily set this AI to Active=FALSE,
and then set up a trigger in the level with the message;
msg shugi (active 1)
That would set this AI active. Sometimes you don't want all
your AI active at the start of a level. For example the AIBOSS near
the exit only needs to be activated as you approach that area. This way
the AI isn't taking up precious processing time in game until its
necessary.
In our case here, shugi will be patrolling when the level starts.
We will have to set a GOAL. AI work with goals in mind.
These are broad subsets, you simply scroll through the list an assign
goals to your AI. Al AI default to the GOALS of ATTACK and INVESTIGATE.
Shugi in this case, will be a Patrolling guard. If he
notices something, he will investigate. If he spots an enemy he will
engage and attack.
If you ran the level, using the default setup, and a
GAMESTARTPOINT with Harrison, you will watch Shugi make his arounds,
and avoid(walkaround you) as he continues through his duties. The
player (you) as Harrison, is an ALLY, so the investigate and ATTACK
goals don't apply. AI's react primarily to threat. If they see an
enemy or hear an ALLY's death or Damage they react.
I could suggest you change to Corporate or one of the
species, and see how the interaction changes. You might want to
increase the size of the level first.
These are just the basics. AI is a huge field of endevour and getting larger
AI is quickly becoming the most interesting part of Game
design. There are entire volumes on how these artificial intelligence
characters interact with the confines of a game. Good luck learning.
I will add this special case.
AI ALARM NODE
Place the AINodeAlarm object at the location that you want
the AI to run to when the AI sees the player. Place the Alarm object
somewhere nearby. Set up the AINodeAlarm to trigger the Alarm object
with the ON message. On the alarm object use the browse button to set up
the alarm sound to use.