Hello! I'm having trouble understanding the evaluation logic.
In my example tree in the attachments I have a Selector which has two children; a Sequence and a plain old Idle. Conditional1 and 2 are Compare SharedBool Conditionals that compare the variables Bool1 and Bool2 respectively, and they will return Success if the bool variable is true. Action1 and 2 are Log actions.If we start the game with both Bool1 and 2 as false, the Selector will first try the leftmost Sequence, which will return Failure because of Conditional1. The Selector will then run the Idle and, well, idle.
Now, if we at this point set Bool1 as true, Sequence will cause a Conditional Abort and the Sequence will start to run. The first log task, Action1, is run as well as the Wait in the middle. Then we get to Conditional2. It will check Bool2, which is still false and return Failure. After this the Selector will again go to Idle.
This much I understand. But I would've expected the Conditional1 to cause another Conditional abort on the next frame since Bool1 is still true and the Conditional1 is a Success. Instead we will not evaluate the Sequence at all anymore, but will stay in Idle, until either Bool1 or Bool2 value changes and one of the Conditionals returns something else than their previous value. Why is this?
There is a common need in our project to cancel out of lower priority branches that may have long-lasting actions or sequences, that we need to immediately come out of and back to a higher priority branch whenever the higher priority branch becomes available again (re-evaluation of some condition or conditions): conditional aborts initially SEEM to be just the solution to this, but just as in this case they will start to fail after the higher priority branch they abort into fails even once.
The abstract minimal repro case / explanation of the issue could be many things, but in our case the first gameplay use-cases where the Behavior Tree just seems to not work as expected and needed was when there's a high-priority sequence like "a condition for distance to target, an attack action that can hit or miss which, if successful, is followed by something triggered by the hit like damage or a Timeline", and a low-priority branch like idling or wandering about. If the attack sequence returns a failure (attack missing mid-sequence), the low-priority Idle branch goes on and the attack branch will only ever conditionally abort and resume if the distance-check condition changes values back to failure and success again; remaining close to the target will lock the BT into Idle, even though the distance-check condition would be successful and conditional abort could be reasonably expected to cause abort to retrying the attack as long as we stay in range.
Any insight would be highly appreciated!
In my example tree in the attachments I have a Selector which has two children; a Sequence and a plain old Idle. Conditional1 and 2 are Compare SharedBool Conditionals that compare the variables Bool1 and Bool2 respectively, and they will return Success if the bool variable is true. Action1 and 2 are Log actions.If we start the game with both Bool1 and 2 as false, the Selector will first try the leftmost Sequence, which will return Failure because of Conditional1. The Selector will then run the Idle and, well, idle.
Now, if we at this point set Bool1 as true, Sequence will cause a Conditional Abort and the Sequence will start to run. The first log task, Action1, is run as well as the Wait in the middle. Then we get to Conditional2. It will check Bool2, which is still false and return Failure. After this the Selector will again go to Idle.
This much I understand. But I would've expected the Conditional1 to cause another Conditional abort on the next frame since Bool1 is still true and the Conditional1 is a Success. Instead we will not evaluate the Sequence at all anymore, but will stay in Idle, until either Bool1 or Bool2 value changes and one of the Conditionals returns something else than their previous value. Why is this?
There is a common need in our project to cancel out of lower priority branches that may have long-lasting actions or sequences, that we need to immediately come out of and back to a higher priority branch whenever the higher priority branch becomes available again (re-evaluation of some condition or conditions): conditional aborts initially SEEM to be just the solution to this, but just as in this case they will start to fail after the higher priority branch they abort into fails even once.
The abstract minimal repro case / explanation of the issue could be many things, but in our case the first gameplay use-cases where the Behavior Tree just seems to not work as expected and needed was when there's a high-priority sequence like "a condition for distance to target, an attack action that can hit or miss which, if successful, is followed by something triggered by the hit like damage or a Timeline", and a low-priority branch like idling or wandering about. If the attack sequence returns a failure (attack missing mid-sequence), the low-priority Idle branch goes on and the attack branch will only ever conditionally abort and resume if the distance-check condition changes values back to failure and success again; remaining close to the target will lock the BT into Idle, even though the distance-check condition would be successful and conditional abort could be reasonably expected to cause abort to retrying the attack as long as we stay in range.
Any insight would be highly appreciated!