Friday, June 3, 2011

Unity: Player Movement

So I was playing around with code to (subjectively) improve the feel of the player's movement. I began to think about the variety in 2D platformer physics, and just how much difference to the feel of a game tweaking a single value can make, to the point of defining an entire franchise.

I've listed the variables that come to mind below:

  • Speed - What is the player's movement speed?
  • Friction - Does the player continue moving when releasing the controls?
  • Momentum - How quickly does the player change direction?
  • Acceleration - How quickly does the player reach maximum speed?
  • Walk/Run - Can the player hold a button to toggle between walking and running?
  • Air Control - How much of the above applies to airborne movement?
  • Force/Gravity - How fast does the player launch? How fast do they fall?
  • Verticality - How high can the player jump in total?
  • Variable Height - Can the player hold the jump button for extra height?
  • Boost Jump - If running, does the player jump higher than while walking?
  • Double Jump - Can the player tap jump while airborne for an extra, airborne leap?
  • Ceiling Bump - Does the player 'hover' if the jump apex is cut short by a ceiling?

Quite a lot to think about! One set of values gives you Mario, and a few tweaks gives you Sonic. That's a lot of importance in what amounts to a few floats and integers in a single MonoBehaviour.

So, subjectively, what do I prefer? That's hard to say. I find myself flip-flopping a little between contrasting schemes, and alternately preferring one and then the other. I'm leaning towards modeling the mechanics on something I know - something I already like. Wonderboy is the obvious choice, as the game I'm seeking to make is similarly modelled on Wonderboy's gameplay. There's a good reason the designers chose the mechanics they did, and a good reason they work.

But there's some things missing from Wonderboy's scheme that I do like, such as double jump, and a greater velocity to the jumps in general (think Mario's spring-loaded leap, for example).

In theory, I'm leaning towards:

  • Speed: Moderate - Mario-ish speed
  • Friction: Very high - The player stops on a dime
  • Momentum: Very low - Very rapid changes in direction
  • Acceleration: High - The player reaches maximum speed quickly
  • Walk/Run: No - There is a single movement speed
  • Air Control: Full - The player has the same range of motion in air as on the ground
  • Force/Gravity: Moderate (both) - Mario-ish again
  • Verticality: Low to Medium - Close to character height, rather than building height
  • Variable Height: None - Jump is a standard height
  • Boost Jump: None - No walk/run distinction
  • Double Jump: Yes, once upgraded - Great way to open new areas
  • Ceiling Bump: No hover - It feels like a bug rather than a feature

Of course, I might change my mind later, but at least if I make penciled-in decisions now, then I can start thinking about the overall design of the game. For example, if there is no variable height, there is no need for ceiling traps such as spikes. If there's no variable walk/run, then I can standardise platform-to-platform distances. Et cetera (yes, it's two words, omginoright?).

No comments:

Post a Comment