AI Behavior Manager

The AI Behavior Manager (AC_AI_BehaviorManager) component is responsible for managing AI states (such as Idle, Patrolling, Random Roam, Investigating, Combat, etc.), ensuring smooth transitions between them. Additionally, the component allows for fine-tuning AI behavior through various configurable parameters.

It is added to the Soulslike Enemy (B_Soulslike_Enemy) class by default.

How It Works

  • Behavior Tree Initialization

    • On Begin Play, the component checks if the AI has a valid Behavior Tree assigned.

    • If a Patrol Path is present, the AI starts in a Patrolling state immediately.

    • Otherwise, it defaults to the Idle state.

  • State Management

    • The component dynamically adjusts the AI's state based on environmental triggers (e.g., detecting the player, being attacked).

    • State changes are handled through the SetState method, ensuring smooth transitions between behaviors.

  • Fine-Tuning AI Behavior

    • The following parameters allow for custom AI tuning:

      • MaxChaseDistanceThreshold: Maximum distance AI will chase a target before stopping.

      • AttackDistanceThreshold: The distance at which AI will initiate an attack.

      • StrafeDistanceThreshold: Controls how far the AI must be from its target for strafing.

      • SpeedAdjustDistanceThreshold: Adjusts AI movement speed based on distance to the target.

      • MinimumStrafePointDistance: The minimum distance for strafing logic.

      • StrafeMethods: Defines how AI will strafe (e.g., directional preferences).

  • Event Based Blackboard Updates

    • The component is responsible for adjusting Blackboard values to ensure the AI’s Behavior Tree reacts correctly to its state.

  • Target & Patrol Tracking

    • The SetTarget() function updates AI’s current target (e.g., player or other AI).

    • The SetPatrolPath() function assigns a patrol route.

Example Usage

Last updated

Was this helpful?