YesNoOk
avatar

Accurate hit velocities? (Warning, Math) (Read 3781 times)

Started by Bronko, January 23, 2009, 09:43:41 am
Share this topic:
Accurate hit velocities? (Warning, Math)
#1  January 23, 2009, 09:43:41 am
  • ******
  • Just a butcher on a mission.
    • www.justnopoint.com/lbends
I was doing some research for my WIP character and it occurred to me that friction can work differently from game to game.  Therefore, I decided the only reasonable way to get the near-accurate results in mugen would be to make sure the opponent travels the same distance.

In mugen, friction works by multiplying the X velocity by the friciton coefficient every tick.  Since for the most part people do not change this, we'll assume the following constants:

Standing friction coefficient : .85
Crouching friction coefficient : .82


For example, a hit with vel = -5,0 and slidetime = 5 would make a standing opponent slide
first tick : 5 pixels
second tick : 5 *.85 = 4.25 pixels
third tick = 4.25 *.85 = 3.6125 pixels
fourth tick = 3.6125 *.85 = 3.070625 pixels
fifth tick = 3.070625 *.85 = 2.61003125 pixels
Total = 18.54315625 (Rounded down)-> 18 pixels

Those with a bit of Calculus under their belt would notice that this is a geometric sequence, where the number next in the sequence is a ratio of the previous number.  Lucky for us, we can condense this into a simple formula!

Total Distance = Initial Velocity * (1-Ratio^Slide Time)/(1-Ratio)

If we use the formula to check the above calculation...

Total Distance = 5 * (1-.85^5)/(1-.85)
Total Distance = 5 * .5562946875 / .15
Total Distance = 18.54315625
It checks out!

Given that Ratio will always be the same (Either .85 or .82) you can figure out any of the missing values (Initial Velocity, Slide Time, Total Distance) if you know the other two.  So if you know what the slide time and total distance are for a given move, you can find the initial velocity using

Initial Velocity = (Total Distance * .15)/(1 - .85^Slide Time) Standing
Initial Velocity = (Total Distance * .18)/(1 - .82^Slide Time) Crouching


Or you can find the Slide Time using

Slide Time = log(.85)(1 - (Total*(.15))/Initial Velocity) Standing
Slide Time = log(.82)(1 - (Total*(.18))/Initial Velocity) Crouching
(Where log(10)(2) means logarithm base 10 of 2)



Now if you'll excuse me, I'll be going back to artmoney-ing this game...
Re: Accurate hit velocities? (Warning, Math)
#2  January 23, 2009, 08:33:12 pm
  • ******
    • network.mugenguild.com/pots/
Welcome to the club. And in before the school of thought that defends instead that the initial velocity should be accurate to the game, and that it's up to P2 to have accurate friction to that same game.
Use anything you want from my works.  If you need to contact me use email, not private messages.
Re: Accurate hit velocities? (Warning, Math)
#3  January 23, 2009, 08:34:08 pm
  • ****
  • Master of the palm and foot.
    • randomselect.piiym-net.com/
Ah, but what about cornerpush and aerial blows?
Re: Accurate hit velocities? (Warning, Math)
#4  January 23, 2009, 11:40:16 pm
  • ******
  • Loyal to the Game
    • USA
    • http://jesuszilla.trinitymugen.net/
custom cornerpush FTW? ???
Re: Accurate hit velocities? (Warning, Math)
#5  January 24, 2009, 12:24:37 am
  • ****
  • Master of the palm and foot.
    • randomselect.piiym-net.com/
...and? If you still want a simpler system for going back a certain distance there should be a method (case in point, infinite prevention for custom/original characters).
Re: Accurate hit velocities? (Warning, Math)
#6  January 24, 2009, 12:30:58 am
  • ******
    • network.mugenguild.com/pots/
There's no way to make corner hitvels match the others with Mugen's default system, so whatever way you go at it doesn't truly matter because combos will be botched anyway.
Use anything you want from my works.  If you need to contact me use email, not private messages.
Re: Accurate hit velocities? (Warning, Math)
#7  January 24, 2009, 01:03:23 am
  • ******
  • [E]
    • Mexico
well were not you saying that averaging friction is cool :P !? if so just use aok's formulas with 0.70 friction.
Re: Accurate hit velocities? (Warning, Math)
New #8  January 24, 2009, 03:22:28 am
  • ******
    • network.mugenguild.com/pots/
That's not the point, just that, unless P2's friction is 0.7 already, there will always be a discrepancy in P2's behaviour depending on where he started at.  Hell, even if it is 0.7 there's still the thing with the corner push only working if P2 starts at a corner.

Meh, I can barely recall the last time I had to worry about this; what Jesuszilla said.
Use anything you want from my works.  If you need to contact me use email, not private messages.
Last Edit: January 24, 2009, 03:29:55 am by P.u.n.Y.