• 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!

Knockback acceleration... solved (Veril edit: no it wasn't)

Status
Not open for further replies.

leafgreen386

Dirty camper
Joined
Mar 20, 2006
Messages
3,577
Location
Playing melee and smash ultimate
While answering what was originally a very simple question, I ended up finishing my exploration of how the game calculates knockback. There's some extraneous stuff in the post, but here's a copy of it. Note that although the acceleration is probably the same for all characters, this has only been tested for jiggs.

---


Isn't hitstun over once your character reaches equilibrium from the launch?
Since no one answered this yet... I will.

The short answer is "no." The long answer is that hitstun and knockback are calculated differently, even though they are both calculated in respect to launch speed. Hitstun is a linear function in respect to launch speed while knockback is an exponential function in respect to launch speed. Well... not quite. In reality, when each is solved for time (in frames), they're both linear functions, but they're not equal.

The really long answer goes something like this:

h = s*(m*l / d)

In this equation, h is hitstun in frames (so it's already solved for time), m is the universal hitstun constant (the value we modify with the hitstun code; the vbrawl default is .4), l is the launch speed of the move, and d is a character specific division constant, which ranges between 32 and 36, where characters that have higher fall speed accelerations have a higher division constant (and therefore suffer less hitstun). The variable s is usually equal to 1.0, however, if the move being used is a spike that launches a grounded opponent, it equals 1.25, since spikes that launch foes off of the ground have 80% of their normal launch speed, but calculate hitstun using the normal launch speed of the move. The very existence of the s value means that it's impossible for hitstun to always equal knockback, but I'll keep going.

v = a*f + l ; v>=0

This equation and the next will look very familiar to you if you've taken physics. This equation calculates the instantaneous velocity, v, of a character on a particular frame, f, where l is once again launch speed and a is some negative constant which represents the rate at which a character slows down from the hit (their acceleration). Note that this is in a zero gravity environment, and if I were to include gravity in this calculation, it would be far more complicated. The restriction saying that v is greater than or equal to zero is just common sense. You don't suddenly start moving backwards once your launch speed wears off; your motion simply stops.

At this point, it's possible to solve the system for time. At v = 0, knockback is over, so solving for f, you get f = l/a. This alone won't prove anything, since we still don't know what a is, nor if it varies among different characters, as hitstun's d value does.

x = 0.5a*(f^2) + l*f ; f<= l/a

This equation represents the total distance you travel due to knockback, x, where f, a, and l are the same values they were in the previous equation. Some people will probably yell at me for not including an x0 value (the initial displacement from a reference point, such as the center of the stage), so feel free to add it if it makes you feel better. The restriction placed of f is less than or equal to l divided by a is because of what I just stated above: knockback is over once v = 0. You don't suddenly reverse directions; you just stop. Conveniently, this also means you can substitute f for -l/a in the equation, and obtain a much simplified version allowing you to find the total displacement at the final frame of kb.

x = 0.5a*(-l/a)^2 + l *(-l/a)
x = 0.5*(l^2)/a + (-l^2)/a
x = (l^2)/2a + 2*(-l^2)/2a

x = -(l^2)/2a

That still leaves the question, though... what is a? Well, not only that, but is "l" really what's being squared in the formula? As it turns out, what is actually being squared is the value l/1000. That is the real launch speed that the game uses to calculate knockback. It uses the launch speed we see at the end of the game screen to calculate hitstun, however. You see, I had calculated a stage builder block to be 20,000 units tall using launch speed and the number of frames of knockback. The actual ingame unit is... 20, as provided to us by spunit.

My original calculation:

v^2 = 2ax + l^2

Another equation that probably looks familiar to anyone who's taken physics, only with v0 being called l. Since we're using v = 0, and we already know that a = -l/f when v = 0 by the initial velocity equation, you can substitute a and solve for x.

0 = 2(-l/f)x + l^2
x = (l^2)*(f/l)/2


x = l*f/2

At this point we need some data. A luigi using upB on a 0% jiggs will produce a launch speed of 4000, knockback will complete in 68 frames, and jiggs travels almost exactly 6.8 blocks high on a tower of stage builder blocks, which are each of a height, b. Plugging in...

x = (4000)*(68)/2
x = 136,000

6.8b = x
6.8b = 136,000

b = 20,000

Except... we know from spunit that b = 20, not 20,000. Since obviously the frame count isn't off by a thousand fold, it must therefore be the launch speed that the game is dividing by 1000. Correcting the calculation:

x = (l/1000)*f/2
136 = ((4000)/1000)*(68)/2

Now that we know x and know that l in the knockback equation is actually l/1000, let's try solving for a... finally.

x = (-(l/1000)^2)/2a
a = (-(l/1000)^2)/(2*x)
a = (-((4000)/1000)^2)/(2*(136))
a = (-(4)^2)/(272)

a = -.0588 or a = -1/17

Which would make the following equations true:

v = -17*f + (l/1000)
f = 17*(l/1000) (when v = 0)
l = 1000*f/17 (when v = 0)
x = -(17/2)*(f^2) + l*f
x = ((l/1000)^2)/38

At the least, this is true for jigglypuff. I have yet to verify that every character has the same acceleration during knockback, although I don't see why they wouldn't. "Weight" is already factored into the launch speed formula, so it wouldn't make sense to account for launch resistance twice.

And to finally answer the question at the top of this post...

f = 17*(l/1000)
f = 17*((4000)/1000)
f = 68

h = s*(m*l / d)
h = (1)*((0.4)*(4000) / (32))
h = 50

The number of frames of knockback and the number of frames of hitstun are not equal given the same launch speed. If you wanted hitstun to equal knockback, you would need to set m to .544. Again, though, note that this doesn't consider gravity in the equation, so typically, characters will begin falling before hitstun wears off.
 

phi1ny3

Not the Mama
Joined
Apr 15, 2008
Messages
9,649
Location
in my SCIENCE! lab
Sorry that I'm bumping this, I'm picking up on this, sounds pretty elementary once it's broken down in these figures, but really good to know.

Thanks for the info :D
 

Veril

Frame Savant
Joined
Jun 20, 2008
Messages
3,062
Location
Kent Lakes, New York
I already tested this A YEAR AGO and it doesn't work. Bad phi1ny3!

The first major thing I did in the workshop backroom when I met Leaf was test to see if this actually holds up, and it didn't. The "d" value is bs.

Launch speed should never be used for any equations. I will seriously not even look at a formula that involves launch speed.
 
Status
Not open for further replies.
Top Bottom