libgdx / gdx-ai

Artificial Intelligence framework for games based on libGDX or not. Features: Steering Behaviors, Formation Motion, Pathfinding, Behavior Trees and Finite State Machines
Apache License 2.0
1.18k stars 241 forks source link

Sample of "exhaust" loop #64

Closed scooterman closed 7 years ago

scooterman commented 8 years ago

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"

davebaol commented 8 years ago

A few thoughts

scooterman commented 8 years ago

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

davebaol commented 7 years ago

Looks like something you can do with a dynamic guard selector