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

BTRoot : setting blackboard from script does not use the given blackboard instance #19

Closed
Earewien opened this issue Jan 28, 2023 · 2 comments
Assignees

Comments

@Earewien
Copy link
Owner

Scenario:

  • Create a node
  • Add a BTRoot as child of this node, and some behavior tree logic in it
  • In another scene script, add an instance of the above node
  • Create a blackboard in script, add some values in it, and assign this blackboard to the node's tree
  • Run the scene

The assigned blackboard is not the same as the tree blackboard at runtime ; its a copy. By doing this, it's not possible to share a blackboard between trees if the blackboard is not assign from Godot Editor.

One way to fix that is to change blackboard type in BTRoot from BTBlackboard to NodePath, like the actor

@Earewien Earewien self-assigned this Jan 28, 2023
@Earewien Earewien added wontfix This will not be worked on and removed wontfix This will not be worked on labels Jan 29, 2023
@Earewien
Copy link
Owner Author

Some precisions:

  • We can't share a blackboard because, when setting the blackboard variable in BTRoot, it does not propagate to the real blackboard (_blackboard) : easy to fix
  • Once we do that, we can share a blackboard quite easily. BUT, there is still an issue ; trees that share the blackboard will store datas in it
    • When it's user data, it may be important or not, but it's shared
    • When this is a BTRoot, it contains data that make the tree work (running children ,...). We can't share that sort of thing

To solve that, the blackboard should have a sort of namespace in it ; when storing / retrieving data, you can set in which namespace the blackboard is working. Data in different namespaces should be totally separated.
To preserve the current API, the get_data and set_data can have a thrid parameter, namespace with a default value, to store datas in the default namespace.

Earewien added a commit that referenced this issue Jan 29, 2023
Fix setting blackboard bug in BTRoot
Add namespace in blackboar APIs
@Earewien
Copy link
Owner Author

Available in main branch :)

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

No branches or pull requests

1 participant