Onlyreon
matthewmatosis from patreon
matthewmatosis patreon

State Machine Work in Progress

🕑 Added 2021-08-06 10:31:00 +0000 UTC
State Machine Work in Progress

Comments

David

This was a pleasant surprise, was nice to hear your commentary on something again. I wish you luck with your future projects

Oh and if your FSM is currently all in one function/class you might not have Enter, Update and Exit loops for each state. This has also been invaluable, keeping everything easily organized.

Great progress Matthew. I wonder have you looked into Hierarchical Finite State Machines? It's just another layer of abstraction which slightly complicates the initial setup but greatly reduces the time spent implementing functions that work across different states. It works on class inheritance. So "Walking", "Crouching, "Running" all inherit from "Grounded"; "Jumping", "Air Attack" etc inherit from "InAir". Might not be necessary for your project or you may already be using it, not sure exactly how yours is working behind the scenes. But I'm working on my first game now and using an HSM for my player has made prototyping new actions heaps easier. So now if I need to check if the player is grounded I can just run a check for the flag that's set while in a substate of Grounded, instead of checking for each grounded State. And if I want functionality shared across all substates of Grounded I can just implement the new function in Grounded, rather than having to implement it in each grounded State. That's wordy but hopefully you catch my drift. So yeah if you're just making a ClassicVania this might not be necessary but in my game for instance I just added attack functionality that changes the attack type based on whether the attack was issued while standing/walking, crouching, or running. I only had to add it in the GroundedState class and it magically worked in whatever substate I called it from.


More Creators