1
\$\begingroup\$

Assume i've a BT like the following

    [A]
   / | \
[B] [C] [D]
  • A = Selector (Priority node)
  • B = Perception task
  • C = Idle task
  • D = Walk to point task

The reason the tree looks like this is because B has priority over C and D since it should trigger alert procedures. In short, what i'm trying to model here is that the Agent sensors must have priority over behaviours.

Assume now the agent is in D and this node will continue returning running until the destination point is reached.

While D is running, something might happen (i.e. npc see or hear something) that should break the current operation ASAP but, D will go on regardless until its done.

I know i could paste the sensors code on top of each tree leaf, like for example

// kinda javaish pseudo code
void run() {
    // The node running method
    if (this.sensors.alert()) {
        return this.fail();
    }

    // Else, keep going.
    if (! this.reachedGoal()) {
        // do the walking
        return this.running();
    }

    return this.success();
}

, but in that way the "alert" behaviour is kinda hardcoded and out of the tree logic.

What solution do you suggest?

p.s. no behaviour tree tag in here? weird :/

\$\endgroup\$
  • \$\begingroup\$ Are you using some library or framework for the implementation of the BT? Are you building your own BTs? \$\endgroup\$ – Leo Mar 6 '18 at 15:29
  • \$\begingroup\$ I was using an external library. I think i ended up coding a custom composite node type with the purpose of intercepting each tick and running the appropriate sensors \$\endgroup\$ – brazorf Mar 7 '18 at 9:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.