After watching the recent Advanced AI stream, and also stumbling on this call to arms from zoombapup, I decided to have a first attempt at extending engine functionality.
I don’t have any behavior tree experience prior to UE4, so I still don’t have a clear understanding of how they are best structured. That said, it seemed to me that a way to easily introduce randomness and weighting into task selection was something that could be widely useful. I decided to fork the engine repo and poke around a little. I got a bit carried away (despite some of the hairiest code I’ve ever seen on the BT graph editor side of things) and a couple of days later have come up with the following.
There are more details in the readme in the forked repo, but basically it works as follows.
- An extra composite node type, Utility.
- Children of this node have a utility function attached. This provides the utility value for the child, through a constant, blackboard key or custom blueprint logic.
- The Utility node will choose one child to execute - either using a proportional (weighted) selection method, or one which simply always selects the highest utility.
If anyone has any input on if/how they might use such a feature, how they’d expect it to work, or anything related really, please let me know. And if anyone is interested enough and able to merge in the changes (make sure to merge from bt_utility branch) to their local engine source and give it a test, even better.