Cleaning Up State Machine Spaghetti

The blend based on int value was my issue as well. That’s what I originally tried to do and failed with, then I recently tried again using the bool value in your first image and it seemed to work fine, so I figured I just screwed it up the first time when using blend by int.

Maybe it’s actually bugged though. I wonder if I could use blend by bool like 8 times in a row :smiley:

Sir, you want to take the responsibility to post that bug or should I? :slight_smile:
At least I hope it’s a bug, worst case we learn how to do it properly.

As for 8 bools, let us know if you try :slight_smile:

I’ll post it. I’m pretty slammed at work through Christmas, but I hope to try the 8-bool approach soon :slight_smile:

Posted.

Thanks for the link, really hope it’s only a bug, or maybe a not finished feature and soon it will work. Even now the animation system in UE is fantastic, if this feature would be fixed, it would be getting quite close to being perfect :slight_smile:

Select is not supported in animations like that. You HAVE TO use a blend.

I’m just starting out, but one of the things I’m doing now in this early phase to mitigate complexity is making sure that logical animation state is controlled by a single enum in code. I then use a single conduit to transition to any state based on that one enum. The anim state machine will transition out back to the conduit if that enum changes into one that is not meant for that state.

This is a very early example…
starburst pattern

In short, I made sure that all gameplay logic existed outside of this AnimGraph and only in code.

Sticking with this single-enum starburst pattern allows me to add states with no dependency on current state since that complexity is handled by code, which is way easier to manage than boxes and lines. If code is not an option, you may still benefit from this type of pattern by managing that enum in a separate blueprint that decouples gameplay logic from animation logic.

So, I also did a research before getting into that spaghetti mess. I would add to conduits and selects, also nested State Machines. I found this example, that shows how a complicated state machine can be split into multiple: UE4 Adventure Kit v2.0 Integration Tutorial - 07 - Anim Blueprint - Anim Graph - YouTube

This might be the best solution to this problem. It makes the state machine more organizable and more generic, yet it sacrifices flexibility for specific requirements. For instance, if I have a very special animation to only handle the transition from “Jumping” to “Dead” it might need extra care for this structure. But compared to managing an unreadable spaghetti mess, I’d rather have those extra work!

Oh wow, this is exactly what I’ve been looking for! Thanks so much for this comment.

For anyone directed here from search results, Flash7’s link is probably what you’re looking for!