Pacific Assault AI Documentation



Cover Nodes


To help make the AI look smart, we AI needs to take cover when in battle.  The AI relies on designers to place appropriate cover nodes around cover.  There are several cover node types that are used for different types of cover and each has its own set of animations.    When you place a cover node, have the node’s angles face it towards the wall, crate, tree, etc that we’re using for cover.


Cover nodes implemented thus far:

Info_cover_left – standing or crouched, shoots to the left of the cover

Info_cover_leftlow – crouched, shoots to the left of cover

Info_cover_right – standing or crouched, shoots to the right of the cover

Info_cover_rightlow – crouched, shoots to the right of cover.

Info_cover_crate – assumes there is a crate in front of him. Ducks behind and shoots over.  Good for crates and short rocks


Not implemented yet:
info_cover_prone                     - shoot from the prone position here

Info_cover_crouch                   - shoot from the crouched position here

Info_cover_stand                      - shoot from the standing position here



AI Areas


Cover nodes can be grouped into logical “areas”.  In order for the AI to perform squad tactics, you will need to place these areas in your level.  To create an area, first give the appropriate cover nodes the same $targetname.  Then put down an info_squadpathnode.  You may optionally give this node an area name so you can reference it in script.  Then connect (control-k) the squadpathnode to one of the cover nodes.  Since the cover nodes all have the same name, they will all instantly be connected to the squadpathnode.   You’ll want to group these areas in a logical manner.  Squads will attempt to stay in the same area.  If a guy happens to be in a different area (or an unassigned cover node) and the rest of his squad is at another area, he will try to find cover in the rest of the squad’s area (thus attempting to “stay with his squad”).    You’ll want to try to make sure that your areas have enough nodes to support the maximum # of guys in a squad.  You can influence the types of squad tactics that are used by proper placement of areas.  (ie: if you want a squad to possibly flank their enemy, be sure to put down an area that would be good for flanking.


AI Tactics


Here’s a list of the squad tactics available so far:

Flank                                        - Flank the enemy’s position

Double Envelopment                 - Flank the enemy from two sides

Charge                                     - Charge the enemy

Slow Advance                          - Gradually find cover closer to the enemy

Give ground                              - Gradually find cover farther from the enemy

Hold Steady                             - Cancel Slow Advance and/or Give Ground

Fallback                                   - Immediately move to cover farther from the enemy

Retreat                                     - Immediately move to cover a lot farther from the enemy

GetHelp                                   - Radio man requests backup

Banzai                                      - Run towards enemy and use your bayonet/sword attacks

Surrender                                 - Play surrender animations and drop weapon

CoverFire                                 - Empties a clip towards all enemies that guy can see


Unimplemented so far:

Hit and Fade

Spread Out



How the “Get Help” System Works.


A “get help” order is issued by the morale system when the appropriate conditions exist.  If the squad has a radioman and the squad’s area has been linked to by an aigethelptrigger, the radioman will play an animation indicating a radio call for reinforcements.  A few seconds later, the aigethelptrigger is tripped.


A soldier can be configured as a radioman by using the appropriate .HAG file (allied_radioman.hag, axis_japanese_radioman.hag) in Radiant.  Alternatively, any squad member can be made into a radioman by executing the “radioman” event (e.g. $soldiername radioman).  Use care if assigning the radioman responsibility manually – the “get help” order is a squad order, so all radiomen in a squad will perform it when the order is issued.



Radiant Set-up.


Place a trigger_multiple and associate it to the area by linking it to the squadpathnode for the area.  The trigger need not have any particular dimension or position as it is disabled from “normal” triggering methods when it is processed during level startup.


Assign a $targetname key of “aigethelptrigger”.  This allows the gethelp.scr global script to identify all gethelp triggers.


If you want the trigger to spawn a spawnset when tripped, assign a #set key to the value of the spawnset.  When the trigger is tripped, the spawnset is spawned in and assigned to the same squad as the radioman who issued the call for help.


Optionally, if the trigger is assigned a $triggername key, the trigger will rename itself to that key once it has been processed during level startup.  This allows you to uniquely identify a trigger, if you want to write script that explicitly waits for a trigger to be tripped.



Important Note(s).


