Coyote Time Jumping is it possible?


Anywhere Games 2022-06-14 15:35

I was wondering if it was possible to make a coyote time jumping system (Super Mario Jumping System) If so how would one implement it?

McPepic 2022-06-14 15:47

Do you already have a moving player that can jump and collide? If so, what I’d do is have a timer that starts as soon as you run off a platform. As long as the timer is still going (you can set the length), you allow the player to jump, even though they are no longer on the platform.

Anywhere Games 2022-06-14 15:53

I see that’d make sense, what about Jumping only to a certain height instead of max unless the button is held down long enough?

McPepic 2022-06-14 15:59

It’s funny you mention that. If you check out my profile, I implemented this in my Hollow Knight Prototype. I’d suggest checking that out.

nathanielbabiak 2022-06-15 04:22 (Edited)

I can't find any uploads of 'Mario style' jumping on this console. It requires implementing a (super simple) physics engine, with these three points. (The first two points are implemented in many uploads on this console.)

  1. When the user presses the jump button, you set the sprite's upward velocity to a constant value (only once, within the frame the user presses jump).

  2. For every frame the sprite isn't on the ground, you decrease the velocity (each frame) by a constant value (i.e., acceleration of gravity). Velocity needs clamped, otherwise falls-from-height can become pretty fast.

  3. To implement a variable-height jump, you set the sprite's upward velocity each frame so long as the user is holding the jump button. As before, it's a constant value. Max. hold time needs clamped, otherwise the sprite is just flying.

You can finesse the constants used in #3 on a per-frame basis. Maybe the first frame of a jump should use a slightly lower upward velocity than all subsequent frames? Maybe the constants should get a slight increase if the sprite has high lateral velocity? If you finesse it, it's 'Mario style'!

This is the closest upload I found, but it doesn't clamp the max. hold time, so it allows flying.

nathanielbabiak 2022-06-15 04:39 (Edited)

From memory...

Mario used something like a 25% reduction in upwards velocity for the first frame that the jump button was held. It made one-frame-hold jumps extra small.

But, for the second frame the jump button was held, the position was recalculated for the prior frame based on pretending there wasn't any reduction. So the second frame looked like it had a bit of acceleration if the jump was held through two frames.

For the third and all subsequent frames, the velocity set per-frame was a constant. So it'd look like Mario was decelerating just a bit if the jump was held through three frames.

I can't recall if there were 4 total frames in the hold-to-jump sequence, but that number's sticking in my mind for some reason.

Keep in mind, by frame 4, Mario is a few pixels in the air already, and there's no gravitation acceleration yet to even begin to reduce the vertical velocity (because every jump-held frame causes the velocity to be set to a constant)... so it's not like the sprite can only move upwards in just those first 4 frames. It's after those first four that gravity takes over, and then there's a few frames before gravity even causes the velocity to become negative... so Mario jumps pretty high.

McPepic 2022-06-15 14:33

Wow, Nathan. Way to show me up. JK. Very informational though. :)

nathanielbabiak 2022-06-15 16:36 (Edited)

Hey what can I say, I'm one of the only active users who *doesn't* have a platformer upload, figured the least I could do was ramble a bit... trash talk... maybe inspire a new creation?


Log in to reply.