Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Behavior trees Parallel components clearing Sequences #132

Open
SamuraiJones0 opened this issue Oct 4, 2023 · 0 comments
Open

Behavior trees Parallel components clearing Sequences #132

SamuraiJones0 opened this issue Oct 4, 2023 · 0 comments

Comments

@SamuraiJones0
Copy link

SamuraiJones0 commented Oct 4, 2023

I believe this is a dead library, so I'm writing this more for other devs who might stumble on this issue, but I'd be thrilled if it was to get fixed. I'm using the 1.8.2 version of gdx-ai (latest version as of now).

I've found the problem in the library... and while there's a simple obvious fix to solve for my configuration, I'm unsure if it'd break other configurations.

My issue presents as my tree running once and then freezing up.... subsequent Tree.step() calls appear to do nothing.

I'm setting my trees up using parser with the external .btree file. My Behavior tree appears like so: (I'm not including paths or detailed descriptions of my leafs as that's unimportant):

root
sequence
parallel policy:"Sequence" orchestrator:"Join"
cooldown
sequence
getTarget Range:10
rotateToTarget Range:10 RotateSpeed:360
turretShootLeaf

(I'll include this as a screenshot so indents show up)
image

It appears that when the parallel task has its first success, it resets all its children. (com/badlogic/gdx/ai/btree/branch/Parallel.java line 223). However, when the inner sequence is reset though, it removes all children (com/badlogic/gdx/ai/btree/BranchTask.java, line 76). Children never get re-added.

In the debugger pics below, you can see that on the first pass, the sequence contains the two leafs. In the 2nd pic, you can see the sequence about to clear its children. In the 3rd pic, you can see that on the 2nd run, that task has no children.

image

image

image

So to summarize, in my app after the parallel task succeeds, the inner sequence's children (getTarget & rotateToTarget) are removed, and thus my inner sequence has no children, and thus tree.step() does nothing. As a workaround, I'm going to suggest that sequences (and probably other task that subclasses off BranchTask) never live nested directly under a parallel task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant