FSM - Patrol & Stealth AI

Unity C# Finite State Machines Pathfinding Stealth Mechanics

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.