beehave icon indicating copy to clipboard operation
beehave copied to clipboard

ReactiveSequence

Open creadicted opened this issue 2 years ago • 1 comments

Is your feature request related to a problem? Please describe. I have a sequence. Something like:

  • Get the closest object
  • Walk to the closest object
  • Interact with object

During the walk, the closest object can change. So how do I let the previous sequence nodes run if the 'Walk to the closest object' is RUNNING . From other behavior tree implementations, I learned about the ReactiveSequence.

Type of ControlNode Child returns FAILURE Child returns RUNNING
Sequence Restart Tick again
ReactiveSequence Restart Restart
SequenceStar Tick again Tick again
  • "Restart" means that the entire sequence is restarted from the first child of the list.
  • "Tick again" means that the next time the sequence is ticked, the same child is ticked again. Previous sibling, which returned SUCCESS already, are not ticked again. (Source: https://www.behaviortree.dev/sequencenode/)

Describe the solution you'd like A new node that follows the specification of the reactive sequence. If a leaf returns "Running" the previous children are ticked as well.

creadicted avatar Sep 16 '22 13:09 creadicted

I just realized that the current implementation of Sequence is the same way as the proposed ReactiveSequence. This leads to the question if we want to add the ReactiveSequence and change the sequence? Or keep it as it is...

creadicted avatar Sep 16 '22 13:09 creadicted

In terms of naming, I am rather hesitant to rename any node classes as this would break things for people. I aim to not do any major renaming. Perhaps in future, this might be something we want to consider when building a "2.0" version.

bitbrain avatar Sep 23 '22 15:09 bitbrain

@creadicted to avoid breaking compatibility, we could also introduce a new attribute to Sequence that says "reactive" and is set to true by default.

People can then untick it to change the behaviour, so when a child is running it ticks again instead.

bitbrain avatar Dec 12 '22 18:12 bitbrain

@bitbrain Maybe we should break compatibility now, that is before the plugin is published on AssetLib for Godot 4?

The current implementation is really confusing, because external behavior tree guides/docs suggest that the basic Sequence node should retick if child node returns RUNNING state, while in Beehave's implementation it restarts. Beehave's SequenceStar behaves like basic Sequence node should, but then there's no real SequenceStar, which should retick for both FAILURE and RUNNING states of its child nodes.

Wichamir avatar Dec 17 '22 23:12 Wichamir