CAIUMODULE

Overview

The CAIUMODULE provides an AI controller and a set of Behavior Tree task nodes for NPC behavior. It wraps Unreal Engine’s AAIController with perception setup (sight), team attitude, blackboard management, and fight-state broadcasting. Task nodes cover movement, attack, automation, navigation recovery and idle waiting.

Depends on CCOREUMODULE, AIModule, NavigationSystem, GameplayTasks.

Functionalities Overview
AI Controller ACAIController — AI controller with sight perception, behavior tree execution, team attitude and fight-state management
Data FCAIStruct — DataTable row configuring perception radius, vision angle, forget delay and behavior tree reference
Task Nodes 8 custom UBTTaskNode subclasses for attack, movement, automation, navigation recovery and waiting
Blueprint UCAIBPLibrary — Blueprint function library (currently empty)

ACAIController

ACAIController extends AAIController with UCrowdFollowingComponent for crowd avoidance. On possession it:

  1. Reads perception configuration from FCAIStruct via the pawn’s UCInitializerComponent_.
  2. Creates a UAIPerceptionComponent with UAISenseConfig_Sight (enemies only) if sight is enabled.
  3. Adjusts ARecastNavMesh::AgentRadius to match the sight radius.
  4. Runs the referenced UBehaviorTree.
  5. Sets the automationKey blackboard key if the pawn has a non-empty UCAutomationComponent_.

Perception callbacks update the hostileActorKey blackboard key and broadcast fight reason changes to ACPlayerController.

FCAIStruct

Property Type Default Description
behaviorTree UBehaviorTree* nullptr Behavior tree to run on possession
enableSight bool true Enable sight perception
sightRadius float 3000 Detection radius
loseSightRadius float 5000 Radius at which a detected actor is lost
peripheralVisionAngleDegrees float 66 Half-angle of the vision cone
forgetAfterInSec float 5 Time before a detected actor is forgotten