Game AI Labs
Five exercises covering a patrolling guard, A* pathfinding, steering behaviours, behaviour trees and goal-oriented action planning.
Patrolling Guard · Case study
A C# Unity exercise in keeping perception, navigation and guard state in sync.
The guard uses a NavMesh to move between waypoints. The player movement and camera setup make it possible to approach from different angles and test how the guard reacts.
The sight check combines a maximum distance, view angle and an occlusion raycast. Entering the radius is not enough if the target is out of the guard’s field of view or hidden behind geometry.
Sight initiates a chase, but the prototype exits chase on a distance threshold. The guard searches the last position tracked during the chase, then returns to its waypoint route. That is different from tracking only confirmed sightings.
References
Sight starts the chase; the distance threshold ends it and leads to a search of the last tracked position.