ai_controller

Vars | |
ai_movement | Reference to the movement datum we use. Is a type on initialize but becomes a ref afterwards. |
---|---|
ai_status | Current status of AI (OFF/ON) |
ai_traits | Bitfield of traits for this AI to handle extra behavior |
behavior_args | Stored arguments for behaviors given during their initial creation |
behavior_cooldowns | Current actions and their respective last time ran as an assoc list. |
blackboard | This is a list of variables the AI uses and can be mutated by actions. When an action is performed you pass this list and any relevant keys for the variables it can mutate. |
continue_processing_when_client | Can the AI remain in control if there is a client? |
current_behaviors | Current actions being performed by the AI. |
current_movement_target | Current movement target of the AI, generally set by decision making. |
failed_planning_cooldown | Cooldown for new plans, to prevent AI from going nuts if it can't think of new plans and looping on end |
idle_behavior | The idle behavior this AI performs when it has no actions. |
max_target_distance | distance to give up on target |
movement_cooldown | Cooldown until next movement |
movement_delay | Delay between movements. This is on the controller so we can keep the movement datum singleton |
movement_target_source | Identifier for what last touched our movement target, so it can be cleared conditionally |
pathing_attempts | Tracks recent pathing attempts, if we fail too many in a row we fail our current plans. |
paused_until | AI paused time |
pawn | The atom this controller is controlling |
planned_behaviors | Current actions planned to be performed by the AI in the upcoming plan |
planning_subtrees | All subtrees this AI has available, will run them in order, so make sure they're in the order you want them to run. On initialization of this type, it will start as a typepath(s) and get converted to references of ai_subtrees found in SSai_controllers when init_subtrees() is called |
Procs | |
PossessPawn | Proc to move from one pawn to another, this will destroy the target's existing controller. |
ProcessBehavior | It's still in the plan, don't add it again to current_behaviors but do keep it in the planned behavior list so its not cancelled |
SelectBehaviors | This is where you decide what actions are taken by the AI. |
TryPossessPawn | Abstract proc for initializing the pawn to the new controller |
UnpossessPawn | Proc for deinitializing the pawn to the old controller |
able_to_plan | Are we close enough to engage? Determines whether the AI can currently make a new plan |
able_to_run | Returns TRUE if the ai controller can actually run at the moment. |
change_ai_movement_type | Overrides the current ai_movement of this controller with a new one |
get_access | Use this proc to define how your controller defines what access the pawn has for the sake of pathfinding, likely pointing to whatever ID slot is relevant |
get_human_examine_text | If this controller is applied to a human subtype, this proc will be called to generate examine text |
get_minimum_distance | Returns the minimum required distance to preform one of our current behaviors. Honestly this should just be cached or something but fuck you |
get_setup_mob_ai_status | Mobs have more complicated factors about whether their AI should be on or not |
init_subtrees | Loops over the subtrees in planning_subtrees and looks at the ai_controllers to grab a reference, ENSURE planning_subtrees ARE TYPEPATHS AND NOT INSTANCES/REFERENCES BEFORE EXECUTING THIS |
on_stat_changed | Turn the controller on or off based on if you're alive, we only register to this if the flag is present so don't need to check again |
process | Runs any actions that are currently running |
queue_behavior | Call this to add a behavior to the stack. |
replace_planning_subtrees | Completely replaces the planning_subtrees with a new set based on argument provided, list provided must contain specifically typepaths |
set_ai_status | This proc handles changing ai status, and starts/stops processing if required. |
set_movement_target | Sets the current movement target, with an optional param to override the movement behavior |
Var Details
ai_movement

Reference to the movement datum we use. Is a type on initialize but becomes a ref afterwards.
ai_status

Current status of AI (OFF/ON)
ai_traits

Bitfield of traits for this AI to handle extra behavior
behavior_args

Stored arguments for behaviors given during their initial creation
behavior_cooldowns

Current actions and their respective last time ran as an assoc list.
blackboard

This is a list of variables the AI uses and can be mutated by actions. When an action is performed you pass this list and any relevant keys for the variables it can mutate.
continue_processing_when_client

Can the AI remain in control if there is a client?
current_behaviors

Current actions being performed by the AI.
current_movement_target

Current movement target of the AI, generally set by decision making.
failed_planning_cooldown

Cooldown for new plans, to prevent AI from going nuts if it can't think of new plans and looping on end
idle_behavior

The idle behavior this AI performs when it has no actions.
max_target_distance

distance to give up on target
movement_cooldown

Cooldown until next movement
movement_delay

Delay between movements. This is on the controller so we can keep the movement datum singleton
movement_target_source

Identifier for what last touched our movement target, so it can be cleared conditionally
pathing_attempts

Tracks recent pathing attempts, if we fail too many in a row we fail our current plans.
paused_until

AI paused time
pawn

The atom this controller is controlling
planned_behaviors

Current actions planned to be performed by the AI in the upcoming plan
planning_subtrees

All subtrees this AI has available, will run them in order, so make sure they're in the order you want them to run. On initialization of this type, it will start as a typepath(s) and get converted to references of ai_subtrees found in SSai_controllers when init_subtrees() is called
Proc Details
PossessPawn
Proc to move from one pawn to another, this will destroy the target's existing controller.
ProcessBehavior
It's still in the plan, don't add it again to current_behaviors but do keep it in the planned behavior list so its not cancelled
SelectBehaviors
This is where you decide what actions are taken by the AI.
TryPossessPawn
Abstract proc for initializing the pawn to the new controller
UnpossessPawn
Proc for deinitializing the pawn to the old controller
able_to_plan
Are we close enough to engage? Determines whether the AI can currently make a new plan
able_to_run
Returns TRUE if the ai controller can actually run at the moment.
change_ai_movement_type
Overrides the current ai_movement of this controller with a new one
get_access
Use this proc to define how your controller defines what access the pawn has for the sake of pathfinding, likely pointing to whatever ID slot is relevant
get_human_examine_text
If this controller is applied to a human subtype, this proc will be called to generate examine text
get_minimum_distance
Returns the minimum required distance to preform one of our current behaviors. Honestly this should just be cached or something but fuck you
get_setup_mob_ai_status
Mobs have more complicated factors about whether their AI should be on or not
init_subtrees
Loops over the subtrees in planning_subtrees and looks at the ai_controllers to grab a reference, ENSURE planning_subtrees ARE TYPEPATHS AND NOT INSTANCES/REFERENCES BEFORE EXECUTING THIS
on_stat_changed
Turn the controller on or off based on if you're alive, we only register to this if the flag is present so don't need to check again
process
Runs any actions that are currently running
queue_behavior
Call this to add a behavior to the stack.
replace_planning_subtrees
Completely replaces the planning_subtrees with a new set based on argument provided, list provided must contain specifically typepaths
set_ai_status
This proc handles changing ai status, and starts/stops processing if required.
set_movement_target
Sets the current movement target, with an optional param to override the movement behavior