Download

Are state machines used for gameplay logic Fortnite or previous titles made by Epic?

I always found it rewarding to follow the patterns utilized by Epic Games in building their games when working on my own project but what’s been bugging me lately as I’ve been optimizing and refactoring my game logic is that there’s a complete absence of state machines or anything like that.
Is there any insight on whether state machines are utilized at Epic Games?

Epic has more than a few videos on Youtube demonstrating the animation BP as to the logic used in Fortnite. There is one that shows the migration pathways and from what I’ve seen the use of state machines is used in a limited manner as to correctly stage sequences in a proper manner, like jumping where three sequences are required for a complete jump.

I tried to find it but there is to many now to find just the one.

So yes state machines are used by Epic in their games but to an extent that they are not used in the same manner as I’ve seen in a lot of example files in comparison to new features Epic has added in the years since they did the walk through.

That said with new feature additions like the game play plug in and component preference as to character control will make the use of state machines rather redundant as the means to make state changes. To put things into perspective the manner in which character control is managed is out of date, still, and similar in design as to developing a web page using note pad as to other option that should already be available by now.

That’s because the “example” files are part of the “BAD LEARNING” that epic pushes onto the user base which the users are unaware of until they bash their heads against optimization.

Well, yes and no.
State Machines will always be relevant. No matter how you spin it, there’s always going to be situations where a closed transition of sequences is preferred to an “open” one that can be changed at runtime.
Different uses = different tools.

The public would love to hear/see some samples from the actual Fortnite devs, but You’ll likely never hear from them on this or any other forum.
And even in their private blogs, you still won’t get much of anything that’s not just an idiotic animation of the latest BS dance move they added XD

Yes this.

State machines have their place but tends to get over used to a point that tends to get over complex as compared to other better optimized options. It’s a “just make it work solution” that will fail at some point where the design gets to overloaded the more complex the design becomes.

Technically you can’t even check for <= of values before entering a transition.

Therefore even stuff like Turn In Place (for which there’s 5 1 hour long video tutorials on) is completely “wrong” and has to be re-adapted to work with best practices in mind.

Thing is, it’s not likely you or anyone will find a tutorial on how to do it “right” at all…
I honestly don’t even know if people like Laurent know what is “right” anymore…

Part of it has to do with the changes to the system, I’m sure.
But 99% of it is just outdated teaching that keeps on being thought.

I have an impression you’re talking about animation state machines and not hierarchical state machines for gameplay logic.

On that note, I have no idea what you’re on about in terms of optimization in either case, can you elaborate?
In both cases they’re super cheap to evaluate, no?

Echo is set-up really well for the most part, I believe her anim BP is a good example to follow.
You’ll probably rewrite the event graph into C++ for a packaged solution, but it’s still a great start IMO

Never tried Eco but none of the other paragon character are set up correctly.
Nor are any of the unreal official tutorials.

And yes, we were talking about state machines for animation - I’m about 90% certain this topic was in the animation sub section when I first replied?

Here’s a link on some elaboration you asked for.

As far as other types of state machines go.
Technically, isn’t every BP it’s own state machine?

You also have BhaviorTree and BlackBoard for AI which is closer to a finite state machine.
Completely different subject.
Actually one of the better ones of the engine in terms of ease of setup - however also prone to bad use situations / you really need to know them to do things correctly via setting up tasks that don’t cripple gameplay.

Hard question to answer as the correct answer depends on the “context” in which the logic is being applied. For just this example if using in-place animation the state change can only occur once the trigger event has occurred so is always behind the game state to begin with. This means that every fraction of a tic matters and a typical requirement to exit one state and move into another, in a state machine, is the animation has to wait for a exit argument to maintain sync. The more added the more latency occurs.
Best practice wise the animation state should never wait for trigger arguments nested with in the logic as they are no longer required with group and sync markers.
So yes in a way they are cheap but tend to “become” more expensive the more complex the design becomes.