
Retro-Progress-6 – Fight moves
My character learnt to slash. This was time for Finite State Machine. This went so wrong at first. I mean it was robust and working without bug but it was so complicated it was started again from scratch.
Just for the story: I began with a lot of motivation, mapping states with pen and paper, thinking it through properly and came up with something that used, what I called ‘hierarchical states’ with sub-states imbricated in macro-states, and orthogonal states so the player have one state for how he is moving (running, jumping…), one state for what he is doing (attacking, casting…) and one state for his health condition (hurt, stun, dying…). I thought this was very smart, it was just over-complicated… at least for my brain. So I came back to one state system, and did not bother anymore on questions such as “does it really deserve a specific state or just a sprite”, I have moved on. It is not perfect but it gives structure.
So long story short, I can point you out to two great resources for finite state machine:
The TrueState asset from Pixelated Pope, ready to use: https://pixelatedpope.itch.io/
The articles from Stargrove faux-operative blog : http://fauxoperativegames.com/essential_function_guide/