behavior3 / behavior3js

Behavior3 client library for Javascript (Behavior Trees for Javascript)
MIT License
398 stars 105 forks source link

Question: Selector node #11

Closed EskelCz closed 8 years ago

EskelCz commented 8 years ago

@renatopp: From everything I've read about behavior trees, probably the main logic node is the Selector. But in this library I don't see such class. Is it called something else? I'm new to this, sorry if this is a stupid question. In the linked paper it is stated as well and I thought the library is supposed to be consistent with it.

Anyway, thank you for a great library. I'm gonna try to build something great with it. :)

renatopp commented 8 years ago

Hey @EskelCz, Selector is sometimes referred as Priority, the name we use here. I always get confused when people use selector and sequence - priority avoid this kind of confusion.

I'm closing this issue, feel free to comment or reopen it if necessary.

EskelCz commented 8 years ago

Hi @renatopp, thanks for the answer.

I got the impression that Sequence is meant to call all nodes in you know, a sequence... but Selector to select just one. Hence the Selector. :)

I imagined a selector 'isEnemyNear' which would activate either actions 'idle' or 'run' based on some distance measuring logic. The simplest example imaginable.

From what I read in the documentation, the priority node seems to require the logic to be in the children, as to return SUCCESS or FAILURE to decide the tick propagation. Because I imagined the 'run' would always return success. Should there be another layer of nodes with the distance checking logic, before actions?

Or is it that ticking does not equal running the action? I'm confused :)

The simple example would help tremendously. Preferably with a node graph exported from the editor and the logic attached in code. That's a puzzler as well. :)

Thank you very much for clearing this out.

EskelCz commented 8 years ago

I've read some more about the topic, I see how I was wrong. I recommend explanations and examples from this library: https://github.com/libgdx/gdx-ai/wiki/Behavior-Trees