YesNoOk
avatar

Proper variable height (Read 7112 times)

Started by Jesuszilla, September 15, 2016, 04:17:38 AM
Share this topic:
Proper variable height
#1  September 15, 2016, 04:17:38 AM
  • ******
  • Loyal to the Game
    • USA
    • http://jesuszilla.trinitymugen.net/
Most of us want crossups to work correctly. As such, it'd be nice to have variable height boxes. Unfortunately, MUGEN has a fixed height and uses the bottom of the CLSN2 as the push when jumping. Now, most of us who want to do something about this know about this snippet of Phantom.of.the.Server's code:

Code:
[State -3, Variable Height]
type=playerpush
triggerall= statetype=A && movetype!=H && numenemy
triggerall= p2bodydist x = [-(enemynear,const(size.ground.back) + enemynear,const(size.ground.front)), 0]
trigger1= p2statetype=S
trigger1= p2dist y >= (enemynear,const(size.height) - 22)
trigger2= p2statetype=C
trigger2= p2dist y >= (enemynear,const(size.height) - 48)
trigger3= p2statetype=L && p2stateno!=5120
trigger3= p2dist y >= 11
value=0
ignorehitpause=1

... however, after some checking, this is incorrect. Not only are these numbers pulled out of nowhere since CPS2 hitboxes weren't a thing back then, it doesn't even correctly check for lower bounds of any sort of pushbox!


This is the correct way to check for the pushboxes overlapping when the player is jumping:

Code:
[State -2, Variable Height]
type = PlayerPush
triggerall = StateType = A && NumEnemy
triggerall = P2Dist Y - Vel Y >= (EnemyNear(0), Const(Size.Height) - [pushbox_bottom])
trigger1 = StateNo = [40,50]
trigger2 = StateNo = [600,650]
triggerx = StateNo = [other air states...]
value = 0

Note the - Vel Y portion. This is basically seeing into the future if the player's position will put them into a situation where they could be pushed. As you can see, this is pretty much plug & play with the bottom of the air pushbox. Of course, you can have multiple triggers for multiple pushboxes.

Now unfortunately, there's no reliable way to check the height for any statetype other than standing, so we have to approximate something for crouch and liedown:

Code:
[State -2, Variable Height]
type = PlayerPush
triggerall = StateType = A && NumEnemy
triggerall = P2Dist Y - Vel Y >= (EnemyNear(0), Const(Size.Height) - 52)
triggerall = (StateNo = [40,50]) || (StateNo = [600,650]) || (StateNo = [other air states...] ...)
trigger1 = P2StateType = S
trigger1 = P2Dist Y - Vel Y >= (EnemyNear(0), Const(Size.Height) - [pushbox_bottom])
trigger2 = P2StateType = C
trigger2 = P2Dist Y - Vel Y >= (floor(EnemyNear(0), Const(Size.Height)*0.825) - [pushbox_bottom]) ; 0.825 is chosen because it is a nice float (bitwise) and comes from Sagat's standing pushbox height to his crouching pushbox height.
trigger3 = P2StateType = C
trigger3 = P2Dist Y - Vel Y >= (12 - [pushbox_bottom]) ; This isn't really necessary since the chance of it triggering is low, but I pulled 12 from Sagat's CvS2 liedown hurt box height
value = 0

... but this definitely is flawless for at least standing, assuming the enemy has a proper height.
Last Edit: September 15, 2016, 04:24:04 AM by Jesuszilla
Re: Proper variable height
#2  September 15, 2016, 10:06:37 AM
  • *****
  • Estoy siempre listo para un desafío.
    • Puerto Rico
    • im41784@yahoo.com
what values should I be inserting in [pushbox_bottom])? what do I look for?
Re: Proper variable height
#3  September 15, 2016, 07:05:37 PM
  • ******
  • Loyal to the Game
    • USA
    • http://jesuszilla.trinitymugen.net/
If you copy the pushboxes using my script, or if you trace over the pushbox you get from the game, the bottom of the pushbox will be the rightmost value when you look at it in the .AIR file.

So Clsn3[0] = -24,-78,24,-52, -52 would be your value.
Re: Proper variable height
#4  September 15, 2016, 07:08:35 PM
  • *****
  • Estoy siempre listo para un desafío.
    • Puerto Rico
    • im41784@yahoo.com
If you copy the pushboxes using my script, or if you trace over the pushbox you get from the game, the bottom of the pushbox will be the rightmost value when you look at it in the .AIR file.

So Clsn3[0] = -24,-78,24,-52, -52 would be your value.


Oh ok thanks!

      Posted: September 16, 2016, 10:02:33 AM
