UFSM: Finite State Machine

I’ve uploaded an update to Gumroad which includes a custom Editor Graph panel.
Some was having issues trying to figure out FMS/HFSM relationships so I did a graph which automatically generates node trees based on the UComponent’s list of FSMs/States.
To open the visualizer, just push the “Visualize MACHINES” or “Visualize STATES” button on any selected FSM component, from its Details Panel.
Still working on docs though :s

Broadcasted Events’ signatures have been changed; it now outputs results for a simple transition rule (mainly for when you activate/deactivate a FSM component):

This will be final version for this tool for a while for now; still waiting on Epic to reply the submission :slight_smile:

WARNING:

Remove ALL FSM/HFSM Components from all Actor/Character blueprints you have instantiated in ANY of your MAPs. BEFORE updating to 1.3.3;
This version has changed broadcasting Events signatures to include a ‘Transition Rule’ field; if you have blueprints with FSM/HFSM using old Event signatures instantiated in you levels, project loading may crash.
If you’re not sure that you’ve remove ALL FSM components from actors, before updating to last version, make a project backup before updating FSM plugin to 1.3.3!

It would be nice to have some reference to a book or video about FSM vs HFSM to understand it better (for AI and for other things) or have a doc / tutorial for your plugin explaining the differences and which would apply better to difference real-life scenarios.

That’s really one thing that keeping me from using this plugin - how to use FSM/HFSM and when to use them (various scenarios in UE4).

In my current project, for example, I use a lot of branches just to check stuff (if/else stuff) and I don’t even have AI yet.

Hi, yes; I have difficulty when it comes to “teach” stuff because I have zero experience as a tutor. But I am working on docs and will build some of Epic’s default Character Controller tutorials remade to use FSM logic so developers will be able to compare by themselves.
I just am not good at tutoring like Zak is (and my spoken english is very bad) so I rely a lot on text to explain things; You can develop an entire game purely based on FSM systems so the topic is very very broad and I’m kind lost to explain how/where to use this; but given enough time I will put together a demo project based on Epics tutorials :slight_smile:

Meanwhile, this video here have a lot of useful information and also some cool examples of why and where would you use FSM or HFSM on your game project, I really liked this video by Jesse Warden:

Also EpicGames have a very good summary of what a State Machine is:

Bought it :smiley:

I was surprised Epic didn’t integrate a FSM template too.

Thank you :slight_smile:

I will start to write a small tutorial today, as soon as I come home from work.
I will take the default 3rd Person character blueprint and rewrite its functions to keep exactly the same behavior as before, but implemented completely by FSM Component…
And then show how easy it is to expand the controls with additional FSM States, adding double jumping capability and maybe also ladder climbing: without creating a single boolean variable for controller inputs!

At least that is the plan for a first tutorial. I’ll see how it goes :slight_smile:

My main goal with this tool was always focusing on keeping the blueprint graphs as clean as possible.
I wanted to get rid of all those junk variables scattering all over the place: if this, if that, bool here, branch that… this is not how I program in text code and it was annoying me a lot when using blueprints because it requires too many pointless variables to be created and managed.
Will start making the tutorial today, promise! :wink:

Okay; So, I’ve put together a little demo project with input controls based on FSM Component.
It’s a modification of the default 3rd Person game template to make the Character move and look around the same as before… plus it also can double jump and properly climb up a ladder, all based on FSM rules.
I did it one way, there are many other ways you could use the same FSM Component to do exactly the same though. Here’s a quicky video of the results:

And the main graph for the Character Blueprint, it ended being like this ( no more than 1 Variable to track, the FSM_Input component :smiley: ):

http://i1234.photobucket.com/albums/ff408/BrUnOXaVIeR/FSMDemo_BP1_zpswu1ponxo.jpg~original

And the FSM Component’s main graph, handling all the logic for processing inputs and performing actions while isolating them by State so then you can make many movement modes without any headaches:

http://i1234.photobucket.com/albums/ff408/BrUnOXaVIeR/FSMDemo_BP2_zpsgw0eqwrn.jpg~original


Edit:

You can find tutorial for this video and download demo project from here:

TUTORIAL AND DEMO PROJECT

