UFSM: Finite State Machine

If you look a few posts earlier, you can see a new “red node” for Anim BP that make it possible for you to sync Anim States from ANY Animation Blueprint class.

But that node will not “Override” UFSM States, it only tries to sync by Name if the State exists.

https://forums.unrealengine.com/unreal-engine/marketplace/88276-ufsm-finite-state-machine?p=1457990#post1457990

Thanks, that’s awesome! I love your plugin a lot!)
By the way, I’ve been participating in a latest Ludum Dare event as a Compo (48 hour game in solo) and used UFSM plugin because… because it’s cool and I use it everywhere)
Check out the link if you are interested: https://ldjam.com/events/ludum-dare/41/solid-snake/
The blueprints are really messy because of lack of time but maybe someone would be interested to check it as a sample. The source link is in the description.
This game also got 1st place in 2 out of 3 categories in a local game jam that was going at the same time in Kyiv. Without ufsm it probably would be more time-consuming.

That’s a very “cute” and interesting design.
I played a bit, it’s fun and relaxing! :slight_smile:

I have plans to begin a major update for the plugin, focusing on implementing better in-editor tools.
When not using C++, the workflow is too much centered on the Details Panel and that’s not what a Details Panel is made for ^^

If everything goes as planned, Savior 2 will be successfully merged into the marketplace package of Savior 1.x plugins (marketplace packages are a little weird to work with), then by the end of this month I will be free to start implementing editor tools for UFSM that I’ve be willing to add since last year!
For now I won’t talk about it in details because I don’t even know yet if it’s going to work at all lol

Is there some documentation I’m missing? The links provided don’t tell you how to do a lot of necessary things such as creating transitions.

Also does it support states with transition time or do I have to do that manually?

Also there’s no option to disable blueprint auto flow? All it says in the docs is that it’s now enabled by default, but doesn’t say where the option is and I don’t see it anywhere. It doesn’t seem to work either, I looked at the source to see what it was expecting, gave it what it was expecting, and still gave a warning saying it couldn’t find it.

In the screenshots on the first page there is an HFSM but is that really outdated or currently not in the plugin?

A few posts above explain that “auto flow” only works when you create a Blueprint for your FSM Component then attach it to an Actor.

The settings can be found on Project Settings panel.

HFsm was removed and being reworked; Will be back only when all bugs are removed and docs redone.

Well… It would appear that i’m now a full-stack “” owner. Keep up the goodies dude :cool:
I just grew tired of playing with boolean replication in c++ for all my states, hope your plugin will help !

… This was the reason why I started this thingy at home :confused:
We were all “-man I’m sooo tired of creating booleans here and there then checking them here to match that one again… can’t we just have something to check animation states here in the BP graph ???”

Then I did this to stop doing that annoyance with booleans and stop flooding AnimBPs with AnimNotifies as well ^^


Oh and thank you very much for the support!

Thank you - was that in the docs and I just missed it?

Can I run an idea by you - for using the anim node graph you require a skeletal mesh + anim instance - so what if I add a skeletal mesh component that never has a mesh + an anim instance with a dummy skeleton purely for the use of the state machine? Is there any reason this isn’t a good way to do it?

Perhaps one day in the future you could consider adding a custom graph that doesn’t require a skeletal mesh or anim instance but mimics anim instance :slight_smile: Dungeon architect might be a good example of reusing graphs for plugin functionality

I’ve seen a designer do something like that before; I’m not sure exactly the “hacks” he did, but it works wonders because he hate to create his own “transition rule” functions in the Blueprint graph.

I actually do have a custom Graph. But it’s buggy like hell xD
The problem is I was “taken away” from working on it because a project had to focus on actual gameplay stuff instead of Editor extensions.

So I can’t work on it at the moment to make it really usable, but I didn’t give up on that and someday I will make it :slight_smile:
Meanwhile, I think I can also add to function generator button a way to generate “transition rule” functions in the BP graphs for the non hierarchical FSM Component while I can’t work on that one.

By the way, I can’t subclass Finite State Machine - it’s needed for auto-flow right?

It needs a custom “Factory”.
To use the custom Asset Factory, you have to right click Asset Browser and click this Icon to create a custom Blueprint:

