-
Notifications
You must be signed in to change notification settings - Fork 621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Subtree parameters #45
Comments
This addition is already in the pipeline for version 3 ;) |
I agree that adding parameters (ports in version 3) to Subtree avoid name collision and allow reusability, but I am puzzled by this sentence:
That's not the way it works: Suppose that you have <BehaviorTree ID="Walk">
<SequenceStar>
<MoveTo target="{my_target}" />
<FaceTo target="{my_target}" />
</SequenceStar>
</BehaviorTree> You just have to visit multiple targets (let's say 10 targets), instead of creating "10 subtrees with different targets" I would do something like: <BehaviorTree ID="VisitManyLocations">
<RepeatUntilEmptyFIFO queue={targets_list}>
<SequenceStar>
<PullFromFIFO queue={targets_list} output_target="{my_target}" />
<Walk/>
</SequenceStar>
</RepeatUntilEmptyFIFO>
</BehaviorTree> Note:
Nevertheless, this will not solve completely the issue I am discussin in #44 |
Problem is not really visiting multiple locations, but using the move subtree in different contexts Here is an example:
As you can see in this example, I can't reuse I could have played with the blackboard like you did but I felt like it was less natural and less readdable in a way bigger graph |
I am currently working on this very feature... stay tuned :) |
check branch ver_3. The new port remapping for SubTrees should do what you need |
I created a tutorial to introduce this new feature. |
https://github.com/BehaviorTree/BehaviorTree.CPP/blob/ver_3/examples/t06_subtree_port_remapping.cpp New link... looking forward for your feedback |
If there is, then I'm unaware (and it's not possible to add some in Groot) but that would be pretty neat to add the possibility to give parameters to subtree.
For instance, I have a subtree called Walk that is a sequence of nodes FaceTo and MoveTo.
Actually, I have to specify the target in both FaceTo and MoveTo while I would like to specify it at Walk level. Then FaceTo and MoveTo would just have to read Walk target value.
(In fact, I have to make a new subtree each time I want to face a different target).
I know I can use a blackboard value called
target
but it's not the desired result as in a more complex graph, I want to keep track of multiple targets (For example, in strategy game where the player orders a unit to harvest a resource, I will have two targets, the resource and the nearest storage to make the trip between the two)The text was updated successfully, but these errors were encountered: