Saturday, September 27, 2014

Inputting the Animations

Yesterday Brett and I figured out how to properly control the animations of our stand-in character, Dhalsim from Street Fighter.

Brett prepared a state machine for the animations. We both assumed that we should use transitions to handle switching to an animation and back. Basically, you press the jump key, it sets a bool or a trigger in the state machine, and the state machine transitions from the idle to the jump animation. When the animation ends it transitions back to idle. This seems simple enough, but it had some issues.

The main issue is that we were queueing up animations. An animation may not be able to play immediately, so the state machine would wait until it could transition to the requested animation. This sometimes caused a huge delay between when you pressed a button and when the animation actually played.

The input system that I wrote is a wrapper around InControl, which is a solution for cross-platform controller support. It can handle multiple keys at once and the timing between combo button presses. However, it doesn't play well with animation transitions. Any key you press is immediately processed, so Dhalsim would jump if you pressed up without thinking about whether you were attempting to perform an up attack of some sort. This has to do with how we're constantly checking the input. It would register the up key first and start the jump animation before any other key in the combo could be registered.

The solution for all of these issues was to simply interrupt any animation and play the animation we need explicitly. This will bring its own challenges. We'll definitely have to be aware of defining times in which we don't to be able to interrupt a playing animation. This brings us one step closer to having the gameplay experience that we want.

No comments:

Post a Comment