Hello,
I am very interested in this plugin. I also think this should be integrated in the UE4 core.

Best regards,
Thank you.

Yes from what I’ve heard this have been asked for to Epic several times for the last 2 years, but for some reason the answer was always something along the lines: “-We don’t have FSM for Blueprints, you would have to make your own FSM from scratch for this.”; I’m not sure why though.
If not for that I would’ve submitted a pull request instead of making an addon for Marketplace.

Hey there,

Do you have any rough indication of when this will get added to the marketplace? I’m wanting to buy this, but I’d prefer not to buy it on gumroad unless a marketplace release is several months away.

Epic do not gives me any estimative time window of when they’ll add it to their catalog;
They did test project packaging with the Plugin then an internal Epic’s engineer helped me out to identify bugs (he found a little mistake I was making with ‘container invalidation’ in the main FSM class that got fixed) in the C++ source code and improve performance in general.
After that, they went silent and I still got no news about it.

Yeah, that’s the answer that I was kind of expecting to hear :(. It’s not a huge deal, I’m just not so much a fan of gumroad for game assets/tools. Thanks for the answer anyways!

On a side-note, have you considered putting this up for sale on itch.io? They have a tools/game assets section and it’s a really nice ecosystem. Here’s an example store page: https://gameappmakerco.itch.io/oldskooler

I will take a look at it; Didn’t even knew that exists, thanks!

Maybe @Smarkoff or @Reubitron could update us on status for this submission…

Hi there,

It looks like our review team has the update you sent and you should hear back from them soon! Let me know if you need anything else.

Thanks,

Stephanie

How is it going? I’m really eager to see this plugin!

Hey over there. It’s looking really interesting. In a lot of ways. Thank you for this, looking forward the marketplace release.

Will keep you posted if I make some tutorials about implementing this in a current project but nothing is less sure.

Keep up the great work, thank you!

Gg gl hf to all for your projects :slight_smile:

No news yet; Marketplace team is flooded with submissions :s

Thanks Yun-Kun!

Hi Bruno, I’m interested in this plugin, and I have a question that is not related to your plugin itself but the utilization of states machines in this situation:
Would you recommend a state machine to store events evolution in a game?

example:

  1. Player start game (initial state)
    1.a ->player takes some desitions in game → (state X)
    1.a.1 …
    1.b->player takes another desitions in game → (state Y)
    1.b.2 …
    etc

I’m just thinking in a way to store that information and I am wondering if state machines could be a good way.

I’m going to buy this plugin anyway =)

Thanks Bruno

Yes, before this I would have to store these decisions in the blueprint using common variables, like boolean or enums; that works, but after a while the Character blueprint becomes a mess with a ton of variables and the graph also grows like spaghetti.
Now I’m using State Machines for everything when programming Blueprint graphs. My variables in the character blueprint are State Machines only now and every time something is not working, is easy to pick which FSM the issue is and work on it without affect other elements of the character blueprint and without fear that I may be breaking something else…
This is for me personally the best decision I’ve made this year, I’m very very happy with the results so far for switching to State Machine based systems in my Blueprints!

(1.3.6): Blueprint Enum Support

Hello;
I have added support for easier use of Blueprint Enumerators to be used with FSM States.
With this update you can easily enumerate a FSM State by Enum instead of switch by name; here’s a quick setup info:

Create a Enumerator Blueprint, add named entries as you wish; like this example:

Open your FSM Blueprint graph and in its Details panel you shall see a new “Enumerator” field:

Assign to it your Enum Blueprint from Asset Browser:

The State list will update itself to reflect the list from your Enum Blueprint:

Now from any FSM Event, you can get the ‘Current State ID’ and cast it to your Enum Blueprint:

From there, you can freely call ‘Switch on Enum’ blueprint nodes and call your correct State Functions; This is much more scalable and easier to maintain then using Switch on Name nodes:


Note: If you change the items in your Enumerator Blueprint, to update the States list select again the Enum from Asset Browser and in the FSM blueprint click its Enumerator

so the States list will be up to date again.
Note: If you are using Animation Blueprints as Graph editor, this will be ignored by the Animation FSM!