177
Tool Creation |Human Agents
176
Tool Creation |Human Agents
Unstuck State
Since all these states depend on a series of logic to function, there are instances where the agents might become stuck within the environment. For example, an agent within the ExploreState might become stuck in a corner due to the EQS continuously calculating the furthest point in front of the agent. (Fig. 3.3.33) Another example might be an EQS query establishing a location that is unavailable to the agent, in which case the agent might freeze on the spot as it does not know how to get there through the pathfinding system. There are certainly many more instances when the agents might become stuck, so rather than trying to debug every instance, we can simply utilize a state for this. To establish this unstuck state, we can perform a check every few seconds based on the agent’s location and their desired location. If these locations are unchanged for too long when the agent is not interested in an object or agent, we can tell the agent to recalculate a location near them that is valid and reset their state to DeafultExplore with this new location. (Fig. 3.3.34)
Because of the higher abstraction of this tool, we do not need to worry about the technical aspects of teaching the agents how to walk for each task—since this is already taken care of with our new pathfinding system—but rather just focus on the sequence of individual actions that they need to do within their respective tasks. This allows for a quickly implementable and relatively intuitive way to add agent actions to establish them for future use as well. Now that we have established the main states, we can put them together within a functioning behavior tree. (Fig. 3.3.39)
Agents sometimes becomes stuck in the corner due to the EQS continuously perceiving the corner in front of the agent to be the furtherest point within the environment
Screen-captured by Author.
Unstuck State within Behavior Tree tells the agent to query a new location behind them if they don’t move for longer than a specified time interval
Screen-captured by Author.