Variable Height Jumping

I’m working on a platformer (Really thanks to SkyAphid’s question earlier about randomly generated Platform dungeons xD), and I’m currently working on player control/physics. While enemies will be able to “select” their jumping velocity (Within some bounds), I’m having trouble deciding how I want to do this for the player.

Basically the plan is to make it so that the player can have their character jump a “variable” height, depending on how long they keep the jump key pressed down. Meaning, they can ‘tap’ for a little jump. Press-and-hold for a larger one. Perhaps even having something like a Press-and-hold until you reach the height you wanted (Within the jump-height limit).

The main issue that I’m having here is that all of these options mess up the idea of the parabolic arch that a jumping character should follow (Not to mention the whole “I can still move left and right while falling” thing a lot of games are based one). Starting from the ‘tap’, the character will be given an upward velocity, which is then acted on by gravity to bring them back down. For the other options, it causes an odd skewing of the arch due to not having the “right” initial velocity and having to correct it for each logic step where the jump key is still pressed down.

I was wondering if anyone has some advice on this issue, whether it’s just bite the bullet and eat the odd parabolic arch or some insight on how it’s been done in other games.

You could have double-jumping, which is pretty common. A 2nd tap while in mid air just has them jump again.

Alternatively you could have something where jump height is based on the speed the character is running.

Both of which I was actually considering (Though, the ‘current speed’ was more of a horizontal jump distance thing for me).

I should say that double-jump is something I’m planning on adding, though it’s going to only be available after some flag is set (Not sure what will enable it yet, I’m sort of torn between different ideas there, but those are outside this discussion.)

The idea of the speed affecting jump is interesting. I’m already making the PC’s movement be controlled by a FSM (Partially affected by the input from the player, partially affected by surrounding), where Walking and Running on going to be states. I was thinking of leaving the two with the same ‘Vertical Jump’ velocity, but give them different horizontal movement components (Such that a running person will jump farther than a walking person, just because their velocity there is bigger).

So the it seems as though the issue here is that you need to have the jump height decided at the time that they start jumping(e.g. so you don’t have a non-parabolic jump trajectory).I see a couple of options:

1: the player holds down the jump key prior to jumping; jumping when the the key is no longer pressed. However this creates the situation where the player might spend lots of time holding down the key (e.g. priming themselves for the next jump).

2: Have a second key for jumping higher.

I think huckanator’s #1 is reasonable, especially if it’s accompanied with animations showing the person crouching lower to get a better jump.

Regarding horizontal jumps, I think there’s nothing stopping you from having speed increase both the height and distance. You could have the horizontal distance increased more, so you still get the stretched out curve you’d expect, but it might also let the player jump 1/2 a unit or block higher.

In my thinking, I always imagined the character had acceleration, akin to Sonic or others, where the more they’d move forward the faster they went, so jumping high distances would require a careful preparation. Obviously, this might not work for your mechanics.

I was toying with the idea there, Huckanator.

Boy of them, honestly. Though, the “jump priming” would have a higher end. Probably a sliding scale of several different trajectories. Like having a ‘tap’ jump, a ‘press and release’ jump, and a ‘press, hold, release’ jump. Or, perhaps just a filling the jump scale sort of thing.

As for the running resulting higher vertical leap? Perhaps a little, but to me it seems like it’s more of a Long Jump style thing. Because it’s very difficult to convert horizontal velocity into vertical velocity without some sort of ramp (And even then) or something to cause rotational friction.

I am implementing an incremental velocity change system for movement. Walking starts out slow, but gets faster to a certain cap. Running increases the cap and the acceleration. Jump distance only really comes into this in that the leap gives a bit of vertical velocity (More like the ‘tap’ mentioned earlier). So the faster you’re running, the further you jump.