What are the advantages of using a Behavior Tree if you are not using a navmesh and are prototyping boss fights? It seems easier to just make a state machine using blueprints for most of the things I want to accomplish, and I become confused when something should be in the Behavior Tree (i.e. animations) or else where, I also find it annoying that you cannot get blackboard values from tasks and services but only set them.
First of all - you CAN get values from tasks and services.
That being said, once it actually “clicks”, using Behavior Trees becomes much more intuitive than shoehorning the state machine into BP, effectively reinventing the wheel. Think of the Behavior Tree as your AI’s brain. It’s the AI’s abstract decision making process. How you communicate between the Behavior Tree and your animations is something you need to solve in your pipeline. Here’s how I do it:
In order to avoid having my AI cast to my pawn class (i.e. the tree becomes reusable) I have a CombatComponent where all my combat logic lives. In it I have a StartAttack() function with a few parameters (attack index for one). That function in turn, if the attack has been started successfully, calls a OnAttackStart delegate, to which my Anim Blueprint is subscribed. It will then select the correct animation based on the selected attack.
Awesome. Thanks for the thoughtful replay - I think you are right I just need to get my head in the AI BT mindset and then things should move from there. Using delegates for the animations also seems like a very solid idea - noted.