Posted On: 2019-01-14
Today, I thought I would write a bit about the general approach I use to create the movement systems in my various prototypes. In general, I have found this produces a satisfying feeling game, so I plan to use some of the same patterns in the larger project I am working on. Much of this knowledge has been gained by working on/studying movement for my earlier prototypes, so some of the earliest games didn't follow all these patterns. (Note: while these are primarily focused on 2D games, the patterns are general enough that they may be applicable to 3D games - I simply haven't tried them in that context.)
The first pattern that I use is that movement should generally be quick, but not uncontrollably so. What exactly this means varies from game to game, but primarily the idea is that the first thing I tune while trying to get a good feel is the character's movement speed. I will often overshoot the speed (ending up feeling a little bit out of control) and then tune various supporting parameters to get it back in line:
Similar to moving fast, when tuning the jump, I often default to jumping too high, and then tune it back. I have generally found that 3-5 times the character's height is a reasonable maximum jump height, though this may vary based on the field of view. Minimum jump height (by releasing the button early) is useful to give the player extra control, but shouldn't have too much variation (an extreme example: if the jump can change by the button being released after a single frame, that will massively limit the number of players who can perform that kind of jump.) I have generally found that setting the minimum jump height to 1-2 blocks (the most common size object in the game world) smaller than maximum jump height allows it to be useful and still simple enough that most players can execute it. Once tuning the jump is complete, it is good to document the minimum and maximum jump heights, as they will be useful for reference during level design. Similarly, once levels have been designed, it is not advisable to modify the min/max jump height, as doing so may necessitate rewriting/re-tuning any existing levels.
When I am at the earliest stages of development, I tend to favor testing with the keyboard over the controller. This is partially related to convenience (while programming, that's where my hands usually are) but since I work with Unity, this tends to be especially beneficial, as many of the default settings for how Unity manages keyboard input feels sluggish/sloppy. To overcome those limitations, I prefer to work with the Raw Input from Unity (the input from keyboard/controller, before Unity's dampening effect). This is, in large part, why acceleration is useful (with an analog stick input, players can achieve precise control by moving less than the full distance, but that is not possible on a keyboard.) Finally, once I'm happy with the keyboard controls, I like to do a sanity check with the controller, to make sure it still feels good with the analog stick. If I find I need to tune the controller feel, this can typically be accomplished by working with the numbers between 0 and 1 (non-inclusive), since those will not impact the keyboard.
When designing the control for the character, the character should behave correctly if the player drops the controller at any moment. Typically this means I use deceleration (rather than a sudden stop) and try to maintain the current velocity while in the air. Control is then layered on top of that logic, so that the player can exert control over the default behavior, to produce the desired change. Importantly, this means that deceleration can be magnified by a player pressing the opposite direction (to stop sooner) or reversed by pressing the direction of current motion (to resume movement.) Likewise, I generally give the player a large amount of air control so that they can easily exert their influence over their character's movement.
If you are interested in any more patterns for how to get good-feeling movement in 2D games, here are a couple resources that have helped me in building these patterns: