BMASHINA is a behavior tree library providing an innovative “wire” method for moving input and output between nodes, compared to the traditional singleton blackboard of other popular behavior tree libraries. This greatly improves creating generic nodes.

For example, you can create an “Add” node with input “LEFT” and input “RIGHT” generating a single output “RESULT”, then wire the output from a “CountEnemies” node to a “SLAIN_ENEMIES” variable.

Advanced utilization of templates allows speedy execution with minimal virtual calls. Useful debugging utilities allow stepping though and debugging the tree state and individual nodes.

There is a Lua wrapper called LMASHINA that creates a generic DSL useful for writing nodes and trees in pure Lua. Existing native (C++) nodes can be used with Lua nodes if performance is an issue.

This library was used to created advanced AI in a bot for a popular online MMO. Currently, BMASHINA is used in the game ItsyRealm as the AI for all entities (“peeps”) in the game. See a live example of a script for an undead squid encounter here!