Download

Behavior Trees, looking for good examples and advice

Just a quick question here, I’m trying to figure out the best way to create an AI for a flying game and I ran into Behavior Trees. At first glance they seem to be pretty cool but I haven’t really found a good example of their usage.

The documentation ( https://docs.unrealengine.com/latest/INT/Engine/AI/BehaviorTrees/QuickStart/index.html ) starts with creating NavMesh bounds - but since I’m creating a flying game, there’s no real NavMesh to use.
Is there an example where Behavior Trees are used with a non-character Actor, and are the Behavior Trees only designed to work with NavMeshes - ie. can I use them for a flying game or do I just need to use basic blueprints?

You can use Behavior Trees in any way you like. They will work with every setting.

However fairly obviously the normal movement nodes won’t. That’s why usually a nav mesh is created. Otherwise you will have to code this yourself (which certainly is possible).
Think of BTs this way: They are nothing more than a sequence and a few branches of all actions a unit can do. Basically it selects what to do next each call and then does exactly that. You are not forced to use navigation or movement at all!

Though as a little tip. If you wanna implement this for your flying game you might want to go through some tutorials completely to get the hang of everything especially decorators and services.

I don’t remember any great tutorials right now but I hope this helps a bit as well.

Cheers

Thanks for the tips Erasio! I’ll dig deeper into BT docs now that I know I can use them they way I want :slight_smile:

I am not sure if this series will help, but explained a lot to me. It is 1st person, but if it gives you the basics, you should be able to adopt.

BT’s are a general decision making architecture and work fine for flying type games. What you’ll need to do though, is figure out a movement component that you can give movement orders to. There’s a new system Mieszko is working on called Actions, which I think will be useful in that area (you might want to look at them when they finally go into the main codebase) which means you’ll be able to have actions that control your flying objects (i.e. like the MoveTo node, but for your own flying movement actions).

The main issue is that you’ll have to implement some method of doing collision avoidance for your flying vehicles. Which is not trivial to do. Once you have that in place, then the AI will be relatively simple for most things.

Peter Newton does a good job of going over setting up AI in this playlist.

There’s also another playlist of his that describes Flying AI