What is a GOAP Agent?
To Eatyou need a precondition of
Find Foodaction sets the
HasFoodstate to be true.
When creating an agent, you need to first have a design. So let's choose a design. For simplicity sake, in this tutorial, we will assume the Agent already has a target and will omit it from the preconditions.
Agent: Soldier Goals: - `HurtTarget` Actions: - Shoot - Preconditions: `InShootingRange` - Effects: `HurtPlayer` - GoTo - Preconditions: `Not InShootingRange` - Effects: `InShootingRange`
We will make a simple agent that follows a target and shoot it when it is within range.
In a new scene, add a new GameObject, name it Agent Soldier and add a cube as a child.
Add a BasicAgent component and then add a HurtTarget goal.
Under the AgentSoldier GameObject