
Troll Fight
Troll Boss Encounter
Engine: Unreal Engine 5 | Tools: Blueprint, AI Perception, Behavior Tree, BlackBoard, Animation State Machine
Sight is handled using UE5’s Pawn Sensing component with line-of-sight detection.
Hearing is implemented through custom Blueprint events. Any Blueprint can emit a noise event, allowing spells and attacks to alert the troll if it's within hearing range.
Damage triggers a temporary “awareness” of the player’s location even without sight, allowing the AI to follow for a short period before falling back to investigation behavior.
Summary:
Built using Unreal’s Behavior Tree and Blackboard systems.
States are managed with a custom AI State Enum: Patrol, Investigate, Follow, Attack.
Patrol is handled through spline movement.
Transitions are triggered by AI Perception (sight, hearing) or damage taken.
Loss of sight causes a fallback to Investigate, and eventually to Patrol if the player isn’t found.
The attack uses animation notifies to enable and disable the weapon’s hitbox at the correct time.
Full Fight
Summary:
The troll is spawned when the player walks over a trigger volume near the castle ruins.
It patrols along a spline path until a sense is triggered.
The troll has four behavior states:
Patrol
Investigate (hearing-based)
Follow (when player is seen or after taking damage)
Attack (when within 150 units)
The troll uses a single club swing attack. A weapon-based hitbox activates during the animation.
If the hitbox collides with the player, damage is applied.