Sunday, July 19, 2009

How to make a Platformer Feel Right

One of the big draws to a platformer-style-game is the feel. A good, responsive control scheme with some nice animations can make the difference between sluggish boredom and excitement.

I've never really looked into the mechanics behind character movement before, and when confronted with the problem of making Protonaut feel nice, I had to do some research. As it happens, William and Sly was released that very day, and I took it a whirl.


William and Sly is an excellent game where you hop around in a tile-based world as a Fox named Sly. I highly recommend you give it a try! Sly controls very nicely. He is immediately responsive in his left/right motions, and jumping is a quick, rapid motion. On top of some fluid controls, Sly animates a sitting position while at rest, has a very nice run animation, and bounds in an animated arc when jumping.

One game that stood out for me as an excellent platformer was N Game (later remade as N+ for consoles). It was critically acclaimed for having excellent controls, so I revisited it to take a deeper analysis. You can play it here.

N Game was interesting to me. You play the role of a Ninja that simply has to collect some items and avoid the badguys. The left/right motion is a big sluggish - the player accelerates as he moves, but it feels OK. The jumping seems a bit unpredictable to me and I had a hard time navigating even the first level - but I'm sure it's just me not being used to it. It seems a lot of other people liked the game, and again - it was hailed for it's amazing controls.

What really stood out for me, though, were the animations. The player character had an animation for pretty much any situation he got himself into - sliding down a wall, various states of jumping, and even death. It really seemed to make up for it.

I had to take a look at a really crappy Flash game too, just to see what else was out there. Being a large fan of the Indiana Jones franchise, my eye was caught by an unlicensed ripoff named - well, indiana jones. I'm not sure if the loss of capitalization was intentional.

This game is definitely bottom-rung in terms of control. Just give it a quick run-through and jump off of a ledge and you'll see what I mean. It's almost as if you controls are mapped directly to the keyboard in a hideous 1:1 ratio - it's obvious there was not much thought put into this at all.

But the artistic team put a lot of polish onto this game, and there it is making money being front and center on the #1 platformer-oriented portion of the gaming portal. This kind of crap really gets on my nerves, because I believe the gameplay can (and should) stand on it's own two feet first, and have graphics applied later to taste. I said so just a few days ago. This game is the polar opposite - polish, lots and lots of polish, complete with unlicensed rips and cashing in on a brand I love - with no thought given to gameplay.

To help clear the taste out of my mouth I did a quick mental revisit to Super Mario Brothers (for a quick refresher, there's a badly done flash version - again, without licensing).

Mario had some fairly descent, polished graphics for it's time. The controls were crisp and responsive, and things flowed rather quickly. I'm sure I don't have to preach to the choir about this one.

I took all I had learned and compared it to Protonaut and where it was currently at (around Build 25 at the time). Protonaut was largely based on real physics. The player is average human density, average human height, and other game objects (like floors and platforms) were the density of concrete. Gravity was fixed to a steady 9.81 m/s^2, Earth norm. Each object interacted with one another with as-accurate-as-I-could-find coefficients of friction. Movement was handled by applying a steady force in a particular direction, capping off at a maximum speed. About the only unrealistic thing was how high you could jump, which seems to be a standard in any platformer ever made. An earlier form of the game wouldn't even let you change direction unless your feet were on the ground!

I figured real-life objects interacting in a real physics engine in a real-life environment would be a pretty good, fun experience, and would save me a lot of effort!

Nope.

Turns out people's natural rates of acceleration are... Well, boring. People can't stop running fast enough. People can't run fast enough. In short, people are sluggish, unresponsive creatures, and have no place in a fun platformer.

I ended up going through all my movement code. I increased the player's rate of acceleration, I made the at-rest-friction levels to be impossibly high to make him stop faster, I made his movement in the air more responsive, and made a whole bunch of number tweaks and if statements. (As an aside: The next time I make a platformer, I am not going to use a physics engine if I can avoid it! The amount of work that went into these tweaks was much higher than I wished, and I ended up breaking a few rules (resetting player velocity manually instead of applying a force, for example).)

I found the gameplay immediately improved and was a lot more fun. Playing a dorky, slow marshmallow of a man isn't as fun as a nimble ninja jumping from wall-to-wall. But something was still missing. It still felt like everything was moving in slow motion; nothing quite felt right.

I did another tour of the previously mentioned games and found out that none of them had the same problem. All 4 of the previously mentioned games felt "right" in a way Protonaut wasn't achieving. After some searching and feeling it out, I think I put my finger on it: Gravity.

9.81 m/s^2 is fine and dandy in our lives, but it feels a bit too slow and sluggish when you're talking about a world of superheros that can easily jump twice their height. With our incredibly poor acceleration rates and reaction times, a box could easily fall on our head and crush it. But the box doesn't fall particularly fast.

Cranking the gravity up to 13.5 m/s^2 made the game feel much more response and smooth feeling. I guess the whole idea behind platformers is to exaggerate everything; all forces should be somewhere around double of what they would be in real life. I'm still churning out new builds with new tweaks, but I'm finally homing in on what can be called "fun, invigorating" gameplay.

And for those that are wondering - yes, Protonaut's level editor allows you to define the gravity vector. I just altered the default setting and re-applied the gravity settings to the tutorial levels, and tuned the player controls for that environment... If you reset gravity back to 9.81, the player will jump higher than he did before.

2 comments:

  1. Hi Andy,

    I've never really been good at platforming, but I played through William and Sly the other night and really enjoyed it. I was somewhat amazed! The controls felt very nice.

    I think Protonaut would greatly improve if letting go of the left/right button while in the air slowed the guy's lateral movement. Right now, once I jump sideways I seem to be able to slow myself only by pushing the opposite button. I'd prefer to be able to slow myself by simply letting go of the button I pushed to send myself sideways. Further slowing (or reversing) would occur if I hit the opposite button.

    Also: I got stuck on one of the tutorial levels (5 or 6 or so?) where a hydrogen got away from me, up on the ceiling. I couldn't figure out how to jump up there and I couldn't seem to shoot it either. Any hints?

    Rob

    ReplyDelete
  2. Oh - slowing down while in the air! Good catch, Rob! I just took a look at the other platformers, and they all had it and I missed it. It doesn't adversely affect anything so it's a pretty solid feature to have...

    Funny how small things like that are hard to notice until someone draws your attention to it, then it becomes obvious. :) It's in for build 29!

    I think you're probably stuck on Tutorial 7, the wall-jumping one? If that's the case, you can wall jump to gain a bit of extra height there. The Detonator only works on Nitrogen.

    I think I'll have to rework that level. :/

    ReplyDelete