Reposted for archiving purposes
AI Basics
What you've been waiting for. You can just drop AI into a map and it will practically work. The important thing to realize AI has two broad groups, allies and enemies. Allies wont attack you. AI without weapons wont attack you.
AI Basics
AI Volumes
AI Nodes
AI Goals
AI Characters
What you've been waiting for. You can just drop AI into a map and it will practically work. The important thing to realize AI has two broad groups, allies and enemies. Allies wont attack you. AI without weapons wont attack you.
This is a basic overview. As you study these terms in more detail it should all become more clear.
AI Volumes
Most of the AI must have an AI Volume to function within. This basically tells the AI where they can go. Thus AI vloumes should not pass through walls and geometry like crates and vehicles, cause then an AI will get stuck there.
AI Nodes
Nodes are more specific points within AI Volumes that give specific purpose to the AI.
Example: "At this point, you will crouch down and take cover from the player shooting at you"
AICOVERNODE is placed behind a crate,
AI SNIPE NODE
AI PATROL NODE
AI ALARM NODE
AI Goals
You would probably want AI to behave differently. Some may attack, while others take defensive positions and snipe from cover. You use goals within the AI's properties tab to differentiate and depending of the goals the AI use different Nodes. Conceptually pretty simple.
AI Characters
The actual Character choices influence the AI's behaviour as well. Most Corporates have a better interaction pattern then do the Marines in the original AvP2 game. That's because they were the enemy for the player, and coded. Most the Marines were merely used in Cut Scenes and there involvement was more scripted. Characters are given goals and brains and there are a multitude of options to make them quite interactive.
Why does AvP2 not have BOTS?
One its not coded in the source. The AI could actually behave like deathmatch bots, they already have significant interaction so it is possible, regardless what some un-educated people might say. AI's are coded to handle themselves fairly well with the existing code. Nonetheless they do need some tweaks. LAST ONE OUT has included a couple DEATHMATCH scenarios to prove that the AVP2 AI is quite capable of holding its own. Unfortunately without the source they can not be put into existing MP maps using some menu setup, but rather included in SP skirmish maps only.
AI Volumes and Nodes
AI texture
AI Volumes and outer shells
Volumes DO NOT pass through geometry
AI Volumes tell the AI where they can go. AI nodes tell the AI what to do when they get there.
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.
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.
Simple AI Aliens
Advantage, less processing requirments.
Easy to place. Idiot proof.
Have special coding for wall walking.
Simple AI Aliens, are special case AI that do not need an AI Volume to move around and target the player. They are not scriptable like other AI and are the most common in custom community maps cause they're basically idiot proof additions to maps. You place them, you let them go nuts, and they find the player eventually.
These are the easiest to place...
Toss one of these suckers into a map, give it the initial command of
trg player
and it will be on you like a 17 year old on a Friday night. This works for Simple_runner, simple_drone and simple_facehugger.
The problem with these simple AI, is they can't be scripted. They are one notch above the Active Props we have studied earlier. They just follow a straight line from their position to the Player. They take up very little processing in game, cause they are not really thinking and have very few options.
the only other command they respond to:
msg simpleAI47 REMOVE
which will get rid of it from the map.
The MULTISPAWNER can make good use of these pesky AIs in some situations. For example remember when Harrison went into the small hive to save HALL and then all hell broke loose when he had to escape, that overwhelming barrage of alien AI was probably Simple, coninuously being spawned by an MULTISPAWNER.
(The AI in AvP2 is infinitely suprerior to the simplistic AI from the first game which was basically a SIMPLEAI) the problem came in how it was utilized, not in the coding.
Character AI
Adding AI Characters
Creating a new Character
Misc Character Commands
This is starting to get nuts. . Most these things are not complicated. You can easily add objects to your level to increase the interest and interaction in your level. Its just a question of how much, and how complicated you want to make it.
Character AI put obstacles in your player's path.
You add all the AI Characters exactly the same way as described in the previous tutorial.
Here are some cool examples from Red Riot.
You can command an AI to do almost anything. Its just a question of the right command, and or script, and the proper set up of AI volumes and AI Nodes.
Perhap you have a sniper in a guard tower and he is targeting an enemy in the distance(not necessarily the player). But now suddenly there is a closer threat(the player). By default the AI will pick the nearest enemy AI within it's field of view unless its already engaged with a target. This target will remain until either the target is dead or the AI receives damange from another target or it receives another target message.But if this closer target (the player), simply walks by the AI he would be ignored, and the player will think thats a pretty stupid piece of AI coding.
Well there is a way to get the AI to target the closer enemy (player).
msg sniper27 ResetSense
This will cause the AIsniper in the guard tower to loose the distant target, and return to searching for new targets to acquire, and it will acquire the closer target (the player) if he sees him. A great potential stealth scenario, and apparently alot smarter. Of course the message would need to be triggered, perhaps with a player trigger as he gets within range or too close, or near a door, or a death message, or a weapons pickup.
You can easily teleport a Player across a map by using this simple command.
msg player (teleport teleportpoint)
or
msg player (teleportnr teleportpoint)
There is a difference between the two commands, teleportnr , (the nr is synonomous to no rotation) is a teleport with no rotation change, whereas teleport rotates the player to face the direction of the teleportpoint object as set in the properties rotation.
The destination point must be a teleport object. Thats just a requirement of the code. The teleport command can also works for character AI. You can quickly change the direction of an attack that way.
Modmaker's AI tutorial
jedwabna poszewka 50x60