• Welcome to Smashboards, the world's largest Super Smash Brothers community! Over 250,000 Smash Bros. fans from around the world have come to discuss these great games in over 19 million posts!

    You are currently viewing our boards as a visitor. Click here to sign up right now and start on your path in the Smash community!

Melee Physics

Y-L

Smash Champion
Joined
Jan 16, 2014
Messages
2,436
Location
Ventura, CA
Hi, I'm working on a physics engine for a simple game I work on in my free time. I'm trying to make this akin to Melee's physics. One question I have is how movement in the air works. It seems as if you move in the air with a percentage of your speed you were moving at when you were on the ground + a little bit more (because you can move aerially from a standing jump). Can anyone provide any more info on this?

Also if you have any more information on the physics engine that would be greatly appreciated. Thanks!
 

flieskiller

Smash Journeyman
Joined
Jan 3, 2013
Messages
426
"because you can move aerially from a standing jump" That's just aerial acceleration/mobility if I understood what you wrote.

Also, about speed conservation when jumping, it's unique to all characters how many frames they keep that speed from the ground into the air. For instance, Falcon and Pikachu keep it for a long time, Sheik loses it almost instantly.
 

Deconimus

Smash Cadet
Joined
Feb 24, 2015
Messages
26
I'd suggest you to have a look at Crazy Hand, many of the values presented there will give you a good idea what is taken into consideration when it comes to character movement.

The aerial acceleration is also called "drift" in melee terms iirc. It seems to be presented as "Air Mobility A" and "Air Mobility B" although I don't exactly why it's split up.

Also, about speed conservation when jumping, it's unique to all characters how many frames they keep that speed from the ground into the air. For instance, Falcon and Pikachu keep it for a long time, Sheik loses it almost instantly.
This seems to be determined by a value called "Air Friction". Sheik's value for that is 0.04 which is much higher than Falcons at 0.01. You can think of this as a kind of decceleration that is applied to your character when in the air.

The counterpart to this when moving on ground is a value called "Friction/Stop Deccel".


I'd also advice you to fix your physics engine's rate. It's a bit more complicated to setup at first, but will spare you many problems later on. If Melee's engine wasn't fixed at 60fps we weren't able to compile precise frame data.
 
Last edited:

Y-L

Smash Champion
Joined
Jan 16, 2014
Messages
2,436
Location
Ventura, CA
I have the frame rate fixed at 60
the current way I have it set up is that when the player jumps there is an aerial deceleration value that is multiplied to velocity. I also have grounded friction . I just need to understand conservation of velocity when jumping
 

Deconimus

Smash Cadet
Joined
Feb 24, 2015
Messages
26
I have the frame rate fixed at 60
the current way I have it set up is that when the player jumps there is an aerial deceleration value that is multiplied to velocity. I also have grounded friction . I just need to understand conservation of velocity when jumping
I'm not sure where your problem lies.
To preserve the velocity when jumping there aren't any further steps to take, since you only manipulate the vertical velocity when performing a jump. The change in horizontal velocity comes with the fact, that the player now is airborne and his aerial acceleration/drift as well as the air-friction is different to their ground-acceleration and the applied ground-friction.
 

Y-L

Smash Champion
Joined
Jan 16, 2014
Messages
2,436
Location
Ventura, CA
I'm not sure where your problem lies.
To preserve the velocity when jumping there aren't any further steps to take, since you only manipulate the vertical velocity when performing a jump. The change in horizontal velocity comes with the fact, that the player now is airborne and his aerial acceleration/drift as well as the air-friction is different to their ground-acceleration and the applied ground-friction.
I think I've made some improvements, thanks! A few more questions: do you know what the difference is between a character's aerial mobility and their air friction? Also, how the values in crazy hand measured? Just all relative to Mario? Is there a way to interpret what these values mean in terms of real numbers?
 

Deconimus

Smash Cadet
Joined
Feb 24, 2015
Messages
26
I think I've made some improvements, thanks! A few more questions: do you know what the difference is between a character's aerial mobility and their air friction? Also, how the values in crazy hand measured? Just all relative to Mario? Is there a way to interpret what these values mean in terms of real numbers?
As far as I can tell they read the data from binary files stored inside the Melee image.
They are probably just arbitrary non-unit values that seemed fit for the games mechanics.

The aerial mobility is getting added to the characters horizontal velocity when tilting the control-stick in a direction (not sure if digital or analog to the sticks tilt). The air-friction seeks to annihilate the characters horizontal velocity.

Here's pseudo-code example how this could be implemented:

Code:
if (inAir) {
    friction = airFriction;
    acc = airMobility;
} else {
    friction = groundFriction;
    acc = groundMobility;
}

velocity.x *= pow(friction, delta);
velocity.x += acc * movedir * delta;
movedir would be -1 if the stick is fully tilted left, 1 if fully tilted right and 0 if not tilted.

Edit: Since you fix your framerate at 60, you don't necessarily need the "delta" parts of the code.
 
Last edited:
Top Bottom