If you choose to manage any gethelp triggers yourself, it is important to understand that you must not remove/delete these triggers from the level.  This is because the gethelp triggers are placed into an internal list that is used by the squads.  If you remove a trigger from the level without first removing from this internal list, very bad things happen.  Currently, there is no way to first remove a trigger from the internal list.




AI Squad commands


With the AI squad commands, you can assign a guy to a squad, remove a guy from a squad, set a guy as the squad leader, enable or disable the squad morale system.  In addition, you may force a squad to perform a tactic via script.  For most of these commands, you may optionally pass the name of the area you want to perform the tactic on.  If you don’t pass the area, the AI will attempt to find an appropriate area to perform the tactic.  If it doesn’t find one, it will just not do the tactic.  If you pass the area, the AI will perform the tactic without checking whether it “thinks” the area is appropriate, it will just do it.   If the squad has a leader, the leader will jester with a hand or vocal signal first.  After the signal, the squad will perform the tactic. Additional information can be found in the AI Squads Documentation.



squad_name        "Adds sentient to passed squad."

squad_leave       "Removes sentient from his squad."

squad_leader      "Sets sentient as the leader of his squad. "

squad_morale      "Sets the morale of this sentient's squad."

squad_usemorale   "Enable/Disable auto-squad tactics based on morale."

squad_advance     "Tells squad to advance (optionally pass area to advance to.)"

squad_retreat     "Tells squad to retreat (optionally pass area to retreat to.)"

squad_fallback    "Tells squad to fallback (optionally pass area to fallback to.)"

squad_charge      "Tells squad to charge (optionally pass area to charge to.)"

squad_banzai      "Tells squad to banzai (optionally pass area to banzai to.)"

squad_flank       "Tells squad to flank (optionally pass area to flank to.)"

squad_flankX2     "Tells squad to double flank (optionally pass areas to double flank to.)"

squad_holdsteady  "Tells squad to hold steady"

squad_slowadvance "Tells squad to slow advance"

squad_giveground  "Tells squad to give ground"

squad_coverfire   "Tells squad to perform covering fire."




AI console vars


                        Squad console vars

g_AISquadFallbackMinDist            // min dist of valid fallback area

g_AISquadFallbackMaxDist            // max dist of valid fallback area

g_AISquadFallbackMaxAngle           // max angle of valid fallback area

g_AISquadRetreatMinDist             // min dist of valid retreat area

g_AISquadRetreatMaxDist             // max dist of valid retreat area

g_AISquadRetreatMaxAngle            // max angle of valid retreat area

g_AISquadAdvanceMinDist             // min dist of valid advance area

g_AISquadAdvanceMaxDist             // max dist of valid advance area

g_AISquadAdvanceMinEnemyDist  // min dist from enemy of valid advance area

g_AISquadFlankMinDist               // min dist of valid flank area

g_AISquadFlankMaxDist               // max dist of valid flank area

g_AISquadFlankMinAngle              // min angle of valid flank area

g_AISquadFlankMaxAngle              // max angle of valid flank area

g_AISquadFlankMinEnemyDist          // min dist from enemy of valid flank area

g_AISquadFlankMaxEnemyDist          // max dist from enemy of valid flank area


                        Morale console vars

g_AIMoraleDebug   // 1 enables debug strings to print to console window, 2 to dprintln

g_AIMoraleDropCaptainDied // how much morale will drop if the squad’s captain died

g_AIMoraleDropFriendlyDied // how much morale will drop if a non-squadmate friendly dies

g_AIMoraleDropSquadmateDied // how much morale will drop if a squadmate dies

g_AIMoraleLiftKilledCaptain // how much morale will raise if squad kills an enemy cap

g_AIMoraleLiftKilledEnemy // how much morale will raise if squad kills an enemy

g_AIMoraleLiftKilledSquad // how much morale will raise if squad kills an entire squad

g_AIMoraleLiftCoverReached // how much morale will raise if cover is reached

g_AIMoraleLiftRetreatComplete // how much morale will raise if a retreat was completed

g_AIMoraleLiftFriendKilledEnemy // how much morale will raise if a non-squad friend kills an enemy

g_AIMoraleInitialWaitAggressive // how long (seconds)squad will wait before making initial morale decision

g_AIMoraleInitialWaitTimid // same as above, but for timid personality (disabled)

g_AIMoraleInitialWaitNormal // same as above, but for normal personality (disabled)