Walking And Running Implementation
When analog sticks were born, the way walking and running was implemented in games changed. But before I go into that, it's important to understand the key differences between the joystick on a traditional arcade machine and the little analog stick on your console controller. When you push on an arcade stick, it's pressing down on one or two of four different little buttons that lie underneath the stick. Each button only has two states: pushed and non-pushed. So when you push the stick upward it's going to press on the northern button and when you push the stick up and left it's pressing on both the northern button and the western button. Now when you push on an analog stick, it's cross-referencing two different axises (a "left to right" axis and a "up to down" axis) and the controller is finding the precise location the stick is resting at, which could be anywhere inside that plastic circle your analog stick is poking out of. With all this extra possibility space, you can alter the way the player tells the character on the screen to move. What I'm gonna talk about here is the three major ways this can be done based on the implementation across a handful of different games. The first variant of this is the most straightforward.
In these images the circle represents the analog stick possibility space. When the stick is not being touched it is resting inside the "deadzone". The deadzone is a very important mechanism on sticks of all kinds because it prevents input from registering until the stick is pushed on a specific amount. The reason you want this feature on a stick is to make it less sensitive to three meddling forms of very minor input:
- The thumb or finger of the player lightly pressing the stick.
- The stick being very subtly "stuck" a little bit in one direction.
- The microscopic bouncing that happens when the player lets go of the stick from a tilted position.
Truthfully, these three things are constantly happening but you don't know it because we game developers have been smart enough to make sure there is a deadzone on the sticks we make games for. Getting back to the this specific implementation, it was used in Viewtiful Joe but is the same in just about every traditional beat-em-up, since they couldn't help it on account of their simple joysticks. By pushing the stick past the deadzone, the character will move in the direction pushed at a specific speed while a movement animation plays at a specific speed. Very simple and again, very traditional. Easy to implement in every case. This next one is a little more complicated.
Devil May Cry and Bayonetta have given the player the ability to walk at a slightly slower rate if they so choose. By pushing the stick past the deadzone but not full-tilt, the character will walk in the direction pushed, and they will do so at a specific speed while a unique walking animation plays at a specific speed. When pushed all the way to the edge the character will run, and they will do so at a specific speed while a unique running animation plays at a specific speed. Slightly more complicated but not particularly difficult to implement, even in 3d. This last one is the most realistic looking of all these three major control types, but also the most convoluted and difficult to implement.
The characters in these games have two different movement animations: a walking and a running. Based on how far the analog stick is being pressed, the animations will not only be blended into each other at different values (which only works with 3d animation), but the character will be moved at a very precise speed somewhere between not-moving and full speed. So if the player is pushing the stick 75% out from its default position in the deadzone, the character will be employing 25% of the walk animation data and 75% of the run animation data and will be moving through space at 75% of the character's top speed. It's why you can do everything from a slow tiptoe to a gallant trot to full-blown running in these games. But it's also very difficult to implement as the animations not only need to look good individually, but they need to look good at varying degrees of animation cross-fade. Personally, I find this all moot since no one ever walks in a beat-em-up unless they are specifically incentivized by the game. So we're just going for a very straightforward run only scheme.
There is a little bit more going on here under the hood but only because we will be using up and down in attack mechanics; it would be frustrating trying to push up or down in a combo and have the game think that you are trying to move. So those upper and lower quadrants act as a deadzone, but only when it comes to movement. Hope this was helpful for you in your own implementations. :)
-
Aaron Burch
-
Ozzie Smith
-
VictorBorgesAngelo
-
The Fool Who Bears The Name Freedom