Ahh I get it now. Thanks!

One more thing though… why the byte instead of a float here? Edit: Since you can use FSM: Get time it doesn’t matter but I’m curious


Edit: My god, blueprints actually feel like a viable option for involved systems with this

Do you think you could add something for me? To allow us to use a CPP enum instead of a BP enum. Because if I want all the BP auto flow functionality and in rare cases to check values in CPP it means creating same enum twice. I’ll provide example logic.

.h



UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Thing")
bool bEnumFromCPP;

UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Thing", meta = (EditCondition = "bEnumFromCPP"))
FString EnumName;

UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Thing", meta = (EditCondition = "!bEnumFromCPP", DisplayName = "Enum"))
UEnum* K2_Enum;

UPROPERTY()
Enum* Enum;

#if WITH_EDITOR
virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
#endif  // WITH_EDITOR

FORCEINLINE UEnum* GetEnum() const
{
    return (bEnumFromCPP) ? Enum : K2_Enum;
}


.cpp



#if WITH_EDITOR
static UEnum* EnumFromString(FString EnumString)
{
    return FindObject<UEnum>((UObject*)ANY_PACKAGE, *EnumString, true);
}

void UMyThing::PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent)
{
    Super::PostEditChangeProperty(PropertyChangedEvent);

    const bool bFromToggleCPP = GET_MEMBER_NAME_CHECKED(UMyThing, bEnumFromCPP).IsEqual(PropertyChangedEvent.GetPropertyName());
    const bool bFromEnumName = GET_MEMBER_NAME_CHECKED(UMyThing, EnumName).IsEqual(PropertyChangedEvent.GetPropertyName());

    if((bFromToggleCPP && bEnumFromCPP) || bFromEnumName)
    {
        Enum = EnumFromString(EnumName);
    }
}
#endif  // WITH_EDITOR


Yes, no problem.
Once I come back from another task I add that.

Thank you for showing me this!
This is actually a BUG in the #WITH_EDITOR reflection code (where I generate new functions from), I picked wrong type wildcard when that node is generated :s
I have fixed and will add to next update as well.

I have added automatic State Transitions to the “Auto Flow” schema of FSM Component Blueprints.
This has the exactly same result of you creating your own rule functions in Animation BP or BP Graph, but the difference is you don’t have to call them (“Set State” nodes) manually if you choose to enable this option for your project.
Although having the same effect, the way you design your Graphs might change when going this route:

They are grouped in Graph and prefixed with “<T>” followed by the State they are linked to.
Whenever the “Condition” result evaluates to “Succeeded” the FSM Component will trigger an Exit from Transition’s owner State (if that State is the currently active one) to the target State this trasition rule is pointing to (pretty much what Animation BP does, but with all Blueprint functions available to be used in the Graph).

If you choose to go this design pattern then the various helper “Evaluate” nodes are your friends here as well:

. [HR][/HR]
To enable this execution mode on your FSM Components, you’ll have to check to true the “Blueprint Auto Flow Transitions” on Project Settings Panel, as well as keeping “Blueprint Auto Flow FSM” enabled too:

Again, note that this basically inutilizes the “Set States” nodes if you design your FSM with this pattern, but it doesn’t prohibits you from keeping using them wherever you see fit. The “+Functions” button (only useful for FSM Blueprints) will also automatically generate transition functions for you if it sees you have checked “Blueprint Auto Flow Transitions” enabled.

This and fixed bug mentioned on previous post above will be in version 1.8.0 (for UE4.18+).

Hello, the launcher is showing an update to UFSM, what are the changes please?

Thanks.

Minor Bug Fix:

“Auto Activate” checkbox disabled had no effect on UE4.18 ~ UE4.19.
Now if “Auto Activate” on FSM Component is unchecked, the FSM won’t run until you call SetActive() function for that FSM Component.

In case you uncheck “Auto Activate” in Editor, when enabling the FSM Component again, make sure you do a ‘full’ initialization, like so:



SetActive(true,false);
SetIsReplicated(true);
SetComponentTickEnabled(true);


Great, thanks!

I’m getting an aborted state change and I’m not sure why. The state name exists. Is there a way to debug it or push out a reason for the abort?