July 21, 2020
AI For Beginners
Goal Orientated Action Planning (GOAP)
Part 8
Beginner Programming: Unity Game Dev Courses
Unity Learn Course – AI For Beginners
Executing a Simple Plan
Executing a Simple Plan
This tutorial starts by actually implementing the newly created planner setup within the agents themselves. This involves creating a rather bulky LateUpdate method within the GAgents class which tries to handle all the possible cases of different states of having a planner and having actions to perform.
This LateUpdate can be broken down into four main sections:
- Continues running an action that is in progress
- Generates a plan and possibly an action queue if they are not already present in agent
- Removes goal and planner once entire action queue is used up
- Selects the next action in queue to start performing
They then created a new Patient class (which inherited from GAgent) to place on the patient agents and they created a new GoToHospital class (which inherited from GAction) to give this agent something to use with the planner. This was done to simply show the interaction of all these class types, the GAgent, GAction and GPlanner.
Summary
While brief, there is a lot going on in the GAgent class with this tutorial. I feel like having such a heavy Update type method (LateUpdate in this case) is not normally ideal, so there may be better ways to condense that section into separate methods or have other parts of the system help make some checks to support the GAgents class.