You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am wondering how to correctly implement pooling with behavior trees and their tasks. I couldn't find an example anywhere.
From the documentation you should set the PooledBehaviorTreeLibrary to your manager. It also mentions that you should call disposeBehaviorTree to free the tree. Finally, it mentions something about a TASK_CLONER where I am not sure how that should be used.
What I got so far:
// create managerprivateval bTreeManager:BehaviorTreeLibraryManager=BehaviorTreeLibraryManager.getInstance()
// set the pooled library
bTreeManager.library =PooledBehaviorTreeLibrary()
// create a tree instance with a custom blackboard which gets also pooled
bTreeManager.createBehaviorTree(treeFilePath, blackboardPool.obtain())
The code above is working when getting called for the first time. The second time it throws an exception because the tree's root task is null after calling following code as a cleanup to the first call:
The reason is, that the reset method of a BehaviorTree simply sets it root to null. When making now a second call to createBehaviorTree it returns the previous instance but doesn't initialize the root correctly in my opinion.
Is this intended?
Also, from my understanding any tasks created by createBehaviorTree are not managed by a Pool and I don't see any logic in BehaviorTree which would reset or free its tasks. How is it inteded to be used?
The text was updated successfully, but these errors were encountered:
Hi,
I am wondering how to correctly implement pooling with behavior trees and their tasks. I couldn't find an example anywhere.
From the documentation you should set the
PooledBehaviorTreeLibrary
to your manager. It also mentions that you should calldisposeBehaviorTree
to free the tree. Finally, it mentions something about aTASK_CLONER
where I am not sure how that should be used.What I got so far:
The code above is working when getting called for the first time. The second time it throws an exception because the tree's root task is null after calling following code as a cleanup to the first call:
blackboardPool.free(behaviorTree.`object`) bTreeManager.disposeBehaviorTree(treeFilePath, behaviorTree)
The reason is, that the
reset
method of aBehaviorTree
simply sets it root to null. When making now a second call tocreateBehaviorTree
it returns the previous instance but doesn't initialize the root correctly in my opinion.Is this intended?
Also, from my understanding any tasks created by
createBehaviorTree
are not managed by aPool
and I don't see any logic inBehaviorTree
which wouldreset
orfree
its tasks. How is it inteded to be used?The text was updated successfully, but these errors were encountered: