Reply To: What exactly is a dynamic node?

NodeCanvas Forums General Discussion What exactly is a dynamic node? Reply To: What exactly is a dynamic node?

#9273
Gavalakis
Keymaster

The Dynamic setting in either BT node is indeed to revaluate lower priority child nodes for their Status changes.
Depending on the node type, this might have different effect relative to how they work. So for example:

What a normal Sequencer does is that it exectus it’s child nodes in order. If one returns Failure, the sequencer stops and returns Failure as well.

A Dynamic Sequncer will do the same, BUT, lower priority child nodes (those already executed) will be re-valuated. As such if either of them change to Failure, the sequencer will interrup the currently running node and return Failure immediately.

Take this example:

Sequencer
–Condition (if x == true)
–Action (Wait 3 days)

A normal sequencer will evaluate the condition once. Lets suppose that x is true, so the sequencer will continue executing the action which will be Running for 3 days. If within that period x becomes false, it wont matter for the sequencer. The action will have to be completed before x is revaluated.

A Dynamic Sequencer though, even while that super long action is running, if x becomes false at any point, it will iterrupt/stop that super long action and return Failure immediately.

A more game-ish example:

Sequencer
–Condition (HP > 50)
–Action (Go to $target)

So with a normal sequencer, here the agent will move to $target if his HP is > 50. If while moving the agent got hit reducing his HP to less than 50, again it won’t matter with the normal sequencer. The agent will move to target no matter what.

If the Sequencer was Dynamic, as soon as the agent’s HP drop lower than 50, the GoTo action will stop running and the Sequencer will also return Failure.

I hope that silly example helps 🙂

Join us on Discord: https://discord.gg/97q2Rjh