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 Volume
for AI navigation. - Optional:
Enhanced Input System
for 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/AI
Content/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
Content
directory. - Ensure dependencies (e.g.,
State Manager System
, Blueprints, Data Assets) are copied.
- In the Unreal Editor, open the demo project containing the
-
Add
BP_BaseEnemy
to Level:- In your project’s Content Browser, locate
BP_BaseEnemy
in the migrated AI folder. - Drag
BP_BaseEnemy
into a level or useBP_EnemySpawner
for dynamic spawning. - If using
BP_EnemySpawner
, set itsEnemy Info
property 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_BaseEnemy
or a spawned instance. - In the Details panel, ensure
AI Controller Class
is set toBP_BaseAIController
. - Set
EnemyInfo
to a demoBP_EnemyInfo
(e.g.,BP_EnemyInfo_Humanoid
) to initialize default behaviors, abilities, and attributes. - Verify
BP_BehaviorManagerComponent
andBP_PatrolComponent
are present in the Components panel.
- Select the placed
-
Set Up Patrol Path (Optional):
- Place a
BP_PatrolPath
actor in the level from the migrated AI folder. - In the Details panel, adjust
Patrol Points
using the 3D widget to define the patrol route. - Select the
BP_BaseEnemy
and, in itsBP_PatrolComponent
, setPatrol Path
to the placedBP_PatrolPath
. - If using the
BP_EnemySpawner
, select theBP_EnemySpawner
and, in its details panel, setPatrol Path
to the placedBP_PatrolPath
. - Configure
bLoopPatrolPath
orbReverseDirection
as needed.
- Place a
-
Configure Behavior Tree and State Machine:
- Open the demo
BP_EnemyInfo
(e.g.,BP_EnemyInfo_Humanoid
) and verify:Behavior Tree
is set to a demo Behavior Tree (e.g.,BT_HumanoidCombat
).Behavior Classes
includesSM_Humanoid_CombatBehavior
for default humanoid behaviors.
- Ensure
BP_BehaviorManagerComponent
onBP_BaseEnemy
referencesSM_Humanoid_CombatBehavior
viaBP_EnemyInfo
.
- Open the demo
-
Add Navigation Mesh:
- In the level, place a
Nav Mesh Bounds Volume
covering 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_BaseEnemy
behavior:- Verify patrol behavior (if
BP_PatrolPath
is 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 Volume
is present and covers the AI’s area. - Verify
BP_PatrolPath
is assigned toBP_PatrolComponent
if patrolling. - Check
BP_BaseAIController
is set as theAI Controller Class
inBP_BaseEnemy
.
- Ensure a
- AI Not Engaging in Combat:
- Confirm
HostileTags
inBP_EnemyInfo
orBP_BehaviorManagerComponent
include player tags (e.g.,Player.Character
). - Ensure
Behavior Tree
andSM_Humanoid_CombatBehavior
are set inBP_EnemyInfo
. - Verify
UpdatePerception
is detecting the player viaBP_BaseAIController
.
- Confirm
- Abilities Not Triggering:
- Check
Default Ability Sets
inBP_EnemyInfo
includes valid abilities (e.g.,GA_EnemyMeleeAttack
). - Ensure
Combat Style
inBP_EnemyInfo
is set and matches the AI’s abilities.
- Check
- Health Bar Not Showing:
- Verify
ShowHealthBar
is called inOnDamageApplied
inBP_BaseEnemy
. - Ensure the health bar widget is set in
InitializeHUD
orBP_EnemyInfo
.
- Verify
Notes
- Migration: Always migrate entire AI folders to ensure dependencies (e.g., abilities, animations) are included.
- Enemy Info: Use
BP_EnemyInfo
for 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 Volume
size for larger levels. - Testing: Test with demo
BP_EnemyInfo
assets before customizing to understand default behavior. - Dependencies: Ensure
State Manager
,Advanced Abilities
, andAttributes
systems are migrated and functional, as they are critical for AI behavior and abilities.