Different approaches to animal AI

Hello

I’m making creating an animal ai and want some insight/ suggestions different ways to do it.
I have the basics working eat sleep hunger and roaming around the level. I got the basic frame work from Matt Aspland tutorial series How To Create An Animal AI In Unreal Engine 4. The tutorial is great!
I also watch some tutorials on behavior tree’s. My question is what approach would work best? Below are some examples of how things look so far.


This is how the ai decides different actions. Is it tired/scared hungry thirsty.

Any general insight pros and cons into different approaches to AI would be great to hear.

Cheers
Ben

1 Like

Behavior trees are much more flexible when it comes to decision making. You can have specific conditions to cancel branches (with added priorities).
You also have sequences that can chain behaviors.

1 Like

Hey 3dRaven,

Okay great thanks for the response.

The reason I found the custom event more straight forward was referencing all the variables, such as Hunger Thirst and Energy. Do you know how I could easily reference theses variables in the behavior tree?

An example would be when hunger is =<30 look for food. In the current set up I have a function sets a Boolean to true if the hunger is =<30. The AI will then search for food on the map. I have the finding the food set up as a task in the behavior tree and that works fine. How would I get the Behavior tree to see that the Hunger is set to 30?

Cheers

Ben

@BenP3D Yes you can use variables in conjunction with Blackboards.
It’s a container of variables that goes hand in hand with behavior trees.

You can modify Blackboard variables either in the tree or externally in blueprints (for instance in your animal bp)

Behavior trees also have services and decorators to decide on branch behaviors, they can be stacked to have multiple situations cover a specific situation.

It can get rather complex so a youtube tutorial would help. This is a pretty extensive one

3 Likes

Thanks @3dRaven I will take a look at this tutorial.