Skip to content

Behavior trees Parallel components clearing Sequences #132

@SamuraiJones0

Description

@SamuraiJones0

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions