libgdx/gdx-ai

Text format behavior trees defining args enhancement

NemesisMate opened this issue · 1 comments

I've been looking around but It doesn't seem to be possible to use variables when defining trees by text foramt. What I'm really trying is to do is, for example (taken from the "dog example"):

subtree name:"actOnYourOwn"
  selector
    (random success:0.1) piss
    parallel policy:"selector"
      wait seconds:"uniform,3,6"
      randomSelector
        wander gait:$(gaitType)
        wander gait:"walk"
        lieDown
        sit

Where I could import the "actOnYourOwn" tree in a manner that $(gaitType) would be replaced but a given value, allowing to create general tasks to be used by many different entity personalities.

TBH I don't think I'll have the time to implement your enhancement.
Also you can easily achieve a similar result by setting a property of the entity before including the tree.
For instance

subtree name:"actOnYourOwn"
  selector
    (random success:0.1) piss
    parallel policy:"selector"
      wait seconds:"uniform,3,6"
      randomSelector
        wanderUsingCurrentGait
        lieDown
        sit
...
setGait value:"run"
$actOnYourOwn
...
setGait value:"walk"
$actOnYourOwn