FSM - Patrol & Stealth AI
Project Overview
This prototype demonstrates a robust Finite State Machine (FSM) implementation for AI agents in a stealth-oriented environment. Using primitive primitives as placeholders, the focus is entirely on the logic governing agent transitions between patrolling, chasing, and searching states.
Core AI Logic & Features:
- Patrol State: Agents move between a series of fixed waypoint markers in a continuous loop.
- Dynamic Detection (Field of View): Agents use a vision cone to detect the player (represented by a green cube). Detection is instantaneous once the player enters the FOV.
- Shared Alert System: A "hive mind" notification system ensures that if any single agent detects the player, all agents in the scene enter the Alert/Chase state simultaneously.
- Chase & Search Pathfinding: Upon detection, agents abandon their patrol routes to pursue the player. If the player breaks line of sight, agents use pathfinding to reach the last position where the player was seen.
- Reset Loop: If agents reach the last known position and fail to re-establish visual contact after a search period, they autonomously return to their original patrol duties.
FSM State Transition Detail
The system is designed to be easily extensible, allowing for the addition of new states (like "Investigate Disturbance" or "Flee") without breaking the core transition logic. The pathfinding integration ensures that agents navigate complex environments to find the player even after losing direct visibility.