Game Design Deep Dive is an ongoing Gamasutra series with the goal of shedding light on specific design features or mechanics within a video game, in order to show how seemingly simple, fundamental design decisions aren't really that simple at all.
Who: Roel Ezendam, Game Coder at RageSquid
Hi! I’m Roel Ezendam, Co-Founder and Game Coder at RageSquid. We are a young game development studio from The Netherlands, and we just released our debut title Action Henk on Steam. My passion lies in gameplay and game physics programming, and this was my main task on Action Henk.
What: Jump physics in Action Henk
Action Henk is a high-speed platformer in which the player has to race through short levels as quickly as possible. The gameplay is all about keeping your momentum going. The setup is very simple, but there are many subtle tricks you can apply to shave off those precious seconds.
To facilitate this, all motion in the game is physics-based, and every player input has to do with managing acceleration and friction. This means that there are no hardcoded maximum speeds or velocities--there's only the application of force. As a result, jumping is also done through the addition of force, rather than setting a velocity by hand.
With this article, I hope to shed some light on how much underlying depth can be found in a seemingly simple mechanic: the jump.
When starting a jump, the first thing to be determined is the direction of the jump. This direction is based on the angle of the ground you are standing on. The jump force will be directed to halfway between y-axis(up) and the direction of the ground.
This simple mechanic already creates more underlying mechanics. For examplethe in-game trick that gives the character more forward momentum when jumping off a downward angled piece.
Because the game is filled with curved level pieces, having mechanics that are based on the angle of the ground will give the player a very wide range of possibilities and outcomes, which creates exactly the kind of depth you would like to have in a racing game. The curves in Action Henk serve the same purpose as the corners would in ordinary racing games; something that can be approached in many different ways that is almost impossible to consistently do ‘perfectly’. The player can only do this ‘as perfectly as possible’. This serves a great purpose in a time-based game, where your goal is to constantly improve your strategy in tiny ways to shave milliseconds off your run.
Having control over the height of the jump is another way to create player decisions and deeper mechanics, so when you press the jump button only half of the total force is applied immediately. The other half of the jump force is applied over a period of 0.2 seconds, in which the player can choose to hold the jump button for a higher jump, or let go early for a short hop.
Applying force is nothing more than adding velocity, and this is what happens when you press the jump button. To determine as a designer how high the player can jump, you can just tweak the jump force until you have the right height. This is still very simple when standing on flat ground, but it gets complicated when the player starts jumping off 45-degree ramps or at the vertical end of a half pipe.
The reason this becomes problematic is because the player already has some vertical speed, and suddenly this added velocity can result in a much larger height increase. I had a lot of trouble wrapping my head around this concept when I first ran into it, so I’ll try to clarify it with this graph:
This means that applying the same jump force everywhere will have the player skyrocketing into the air if there is already big vertical speed. To counter this quadratic increase in jump height, the game uses a quadratic falloff formula that basically acts as a forced counter to this effect. When the player starts a jump the game checks the vertical speed, and determines the jump force to apply based on the quadratic falloff formula. The higher the player’s vertical speed, the lower the jump force becomes. This way it’s possible to make sure the actual height gained from the jump is always the same, regardless of your vertical speed.
In practice it turned out to be better to not completely counter this effect, but just scale it down a lot. The result is another meaningful choice for the player to improve their runs. Your jumps will be higher if you have more vertical momentum. Scaling the effect just made sure it wasn’t as overpowered as it used to be.
The end result is a system which allows the player to make strategic choices. Everything is built upon the foundation of physics, which makes everything feel intuitive to the player. By reverse-engineering some of the effects that are a result of this system you can modify their impact, allowing you to balance all these tricks, while still maintaining an intuitive foundation. This whole system is the core of Action Henk, and figuring out all the underlying mechanics and tricks is a huge part of its replay value and longevity.