libgdx/gdx-ai

Sample of "exhaust" loop

scooterman opened this issue · 3 comments

Here is the gist: https://gist.github.com/scooterman/b03dfe1560cfc3b977a3

This is how I've implemented the loop (as a branch, heh) that suffices my needs. I'm asking for guidance (if there is a desire to use it on the main lib) on how to integrate it. The first thing should be able pass the leaf as a parameter instead of the first child, something like:

exhaust leaf: "entitiesInRange"

A few thoughts

  • passing a task as a parameter to another task is not a good idea.
  • the entitiesInRange task is a leaf in your example but in general it could be an entire sub-tree.
  • looks weird to me that entitiesInRange has to return status RUNNING to make the other siblings run.

Thanks,

passing a task as a parameter to another task is not a good idea.

I know but the semantic gets a little blurry by relying on the first leaf, no?

the entitiesInRange task is a leaf in your example but in general it could be an entire sub-tree.
looks weird to me that entitiesInRange has to return status RUNNING to make the other siblings run.

That's true, changing to SUCCESS will enable a deep tree of validation. I don't remember why I've opted for RUNNING anymore heh

Looks like something you can do with a dynamic guard selector