I’ve upgraded to the latest 2.38. Everything is running perfectly.
I want to share something that I’ve found helps our project. We have hundreds of NPCs in our levels. I’ve built a few high level BTs that rely on subtrees on each sub-node. This allows us to dynamically change behavior by changing which subtree is bound at each node. This is by no means a unique solution to getting more flexibility out of trees. On each npc we currently bind about 15 different subtrees.
I’ve found that this is a good solution for reuse and extension, but one MAJOR downside is the load time required to build out the trees.
One of the first things I noticed was the JSON parsing of the trees is performed on each tree as it’s loaded/serialized. In our project I end up using the same subtree hundreds of times. I ended up caching the resulting JSON so that I didn’t have to incur the cost next time the tree needed to be used. This was a big gain if I remember correctly – I also ended up caching each unique tree type. I have a custom Graph.Clone method that deserialized the cached parsed json data into the new instance.
The next major hurdle I have is the Clone process for an entire tree takes a good amount of time. Last time I looked there is the graph, connections, variables, nodes… many moving parts that need to be cloned to get a graph truly duplicated as a new instance. I wish there was another way to Clone that didn’t involve as much work – I attempted to create a deep clone myself but quickly realized the extend of the workload – and stopped.
So, our load times are still better after caching the JSON data and deserializing the pre-parsed JSON, but I really am thinking about how to speed this up more. The only other idea I have atm is to bake the subtrees into a single full graph per NPC, but that’s an entirely new direction. I love using subtrees and dynamic binding.
Does anyone have another solution or an idea on how to speed up Clone?
Author
Posts
Viewing 1 post (of 1 total)
You must be logged in to reply to this topic.
Login
Register
By registering on this website you agree to our Privacy Policy.