My understanding about GOAP is that the planner will perform a regressive search on the action space for a valid sequence of actions that will take the NPC from some starting state to the goal state. In each step of the regressive search, the planner tries to identify a valid action that has an effect that can resolve one of the unsatisfied goal conditions. Every time an action is added to the planner, the goal state grows as well because the precondition of the appended action will be added as another goal condition. Here’s some context:
- Given the world state value of kEnemyHP = 200, goal: kEnemyHP = 0
- Action space consisting of [Attack, ApproachEnemy]
- For Attack, effect: kEnemyHP -= 50, precondition: kEnemyInRange = true
- For ApproachEnemy, effect: kEnemyInRange = true, precondition: none
The thing is: regressive search works in the back chaining way, such that it starts from kEnemyHP = 200 and tries to find the next action that can reduce the HP. Attack can reduce the HP by 50 with the precondition of enemy in range. However, in regressive search it will always assume the precondition to be false in order to allow back chaining (correct me if I am wrong) so the next result would be ApproachEnemy. The planner’s action sequence becomes ApproachEnemy -> Attack -> Goal. But the Attack action needs to be performed for 4 times in order to reduce enemy HP to 0. The logical concept of regressive search for GOAP doesn’t really allow that to happen, isn’t it? So how to resolve this kind of situation?
I tried to search through the internet and also ChatGPT and Gemini, it says that the planner’s action sequence only attempts to fulfil the preconditions rather than returning a full, complete set of actions. But my understanding is that the regressive search theoretically speaking should return a full, complete set of actions which fulfil the preconditions as well. Am I getting this wrongly?
Ken Love is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.