I'm building a little Player Controller for my new 2D game. I have all the basic things setup and now I would like to get into player state management and anim sincronization.

My player will be able to Walk, Run, Jump and Crouch and at the same time use different weapons and take damage in any of these states.

In the past, I have been handling all that in a really archaic way and would like to improve a bit the modularity of my state management. So, I have spent a couple of days reading a bit about HFSM, Behaviour trees, etc. And finally I have decided to use something pretty simple: several state machines to cover all the different things that my player can do at the same time. As an example, my player could be jumping, firing and taking damage.

So, I will be using 3 state machines one for the locomotion states, another for the shooting/combo management state (Attack) and finally another one for the damage state of my player.

Beside the internal state of my player (That will be the agregated states of the 3 FSMs), each state will be posting diffent data to the Unity animation graph through properties to have my animations in sync with the real player state. I have been doing some tests and it seems feasible to do it that way.

So, my question is: Before starting to implement all this mess, have anyone tried this aproach? Is there anything important I haven't noticed that could lead me to hit a wall too late and dump a lot of work?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.