State trees and blending animations for wildlife.

Hello,

I am a total beginner when it comes to gamedev with roughly three months of experience. I am building an AI system for wildlife using state trees and there are a few concepts that I am struggling with.

Concept 1.

What is the “proper” or should I say recommended way of implementing the animal behaviours when using state trees to run the AI? Do I implement interfaces for different animal categories (prey/predators and then implement these in the wildlife actors BP’s calling them from tasks in the state tree or create State Tree Tasks? I am struggling to understand what logic I should add to the state tree and what goes somewhere else. For example playing animations, VFX, SFX and everything else.

I have a simple state tree with basic wildlife behaviours and I am currently using STT for everything.

Concept 2.

Animation blending and having the pets turn around gracefully when wandering instead of snapping rotation towards the next destination. I have specifically struggeld with implementing the turn animations that came with the fab samples I downloaded.

I have the basic blendspace locomotion for walking and running. Then I tried to implement my own rotation logic that runs every tick. (disabled controller desired rotation and orient rotation to movement.) While this “works” it looks unatural due to the static skeleton mesh (head/body not turning in anticipation of the turn).

How are you supposed to implement something like this when animations exist?

Any comments are greatly appreciated.

Create state tree tasks to do your all/most behaviors. This keeps your actor BP super clean and lets you debug in the state tree debugger. Try to keep only the actor specific functionality in the actor BP, like setup stuff. If you break your tasks down enough you can call the VFX/SFX from there if it makes sense for your actor/game, for my game I tend to call gameplay cues from the task that manage that stuff over the network.

I think you’re on the right path using STT for everything.

I create parent STT for each actor type, do my context setup in EnterState there along with any needed helper functions, then inherit from that STT to create all the tasks for the actor’s behaviors.