GAME DEV ยท MAY 2026
AI Guard System - Unreal Engine 5
A third-person stealth prototype focused on AI behaviour. Two guards patrol independent routes and react to the player through sight and hearing.

At a glance
- ROLE
- Solo developer
- TEAM
- Solo
- CONTEXT
- AI Programming course project
What I built
- A Behaviour Tree with three states: Patrol, Chase and Investigate.
- AISense_Sight for direct pursuit and AISense_Hearing for investigating a noise, each with a visibly different response.
- Team alertness: a service on every guard reads a shared Game Instance flag, so passive guards start investigating within 0.25 seconds of one guard spotting the player.
- Guards return to patrol after investigating when there is no contact.
- Patrol routes built on spline actors, walked back and forth.
Technical decision
Priorities live in the shape of the tree
The tree is a selector with its branches ordered by priority: chase first, investigate second, passive patrol last. Every branch has a decorator on the State key that aborts itself, so a change of state interrupts whatever the guard was doing. Sight writes the target and sets Chase, hearing only writes a location and sets Investigate, and a service on the chase branch falls back to Investigate when sight is lost.
Behaviour Tree outline
Root - Selector
- SequenceChasingPlayerState (highest priority)
- Decorator: State == ChasingPlayer, aborts self
- Service: BTService_CheckLostSight - if sight lost, set state to Investigating
- Tasks: SetMovementSpeed (Sprint) > ClearFocus > MoveTo AttackTarget > FocusTarget > DefaultAttack > Wait
- SequenceInvestigatingState (medium priority)
- Decorator: State == Investigating, aborts self
- Tasks: SetMovementSpeed (Jog) > MoveTo PointOfInterest > Wait (5s) > SetStateAsPassive
- SelectorPassiveState (lowest priority)
- Decorator: State == Passive, aborts self
- If has patrol route: SetMovementSpeed (Walk) > MoveAlongPatrolRoute > Wait
- If no patrol route: ClearFocus > Wait (10s)