This guide provides step-by-step instructions for integrating the Combat AI Behavior System, part of the Advanced ARPG Combat framework, into an Unreal Engine 5 project. Users will learn how to set up the system, configure default enemy AI behaviors, and test functionality using demo assets. The guide focuses on enabling the system to function as it does in the demo content, ensuring developers and designers can quickly implement dynamic enemy AI for Action RPGs.
Prerequisites
- Unreal Engine 5.3 or later.
- Plugins enabled:
Gameplay Tags,AI Framework(default in UE5). - Dependencies:
State Manager System,Advanced Abilities System,Attributes System. - A level with a
Nav Mesh Bounds Volumefor AI navigation. - Optional:
Enhanced Input Systemfor testing player interactions with AI.
Integration Steps
-
Migrate AI Folders:
- In the Unreal Editor, open the demo project containing the
Combat AI Behavior System. - In the Content Browser, locate the relevant AI folders:
Content/AdvancedARPGCombat/AdvancedCombatFramework/CoreCombatSystem/AIContent/AdvancedARPGCombat/MeleeCombatSystem/Blueprints/AI(optional for melee AI)Content/AdvancedARPGCombat/MagicCombatSystem/Blueprints/AI(optional for magic AI)Content/AdvancedARPGCombat/RangedCombatSystem/Blueprints/AI(optional for ranged AI)
- Right-click and select Migrate, then choose your project’s
Contentdirectory. - Ensure dependencies (e.g.,
State Manager System, Blueprints, Data Assets) are copied.
- In the Unreal Editor, open the demo project containing the
-
Add
BP_BaseEnemyto Level:- In your project’s Content Browser, locate
BP_BaseEnemyin the migrated AI folder. - Drag
BP_BaseEnemyinto a level or useBP_EnemySpawnerfor dynamic spawning. - If using
BP_EnemySpawner, set itsEnemy Infoproperty to a demoBP_EnemyInfo(e.g.,BP_EnemyInfo_Humanoid) in the Details panel.
- In your project’s Content Browser, locate
-
Configure
BP_BaseEnemy:- Select the placed
BP_BaseEnemyor a spawned instance. - In the Details panel, ensure
AI Controller Classis set toBP_BaseAIController. - Set
EnemyInfoto a demoBP_EnemyInfo(e.g.,BP_EnemyInfo_Humanoid) to initialize default behaviors, abilities, and attributes. - Verify
BP_BehaviorManagerComponentandBP_PatrolComponentare present in the Components panel.
- Select the placed
-
Set Up Patrol Path (Optional):
- Place a
BP_PatrolPathactor in the level from the migrated AI folder. - In the Details panel, adjust
Patrol Pointsusing the 3D widget to define the patrol route. - Select the
BP_BaseEnemyand, in itsBP_PatrolComponent, setPatrol Pathto the placedBP_PatrolPath. - If using the
BP_EnemySpawner, select theBP_EnemySpawnerand, in its details panel, setPatrol Pathto the placedBP_PatrolPath. - Configure
bLoopPatrolPathorbReverseDirectionas needed.
- Place a
-
Configure Behavior Tree and State Machine:
- Open the demo
BP_EnemyInfo(e.g.,BP_EnemyInfo_Humanoid) and verify:Behavior Treeis set to a demo Behavior Tree (e.g.,BT_HumanoidCombat).Behavior ClassesincludesSM_Humanoid_CombatBehaviorfor default humanoid behaviors.
- Ensure
BP_BehaviorManagerComponentonBP_BaseEnemyreferencesSM_Humanoid_CombatBehaviorviaBP_EnemyInfo.
- Open the demo
-
Add Navigation Mesh:
- In the level, place a
Nav Mesh Bounds Volumecovering the AI’s operational area. - Press P to visualize the green navigation mesh, ensuring it encompasses patrol and combat areas.
- In the level, place a
-
Test with Default Assets:
-
Play the level and observe the
BP_BaseEnemybehavior:- Verify patrol behavior (if
BP_PatrolPathis set) usingBP_PatrolComponent. - Test combat by approaching with a player character; the AI should engage using abilities from
BP_EnemyInfo.
- Verify patrol behavior (if
-
Monitor health bar visibility:
OnDamageApplied -> ShowHealthBar -
Test ragdoll on death:
OnDamageApplied -> Is Health Zero? -> Branch (True) -> EnableRagdoll -
Debug Behavior Tree tasks:
BP_BaseAIController -> UpdateTarget -> Set Blackboard Value As Object (Key: TargetActor, Value: Player)
-
Troubleshooting
- AI Not Moving:
- Ensure a
Nav Mesh Bounds Volumeis present and covers the AI’s area. - Verify
BP_PatrolPathis assigned toBP_PatrolComponentif patrolling. - Check
BP_BaseAIControlleris set as theAI Controller ClassinBP_BaseEnemy.
- Ensure a
- AI Not Engaging in Combat:
- Confirm
HostileTagsinBP_EnemyInfoorBP_BehaviorManagerComponentinclude player tags (e.g.,Player.Character). - Ensure
Behavior TreeandSM_Humanoid_CombatBehaviorare set inBP_EnemyInfo. - Verify
UpdatePerceptionis detecting the player viaBP_BaseAIController.
- Confirm
- Abilities Not Triggering:
- Check
Default Ability SetsinBP_EnemyInfoincludes valid abilities (e.g.,GA_EnemyMeleeAttack). - Ensure
Combat StyleinBP_EnemyInfois set and matches the AI’s abilities.
- Check
- Health Bar Not Showing:
- Verify
ShowHealthBaris called inOnDamageAppliedinBP_BaseEnemy. - Ensure the health bar widget is set in
InitializeHUDorBP_EnemyInfo.
- Verify
Notes
- Migration: Always migrate entire AI folders to ensure dependencies (e.g., abilities, animations) are included.
- Enemy Info: Use
BP_EnemyInfofor all AI configurations to leverage async loading and avoid hard references. - Navigation: AI behaviors like patrolling or chasing require a valid navigation mesh; adjust
Nav Mesh Bounds Volumesize for larger levels. - Testing: Test with demo
BP_EnemyInfoassets before customizing to understand default behavior. - Dependencies: Ensure
State Manager,Advanced Abilities, andAttributessystems are migrated and functional, as they are critical for AI behavior and abilities.