This project is a prototype of an NPC AI that uses FSM to make decisions, defining its behavior according to the player's actions.
The NPC has two sensors:
-
Vision
- If the player enters the cone-shaped area, the NPC detects the player if there is no obstacle between them.
-
Speed
- If the player runs within the detection area of the aqua-colored circle, the NPC detects him, even through obstacles between them.
In this mode, the NPC tries to maintain vision detection by rotating itself. If the player continues to be detected after the time in this mode has run out, the NPC switches to attack mode, otherwise it switches to idle or patrol mode.
Chases the player while in the vision detection area or running inside the speed detection area.
After the NPC leaves the attack mode state, it switches to this state, if it detects the player, it switches back to the attack mode state.
If the NPC detects the player it goes to the search mode.
Download the binaries at releases page. Developed with godot 4. If you prefer to build it yourself, the source code is available.