State of Modular Behavior Trees and AI in General

I just started working with Lumberyard and have some questions after digging through the documentation. I’m finding the sections regarding MBTs and AI in general fairly confusing, and while I think I understand what’s going on now, I was hoping to have some confirmation before I really commit to a direction.

If I’m reading all the various sources correctly, once upon a time, LY had a MBT implementation that came over from CryEngine. That implementation is pretty closely tied to their AI code, though, in particular ScriptBind_AI that gives you all the calls that would let you interact through Lua. All of that is part of Legacy code.

At some point, a new Behavior Tree component was created, which is what you can now set up through the LY Editor. It’s part of the ComponentEntity system, and allows you to start and stop it and set boolean variables on it through the usual Bus.

However… Most of the nodes available for the tree have a dependency on the old AI system. For example, the Move node allows you to go to the current “attention target”, and I don’t see any references to an “attention target” outside of CryAISystem. Furthermore, I’ve been unable to get any of the Lua nodes to work, which was indicated in one of the two node reference so isn’t terribly surprising. So it seems like MBTs are a thing, but most of the existing nodes aren’t viable at the moment.

So my conclusion at this point is that I have one of three options:

  1. Get CryAISystem building into the project so that I get the AI functions to make the MBT functional. Seems like that’s a step away from where LY is trying to go though, and I’d still expect issues trying to get anything Lua related to work.
  2. Try to write my own nodes that do… Well, pretty much whatever I want them to. Downside of this is that without the ability to call into Lua from the MBTs, I expect things to get hairy at times.
  3. Forget about MBTs for the moment and follow the StarterGame’s example of using a state machine. I’d prefer to use MBTs, but if the tech is in an awkward state right now (as it really seems like it is) I can always wait and rewrite it later. This is a project purely for my own entertainment, so I’m willing to wait if that’s the best option.

Thoughts? Comments? Other options?

hi! you can try to implement your own BT on ScriptCanvas nodes )

True, though my assumption is that at some point, the LY team will be implementing something like that. And personally, I expect to spend more of my time in Lua than in Script Canvas as I’m one of those odd people who finds the visual layer somewhere between unneeded and annoying.

Your comment did make me twist my thinking a bit though… I realized that I should be able to make my nodes talk to Script Canvas or Lua or whatever I want to talk to. I should be able to use Script Events rather than those ScriptBind_AI calls, and then build custom nodes that work against those events/a data store populated by those events.

So barring further feedback, I’m strongly leaning towards option 2. Just need to wrap my head around how exactly that’s going to work.