Posted June 20, 2023 by Brad Dallimer
The Non-Player-Character Artificial Intelligence (NPC AI) is the system that controls the behaviour of NPCs in this project. I utilised Finite-State Machines (FSMs) and Unity’s NavMesh system to achieve this.
(AI-FSM.png)
By creating new state classes that inherit from the BaseState class, I can create different actions and transitions to create new behaviours that link to other states.
NPCs can cache references to chosen custom states and variables using the Scriptable Object, C_Attributes. This makes it easier for designers to easily create new NPC types using only the editor.