Open therealrobster opened 3 years ago
The only function you need to understand for using that addon is the "goap" function in player.gd in the example. That function reevaluates the goap algorithm whenever necessary to define the list of actions to be taken. Everything else in this file defines the actions themselves (running, picking up objects etc.).
This probably isn't the place for it but I'm having the same issue. I'm incorporating it into my 2d project and the plan() function is not returning a plan so it dies there just idling. How are goals determined? I set mine to cut_tree as I just want him to simply cut a tree for testing purposes. A breakdown would be useful. Mine seems to be getting lost in the astar function. Yours iterates a few times but mine only iterates twice i believe. I have one action under action planner: cut_wood.
This probably isn't the place for it but I'm having the same issue. I'm incorporating it into my 2d project and the plan() function is not returning a plan so it dies there just idling. How are goals determined? I set mine to cut_tree as I just want him to simply cut a tree for testing purposes. A breakdown would be useful. Mine seems to be getting lost in the astar function. Yours iterates a few times but mine only iterates twice i believe. I have one action under action planner: cut_wood.
OK, could you share your project or at least give me more details? You have only one action, but what are its preconditions and effect?
Preconditions and effects describe how the "status of the world" changes. For your very simple example, you could say the status has 2 properties:
Your "cut_wood" action would have "player_sees_a_tree" as precondition, and "player_sees_wood" as effect.
To use GOAP, you have to:
Hope this helps!
BTW, when selecting the ActionPlanner node, there is an editor in the bottop panel. I never coded the "simulation" part, but the editor should work... Maybe I should fix that...
here's my project: https://github.com/smccourtb/lore-torn i haven't implemented any movement and took out your physics process function to figure out how it all works. I guess I'm having a hard time following it.
are goals only established in the goap_get_current_goal() function? I'm sure when i can get the plan to return I can get a better idea on how the actions are implemented. I'm just stuck there as of right now. currently debugging yours and stepping through with breakpoints to figure out where ours diverge. Maybe i need a wait action like yours? I appreciate the time you're taking to explain.
You don't have to debug or understand the plan function, it works. :D Just give it actions, a start state, and goals, and it will generate plans for you. ;)
so it works if i set the goal to "sees_tree" *i think". at least if calls the use_nearest_object_function(). but if the goal is set to 'cut_tree' it does not. Seems wrong because my goal is to cut the tree down, not just see a tree. seems opposite to me.
Just looked at your project. The goal should be sees_wood. sees_tree is the initial status.
I just realized that. so the goal has to be part of some actions effects? is that correct?
Hi there,
I'm not at the level to fully understand this by reading the code. Is there any chance a quick overview of the code and what it's doing? Maybe even just dialog as you browse over the relevant code so I can consider what that's doing and then implement it into my game? Thank you and I really look forward to understanding this further.