Sponsored By

The Making of Toto Temple Deluxe: Platforming (Part 2)

In Toto Temple Deluxe, we need the characters to tightly respond to a player's inputs. It requires a little bit of common sense, psychology in game design and lots of foreseeing in the code. Let’s take it a step further with the jumping mechanism.

Yowan Langlais, Blogger

February 24, 2014

6 Min Read
Game Developer logo in a gray background | Game Developer

*This blog post has been written by Alex, our lead programmer. You can read his original post on our website.



You can follow up with all the posts from the series :
The Making of Toto Temple Deluxe: Platforming (Part 1)
The Making of Toto Temple Deluxe: Platforming (Part 2)
The Making of Toto Temple Deluxe: Collisions for Platforming
The Making of Toto Temple Deluxe: The Unique Experience

Our main goal with Toto Temple is to create a hectic and exciting experience for you and your friends. We want it to be a curse inducing game against the other players, not against the game. So we want the character to do exactly what the player wants it to do. It requires a little bit of common sense, psychology in game design and lots of foreseeing in the code (we saw that with the previous entry). Let’s take it a step further with the jumping mechanism.
 

Intuitive Jumping

Let the player control the height of a jump, without making it look like a gradual ascension, make all the low jumps and the high jumps feel natural, there are many ways to get that feel right. We just added gravity to our character and a rather strong initial push, that we can sustain for up to around a tenth of a second, then the gravity (and vertical friction so the character doesn’t fall too fast) does the rest.
 

public virtual void jump() {
    jumping = true;
    curJumpTime++;
    [...] //long, complex logic behind the next point
    if ((lastJumped && curJumpTime < jumpTime)|| (curNumJumps < numJumps && !lastJumped)) {
    //if the player is sustaining the jump and the sustain is not too long Or the player is initiating a jump and he has not yet reached the max number of jumps/double jumps he can do
        if (!lastJumped) { //if the player is initiating a jump
            curJumpTime = 0;
            beginJump();//begin a jump
        }
        vY = jumpSpeed - globalGravity - addedGravity; //set the Y speed     upward
    }
}
 

When I say jump, you jump. Sounds easy, right? Well...no! Too many times, the player presses jump when the character is still over the ground. There’s an easy remedy to this: when you land, and you pressed jump just before hitting the ground, then jump right away! Well tried, but there is one major flaw in this design; if you make double jumps, you will double jump instead of waiting to land, then you’ll try to double jump later and it won’t work. So to make it work, we use proximity with the ground: if the character is headed downward and is close enough to the ground when you press jump, he won’t jump right away, he will jump as he lands. Still, this system has flaws; if there are spikes on the ground, you want to double jump, not wait to land on the spikes! Just detect if there are hurting collisions on your way down and if yes, double jump!

 

If you double jump now, both Totos will survive! The one on the left will wait until he’s on the ground to jump as he is near enough the  ground, the one on the right will jump now.



If the character just left the ground (see below), it still behaves as if he was on the ground for 3-4 frames when it comes to jumping, so no falling instead of jumping!
 

The normal jump can be performed event right after leaving a platform, this is important for the survival of Totos like this one.

 

private void onFloorExit() { //when the toto exits floor in any way
    if (!lastJumped && onGround) { //if the player has not jumped...
        pup.WaitToDo(canJumpNoMore,4); //in 4 frames, call canJumpNoMore
    }
    onGround = false; //tell the toto he is no longer on ground
    floorCol = null; //make him forget the floor 
}

private void canJumpNoMore() {
    if (!lastJumped && !onGround) { //if the player still have not jumped and is still in the air.
        curNumJumps = 1; //tell him he has jumped once, if he can double jump, he'll still be able to jump once.
    }
}

In Toto Temple, we did not implement this as the control in mid-air is really tight, but for Dale & Peakot, we implemented a system that lets you control your character with the same physics as on the ground for a few frames after the jump, so if you jump from a still stance to one direction, we are sure the character does not go up  without any initial lateral push if let’s say the player pressed the directional button a frame or 2 after the jump button.
 

Jumping to conclusions

Again, I’m leaving you on those little observations relevant to the subject:

  • In Battleblock Theater (if you are looking for co-op fun, this is your game!), they seem to have used the proximity to ground verification to check if you must double-jump or not, sadly they forgot to add the detection of dangerous zones, so if you get too close over a dangerous zone, the character won’t double-jump and die.
     

  • In Awesomenauts (MOBA that I strongly recommend! I play it during every noon), they don’t seem to use the proximity to ground verification. It becomes greatly apparent (and hindering) when you play as Genji because his double-jump makes him hover instead of pushing him upward, imagine the disappointment when you are in trouble and all that you need is jump over that ledge, but instead you hover and the ledge blocks you and you die.
     

  • In Tomb Raider (the last one), you play in a fantastic setting; everything is realistic, though many things are enhanced for the sake of the well-feeling of the game, but I think that the jumping in this game is a little off. Lara seems to have flying squirrel genes or something and the fact that you can efficiently control her when she is in mid-air hurts the immersion in this kind of game IMO.

As much as lateral navigation, jumping and height navigation is really important. It is the beginning of the fantasy of platformers, creating a world where one can jump ten times his height. Such a fantastic feature should not be a struggle in itself, instead be a support for interesting hurdles. Care to share other thoughts or observations on game design regarding the behaviour of jumping/up-down navigation in games? 

 

Read more about:

Featured Blogs
Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like