1. General Overview
  2. In general, each creature starts off asleep/idle and does nothing but wait for stimuli or scripting commands. While in this condition the level designers can do all the scripting they want to the creature because no AI is currently running (it is basically off). Now, for the AI to actually turn on, the creature must receive some type of stimuli to activate it. Right now these include sight (of an enemy), sounds (weapons, pain, footsteps, etc.), and pain. If any of these stimuli are received, then the AI will turn on and scripting will no longer be run. At this point, the state machine will now be processed each frame and scripting will be ignored until such time that the AI is finished. The AI can finish if it resolves the stimuli (enemy is killed, checks out the sound and finds nothing, etc.) or it fails to resolve the stimuli (it loses the enemy and can’t find him). This would put the creature back to the asleep/idle condition again and everything starts over.

     

    1. Conditionals (code)

bool <conditional procedure name>( Conditional &condition, Entity &ent )

{

Actor *act = (Actor *)&ent;

conditional code

return boolean value;

}

Conditional <conditional name>("<string used from statemaps>", <procedure name>);

    1. Behaviors (code)
    1. State machine (text file)

state <state name>

{

legs

{

<animation name> : default

}

behavior <behavior name> <arguments>

time <minimum time> <maximum time> (optional command)

states

{

<state 1 name> : <conditional 1 name> <arguments> <conditional 2 name> …

<state 2 name> …

}

}

    1. Scripting (text file)
    1. Stimuli
  1. How to extend AI from code
  2. There are two main ways to extend the AI from code. You can add new conditionals and you can add new behaviors. You should add new conditionals if you want the AI to make better decisions on what to do. You should add new behaviors if you want the creatures to be able to do new things. See the previous section to see what the format is to add new conditionals and behaviors.

  3. How to extend AI from script

You can also extend the AI by adding commands to the level script for any individual creature to make it do very specific things (walk a certain patrol route, type on the computer, etc.). You can add these commands basically in two different places, directly in the level script (which is normally probably not a good idea) and inside of an actor thread. The reason why directly inside the level script is probably not normally good is because these commands will always get run regardless if the AI is running or not. The commands in the actor threads on the other hand will be ignored until the AI is back in an idle state (this is much safer in general).

$<actor name> thread <label name> (starts the actor thread at this label)

<label name>: (actual thread, this will be in the level script somewhere)

script commands

end

 

  1. Pathnodes & Pathfinding
  1. Steering
  1. AI console commands
  1. Current behaviors
  2. These are the current behaviors that are in the game as of 1/12/2000. The following format is the behavior name, what parameters (through setargs) it can receive if any, and a short description.

    1. General behaviors
    1. Utility behaviors

Utility behaviors are those that are designed only to do something in their begin function. Thus they only do something when first called.

 

    1. Behaviors for specific creatures
  1. Future plans