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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TaskAttributes do not appear to populate Tasks for included subtrees

exertionriver opened this issue · comments

The following issue appears on gdx-ai v1.8.2, developing in Kotlin.

Summary in the title. Apologies in advance for all the code snippets below, it seems to be the best way to show what is going on.

Issue does not appear directly related to Kotlin/private field TaskAttribute issue since attributes populate in Kotlin for full root with @JvmField

first tree created from:

import isAwake?:"org.river.exertion.btree.v0_1.task_cond.IsAwakeCondition"

subtree name:"testSubTree"
    selector
        (isAwake? minAwake:0.2 maxAwake:0.7) isAwake? minAwake:0.2 maxAwake:0.3

root
    sequence
        $testSubTree

using:

    private fun initFullRoot() {
        val reader = FileReader(fullRootPath)
        val parser = BehaviorTreeParser<IBTCharacter>(BehaviorTreeParser.DEBUG_HIGH)
        character.tree = parser.parse(reader, character)
    }

second tree created from:

import notAbsorbedPlaceholder:"org.river.exertion.btree.v0_1.placeholder.NotAbsorbedPlaceholder"

root
    sequence
        notAbsorbedPlaceholder

and

import isAwake?:"org.river.exertion.btree.v0_1.task_cond.IsAwakeCondition"

root
    selector
        (isAwake? minAwake:0.2 maxAwake:0.7) isAwake? minAwake:0.2 maxAwake:0.3

using:

    private fun initFragRoot() {
        val reader = FileReader(fragRootPath)
        val parser = BehaviorTreeParser<IBTCharacter>(BehaviorTreeParser.DEBUG_HIGH)
        character.tree = parser.parse(reader, character)
    }

    private fun initFragSubtree() {
        fragRootLocation().addChild(Include<IBTCharacter?>().apply {
            this.subtree = fragSubtreePath; this.lazy = true
        })
    }

running:

    @Test
    fun testFullRoot() {
        initFullRoot()
        character.tree.step()
    }

yields:

<IsAwakeCondition> none-1013847396 true (0.2, 0.7)
<IsAwakeCondition> none-1013847396 false (0.2, 0.3)

while running:

    @Test
    fun testIncludeSubtree() {
        initFragRoot()
        initFragSubtree()
        character.tree.step()
    }

yields:

<IsAwakeCondition> none162781535 true (0.0, 1.0)
<IsAwakeCondition> none162781535 true (0.0, 1.0)

Are Included subtrees parsed differently than BehaviorTreeParser parsed subtrees..?