Posted May 18, 2024 by TrayCoats
Author: Trayvion Coats
This week, I faced significant challenges in developing the guard patrol and chase mechanics for our game. The guards are designed to patrol specific areas and chase the player upon detection, but ensuring smooth and realistic behavior proved to be difficult. The primary issues were that guards sometimes failed to patrol their designated areas correctly, and their behavior became erratic when chasing the player, especially when the player moved out of the patrol area.
To address these challenges, I conducted thorough research and discovered a more effective approach for implementing guard patrol and chase behaviors.
First, I improved the patrol system by implementing a waypoint-based patrol path, ensuring that guards move smoothly between designated points within their patrol area. Each guard now follows a predefined path, making their patrol behavior more predictable and realistic.
Second, I enhanced the player detection and chase logic. When a guard detects the player, they enter a chase mode. If the player loses the guard, the guard will abandon the chase and return to their patrol path
With these changes, the guard patrol and chase mechanics are now functioning much more effectively..