This project's primary objective was to conduct an in-depth study of complex, reactive enemy AI development within Unreal Engine 5 to enhance foundational gameplay programming skills. The result is a dynamic AI system featuring multiple enemy archetypes, layered perception, and sophisticated environmental awareness.
The base AI utilizes a Simple State Machine managed through a Behavior Tree, centered around a Blackboard Component for data centralization. This setup enables the AI to transition smoothly between states (e.g., Idle, Patrolling, Combat, Healing). The core combat loop was engineered to be fluid:
State Transitions: Reactive boolean variables on the Blackboard control high-level state entry and exit.
Action Flow: The system executes sequential actions such as equipping a weapon, locking on via controller rotation, pathfinding toward the player, executing an attack, and returning to a wait state.
To support sophisticated enemy pathfinding, the system incorporates dedicated navigation tools:
Patrol Systems: Utilized Spline Components to define fixed, predictable patrol routes, offering a robust method for managing deterministic AI movement in level design.
AI Perception: Implemented the AI Perception Component to integrate sight, sound, and damage sensing. Detection triggers an immediate transition from the Patrolling state to the Combat state.
Animation Synchronization: Resolved animation blending issues (e.g., character sliding while preparing to equip a weapon) using Event Dispatchers to ensure all movement actions are correctly synchronized with the completion of the required animations.
The Environment Query System (EQS) was leveraged to enable proactive, data-driven decision-making, allowing the AI to dynamically react to the environment and player location:
Tactical Positioning: Designed EQS queries to sample surrounding terrain and identify the optimal range for the current attack pattern (e.g., finding the best distance for a melee attack).
Dynamic Cover Generation: Implemented a healing state where EQS is used to quickly and reliably find viable line-of-sight-blocking cover points on the map, allowing the enemy to temporarily retreat and heal before re-engaging.
To demonstrate scalability, the system was built using Object-Oriented Design (OOD) principles:
Class Inheritance: A specialized Mage enemy was created as a Child Blueprint Class of the core AI, inheriting all base behaviors (patrol, perception, healing logic).
Archetype Specialization: The Mage customized the Combat state with unique abilities, including a targeted teleport attack, and implemented an ability selection logic that dynamically chooses between basic energy blasts and a powerful barrage based on the current distance to the player.
This framework ultimately delivers a dynamic and reactive combat experience, providing a foundational and flexible architecture for developing diverse enemy behaviors in future projects.