AI PET
Virtual Pet with advanced AI FSM
Repository: https://github.com/Darpaler/AI_Pet.git
SIGHT
The AI uses the dot product to find whether or not the mouse is within it's field of view. While it can see the mouse, it looks towards it. Once the mouse leaves its field of view, it stops.
FINITE STATE MACHINE
Unity's Animator can be used to make a FSM. This keeps track of what state the AI is in, and uses different variables to keep track of how hungry, bored, or tired the AI. It uses these variables to switch between different states.
PATH FINDING
The AI uses the A* algorithm to find the best path to the goal. When the player selects "Throw Ball" one of three random goals are chosen. The AI then begins creating a list of nodes from the start to the goal based on a score comprised of the distance to the goal and distance from the start. It then follows the shortest path to the goal.