ok so I think I have this working correctly, by the way I had to input the push box values
like this so mugen didn't give me an error "(EnemyNear(0), Const(Size.Height) - (-32))"
instead of like the example you showed "Const(Size.Height) - [-32])"

now what I noticed while comparing it to pots code is that when I hop over my enemy, 
my char will just push back the enemy, if the clsn connects, with pots those clsn's can
overlap a big chunk of it an pass right thru the enemy, but that's the whole point of this code correct?
also it now prevents me from doing cross up attacks even experimented with a hurt box as long as in my pic
but I'm not to worried about that for now.

Last Edit: September 16, 2016, 10:03:10 AM by Memo
Re: Proper variable height
#5  September 21, 2016, 03:40:36 AM
  • ******
  • Loyal to the Game
    • USA
    • http://jesuszilla.trinitymugen.net/
You weren't supposed to literally put in the brackets. Also, I don't understand what you're doing. What's the bottom of Ryu's actual pushbox in whatever game you're getting these from? It's almost always higher than the lowest CLSN2.

You shouldn't go by the CLSN2 or it won't work.
Re: Proper variable height
#6  September 22, 2016, 04:15:05 AM
  • *****
  • Estoy siempre listo para un desafío.
    • Puerto Rico
    • im41784@yahoo.com
You weren't supposed to literally put in the brackets. Also, I don't understand what you're doing. What's the bottom of Ryu's actual pushbox in whatever game you're getting these from? It's almost always higher than the lowest CLSN2.

You shouldn't go by the CLSN2 or it won't work.

Awe shit I'm confused now, so I wasn't supposed to put the values in the bracket that says push_box?  I got it to do something lol ill just wait until you release a character with this code in it so I can see an example. Whatever I did works like this, if you take a pots char and low jump over your enemy you can see the clsn overlap the enemys, whatever I did prevents that, it wont let you hop over unless your completely clear, the clsn will push instead of overlapping and passing right thru
Re: Proper variable height
#7  September 22, 2016, 04:23:33 AM
  • ******
  • Loyal to the Game
    • USA
    • http://jesuszilla.trinitymugen.net/
You're supposed to put the bottom Y value of the pushbox, but you don't literally put the brackets there.

Here is Sagat's jumping hurtbox expressed as the standard MUGEN CLSN2:
Code:
Clsn2Default: 1
  Clsn2[0] = -28,-116,24,-40

Here is his pushbox as expressed as a theoretical CLSN3. MUGEN doesn't have this. (If it did, we wouldn't have to do this):
Code:
Clsn3: 1
  Clsn3[0] = -24,-116,24,-52

Notice how the bottom bound of his CLSN2 is at -40. His bottom bound of his CLSN3 (aka the pushbox) is at -52, which is higher than his CLSN2. This is to account for that difference. It's because his pushbox is higher up than his CLSN2 that crossups are possible in the original game.
Re: Proper variable height
#8  March 17, 2022, 09:51:46 PM
  • ******
    • Portugal
    • network.mugenguild.com/pots/
I think this is still worth replying to because someone may get a kick out of the explanation. Particularly JZ if he ever lurks again.

You did have access to some Capcom hitboxes back then. The guidebooks for some games had some of them pictured, but, most importantly, the Sega Saturn version of Vampire Hunter had hitbox display. I think CPS-1 SF2 had them in a debug mode as well but I can't remember. Maybe more.
Of course it's not the same thing as having access to the work you shared, but you could learn some rules from it.

Another thing is I sometimes manipulated P2's position with ArtMoney to see where P1's hitboxes were. Mostly to see where they ended in terms of anti-airing.

Anyway the point of this thread is the push boxes. Those were easy to figure out without any hitbox display. Have two of the same character, push them against each other, divide their distance in half and you have the forward X component of the box. I generally used the same value for the back. For the Y component, set P1 to a certain position and see if he can walk over P2. If he can do it at Pos Y 71, but not at 70, then P2's height was 70. And so on. You can see the liedown pushbox this way as well.

That's just history though. The thing you were missing to pick my brain when I made that little code was that I accepted that normal-sized Mugen characters were generally going to have a height of 60 (as they should), not the height they had in their source games. The virtual height of P2's crouching pushbox was calculated by how much the pushbox changed between standing and crouching in the source games (I liked using Ryu and such base characters to determine this).
And I think I liked to use 32 as the bottom of the jumping push box, for reasons forgotten.
The values in the code were calculated from these numbers.

You're 100% right that I didn't take into account that the bottom of P1's push box may take more values than 0 (standing) or 32 (jumping in mine). Coding that felt like diminishing returns at that point. I recently found that you should at least make the dashing (hop type) boxes different from the jumps, however.

And defining the liedown pushbox was not just for show, but for corpse hopping.