I am creating a Player character for my game that at its core has 4 States. Idle, Moving, Attacking and Defending.
The problem I am facing is mixed states. For example when a player moves and attacks what will happen. From my understanding a HSM (Hierarchical State Machine) would have the 4 core states, and each state would represent a smaller state machine.
Assuming the master state machine (first image) and sub state machine for movement (second image). In order to implement a "move attack state" Would I need to create a separate state machine for mixed actions? Or implement it to either the "Move" or "Attack" sub state machine?
On the other hand. Using (SSM) Stacked State Machines, from my understanding would mean that we still have a default state machine (first image), however we run concurrently additional ones. In this case, how would we handle mixed actions (for example, attacking while moving, dashing while airborne)? Would we assume a common state for moving and attacking that is made up of a machine for movement and one for attacking and transition between the two?
Which do you think would be better in a matter of scalability. Or perhaps which would be easier to append to in the future?
Thanks in advance!