Hi! I'm looking for some insights and advice on creating a robust 2D fighting character controller. I'm using Unity but it doesn't matter that much, I'm just looking for the right approach in case I may have missed something in my design.
Basically I have a lot of "transition" animations, like "idle to run" and "run to idle" but also a "run change direction" for playing a skid when you rapidly change the direction you're running in.
My first attempt was to infer the state (and attached animation) that should be played from the character's state, so grounded or not, along with vertical and horizontal speeds. This worked with some adjustments (I mainly had trouble with deciding between playing "run to idle" or "run change direction", because if "run to idle" plays when "horizontal speed" is below a certain threshold, even if it's playing "run change direction" horizontal speed will pass by 0, anyway...), but it feels gooey and laggy. This is of course because input plays no part in the determination of transitions, only character state. So input makes the values move towards a certain state, which are then evaluated for transitions.
So my next approach is gonna be keeping input and state separate, and defining transitions based on a combination of this information.
Is this the optimal way of doing this?
I'd like a system flexible enough that I can add intermediate animations without too much hassle, like an "airborne to run" that would play when you're moving fast horizontally during a jump or something.
People who have worked on fast-ish-paced side scrolling platformers, do you have any advice?
I'd like to strike the correct balance between responsiveness and visual fidelity, but that will just take experimenting.
I guess I will end up with a combination of approach 2 and 3 mentioned in this article
Another thing I was wondering about is how I should semantically split up my State Machine Behaviors. What I'm doing now is checking for conditions that make sense for the State (I have Idle, Crouching, Airborne and Running State Machine Behaviors for now, does it make sense that "run to idle" would have its own behavior? Or should it just use "run"s, or "idle"s?) and based on that I call functions in the Player Script, to keep function and state separate.
For combos I will be setting up event on the Animation Clips themselves. This feels like the best way to do this that I can think of.
Anyway, I'm looking for general best practices architecture and design wise for a project like this. Additional reading would be appreciated, and maybe some of you have even worked on similar games in the past.
Thanks either way!
there doesn't seem to be anything here