I've been straining my mind over how I could solve this problem in an efficient way.
I've recently started learning about behaviour trees and I really like them, and I thought they sounded really simple to make too. Well, they are if you want to make it for a single agent, as the execution happens on the actual structure. I want to separate the structure and the execution but I can't figure out how a good way might be.
I thought about having a behaviour tree class hierarchy that creates the structure, and separate classes with the same hierarchy but containing local data. So, the basic root node class, a sequence class, an action class, etc, all used to define the actual behaviour tree. Then these would individually create tasks that would store local data (such as the currently running node in a sequence), one for each agent. But I don't really like this, it sounds too annoying, and I'm thinking there might be a better way. A search on the internet is proving difficult.
I'm using C++ btw.