Math for Game Programmers: Building a Better Jump

GDC Festival of Gaming · 518K views · 2016 · 25:43

Open on YouTube

Game programming & enginesGame designtalk

Why Game Development Stack Exchange recommends it

Game Development Stack Exchange users link it when asking or answering how to design and implement platformer jumps and projectile motion from height and distance rather than raw force values.

Recommended by 1 people across 1 different months, 2020 to 2024.

What it is

A 2016 GDC talk by Kyle Pittman of Minor Key Games on building natural-feeling jump trajectories for platformers. It shows how to derive gravity and initial velocity from designer-friendly inputs like jump height and distance, and compares a few numerical integration methods for simulating the motion.

What people said

Recommends idbrii · 2024-09 · Game Development Stack Exchange · on “How can I implement a Varying Jump Height Mechanic for my character?”

One thing that can help enormously is to start by defining your jump in terms of height instead of "power": (Credit to this tutorial [LINK] .) extends CharacterBody2D @export(float) var gravity = 981.0 # positive so going down ## Maximum many pixels high we'll jump. @export(float) var jump_height = 128.0 func _process(dt): if is_on_floor() and Input.is_action_just_pressed("jump"): velocity.y = -sqrt(2 * gravity * jump_height) move_and_slide() velocity.y += gravity * dt Even better, if your game uses tiles you could define jump_tile_height and calculate jump_height = (jump_tile_height + 0.1) * TILE_SIZE . (I add 0.1 to to ensure you get over that last tile.) On to variable height. I'd suggest

Cites eguneys · 2020-09 · Game Development Stack Exchange · on “The elements of a perfect juicy jump”

I have seen and implemented these ideas: Simple Physics based Movement SO answer [LINK] . Building a Better Jump GDC Talk [this video] . And written a tutorial about it Making a Platformer in Pico 8 [LINK] . Finally made a simple game Coler Js2020 [LINK] using these ideas. People have complained the player is too fast, or the springs are not right. But I want better,more juicy, control over player jump. Like as if I am drawing the trajectory. I don't want real life physics. I want juicy physics where it just feels right, like float-y in SMB or stiff like in Celeste, or Spelunky. Maybe we can model this in terms of a sound envelope: Attack is time it takes to reach peak of the jump. Decay is time

Cites Ranya · 2020-09 · Game Development Stack Exchange · on “How to model the double jump in Super Mario using projectile motion”

So the single jump in Super mario games follows a curved trajectory of the formula s = s0 + v0t + ½ at2. The double jump in mario consists of two different parabolas combined. I know that the max height of the first jump is the beginning of the second jump and the gravity doubles by the end of the second jump making a faster landing than the first. Would it be a piece-wise function or how would it work? *Could anyone guide me through/ explain what equation would that result in? Any help would be very much appreciated! If anyone needs me to explain more, please let me know. Here is a link to explain my question [this video] @ 17:58 I would be very grateful for any help :) Even if it is only ideas,

Cites liggiorgio · 2024-12 · Game Development Stack Exchange · on “How to express parabolic motion using delta time?”

Disclaimer: You asked many different questions at once, which made your post too broad. Since this site is about making games, and parabolic motion in games is "objects falling due to gravity", here I'm interpreting your question as "How do I use delta time to make gravity affect objects' motion?" . Physics uses the equations of motion to describe the movement of bodies in space. We usually work quantities out backwards : we determine an object's velocity by analytically deriving its change of position, and its acceleration by deriving its change of velocity, and so on. In games, we don't want to reconstruct movement, but rather simulate it. This is usually achieved in a forward fashion, by