Parallel Execution in Behavior Tree
I am creating a simple behavior for a cannon.
The desired behavior is:
I currently have the following Behavior Tree implemented:
Predictably, this results in sequential execution of Aim, Fire and Reload. This causes rather 'jerky' behavior for the cannon since Reload task has a certain delay built into it.
How do I modify this to achieve the desired behavior? I want it to constantly run Aim task and Fire & Reload when these abilities come off cool down.
Thanks for your help
Ok - after spending 2 nights bashing my head on the wall. I finally worked it out. I tried Simple Parallel composite but I could not get it to work. For some reason it would always run the main task but it would never run the other tree. Here is the working Behavior Tree:
When I tried this before, it would only run Aim task and never run Fire and Reload. The reason for that behavior is very subtle. From the documentation: You can think of the Simple Parallel node as "While doing A, do B as well."
The reason why it did not work for me before is because I had Finish Execute node in the Aim Task. As a consequence, it would finish Aim when conditions were met and never execute the Fire and Reload sequence. Simple Parallel only works if the primary task does not finish.
This is not very obvious guys - could we please make it a little clearer in the documentation?
answered Dec 10 '15 at 12:10 PM
I'm trying something similar.
I want to make an actor run around while shooting from time to time at a target.
However, as soon as I attach my Fire Task the main task isn't running anymore. It is running, though, if I add a Finish Execution node to the main task, but then the secondary task isn't executed anymore.
Are there any specific constraints on a secondary task? My Fire Task so far is just a "Print Hello"-Node and the option of a finish execution node (doesn't work no matter it's connected or not)
If I connect the finish execution node in my primary task, the primary is executed like intended, but my secondary task isn't executed anymore, as you have mentioned it.
Sorry, wanted to post as comment but I think, my image would vanish.
answered May 23 '16 at 08:50 AM
Okay, I gained some new insights on this:
your main task can indeed execute the Finish Execution node, however your simple parallel node needs its execution flow mode set to "wait for sub tree"
If it's set so, then the execution of the tasks is pretty much straight forward and as one would expect.
answered May 24 '16 at 10:11 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here