Link class variable to blackboard in Behaviour Tree

Is there a way to link a class variable to a blackboard key? For example, I have a critter class and a fear level property (how scared the critter is). Having fear as a property of the creature is useful in various places. For creating a behavior tree, however, it would be convenient to use the fear level in decorators. But it looks like decoraters only work with blackboard entries.

Is there a way to either use the class variable/property in the behavior tree decorator or make the blackboard entry point to the class variable?

Thanks

It’s not really possible to have blackboard entry point at specified property and still have all blackboard functionality working (I’m thinking mostly about event-driven observing of value changes). However I can easily imagine implementing a special C++ structure that would wrap up access to specified key and with smart functions would allow users (both C++ and BP) easily access data (in a read-write fashion).

A splendid idea! I’ll give it a try today :smiley:

Cheers,

–mieszko

Thanks. I didn’t know that.

Before you go and write a class, I have an idea: what if you create a blackboard asset for your characters desired properties, create a custom AIController, have the AIController use your custom blackboard. The behaviour tree will then use that blackboard, and you can then access the blackboard value by taking the character, getting the AIController, getting the blackboard from the AIController (using GetBlackboard). This will basically let you have something like a character property usable in the behaviour tree. If desired, you could create smart functions (both C++ and BP) to simplify the process of getting/setting the desired property via the AIController/Blackboard.

Of course, maybe that is what you meant and I just managed to think through it. Thanks again for your answer.

-X

What you describe is basically the current way of using BlackBoard, maybe except to the convenient interface. What I’m thinking about is a simple to use property type you “bind” to your blackboard and then, at runtime, you use it just like any other property, but the information is being stored in blackboard so that BT can easily access it.