SakeTami
Megan Fox
Megan Fox

patreon


Getting a sense of weight WITHOUT impacting platforming

You've all had the usual debate, I'm sure, when it comes to setting gravity. You're looking at the behavior of the world as you increase gravity, and hey things fall better, it's nice! But then go you try to platform and bwoooop you fall like a dead weight. So that won't work.

But what if it COULD!

And what if I told you that this is one of the many tricks used in Metroid Prime to make their 3D platforming feel awesome? (though I'm sure other games have done it too)

There's no code here, because the logic is dead easy: you simply reduce the gravity the player experiences while they're holding the jump button down.

That's it. And I mean literally just that. Don't get clever with trying to make the lowered gravity persist until they land, don't try and start with lowered gravity from before a jump due to coyote time, don't even try to block the behavior if the player is standing on the ground after a jump and still holding the button down. No. Seriously. Dead basic. When jump button go down, you set the player's gravity lower. When jump button releases, gravity goes back to world default. Done. The one, and only one, thing you might want to do is enforce a minimum length of gravity reduction- the reason being that without that, a tap jump will barely do anything on high gravity scalars.

You'll find players then use the fact that they fall faster when they release the jump button to give their platforming more expression, and the ability to hold jump button down and run off a ledge to fall that bit slower is, itself, a fascinating bit of player jump tech. The best part is that because this makes jump VS fall so discrete, it draws a HARD line between your jump distances. So your "hop" (just tap the button) jump height and horizontal coverage become drastically and obviously different from your "jump" (some jump hold) and your "long jump" (player is holding the button down desperately to coax every inch of jump out). Without this tech, the differences between those tend to read as a lot squishier.

You might find it beneficial to add some subtle visual state change when the player is holding jump button down while they're falling, just to contextualize it for them, since (functionally) this operates as a hold-button-to-glide system, albeit in a really stripped down way. Wing suit I guess? Point is a glider would have way more gravity reduction and way more horizontal transit. Anyways!

The Metroid Prime number is approximately 3.5x. The gravity that the world experiences is approximately 3.5x what the player experiences when jumping. Typically this means your jump gravity is the physically accurate -980cm/s, or 9.8m/s if you're not in Unreal, Unreal just uses cm. Accordingly, your world/default gravity should be approximately -3430cm/s (34.3m/s), and that's what everything but the player experiences all the time.

The only gotcha here is that since you're running heavy world gravity, you'll want to set everything (at least the characters) up with terminal velocities. Which is nothing fancy, just in your processing, per frame, if the down component (Z or Y depending) of their velocity exceeds a certain value, you just clamp it to your max. Done. Ezpz.

Still though, experiment with it! You might find you prefer a 2.5x multiplier if, say, you're doing a 3rd person collect-a-thon platformer, and you want stuff to fall in a satisfying way but maybe not QUITE that hard. It's more appropriate for toon vibes, for instance, which is where a ton of 3rd person platformers live. For simplicity's sake, you'll want to expose the value such that it's easily tweakble. Plan on being able to sit in world and poke the value around, so you can dial it in for your precise FOV and camera perspective and mesh scale.

Anyways, that's it! I promise that this One Incredibly Stupid Trick really does work. I was shocked. It's even something you can implement without changing any of your existing jump spacing, because YOUR GRAVITY DURING JUMPS DOESN'T CHANGE. When you add this, functionally what you're doing is setting your world gravity higher, and then making your gravity-reduction-during-jump just apply whatever your lighter gravity used to be. So players jump the same distances as before, assuming they hold the button down. Neat, eh?


More Creators