Toomai
Smash Ace
ALL ABOARD THE PAIN TRAIN
THE HURTBOX INFORMATION TOPIC
PREAMBLE
(read this you maggots)
THE HURTBOX INFORMATION TOPIC
PREAMBLE
(read this you maggots)
Righto, this topic will get into hurtboxes/hurtbubbles/damageable areas/whatever you feel like calling them.
First, a word of warning: Hurtboxes are a lot harder to work with than, say, hitboxes. The physics are about the same but the editing and semantics might be tougher.
HURTBOX INTRODUCTION
(exactly what it says on the can)
(exactly what it says on the can)
A hurtbox is a sphere, tube, plane, or cuboid shape used to detect collision with hitboxes. As you may know, hitboxes are (almost?) always perfectly spherical. Hurtboxes are not. Here are some example hurtbox shapes:
Hurtboxes are attached to specific bones and rotate (and most likely scale) along with them. They also have another attribute or two.
THE NITTY-GRITTY
(what you came here for)
(what you came here for)
Q: Where do I find hurtbox data?
A: That depends. If you're using Tabuu, you have it (kind of) easy, just open FitChar.pac and go to Sections->data->Misc->UnknownT. This is important: The thing labelled "Hurtboxes" actually isn't hurtboxes. You want UnknownT. Each UnknownT is a hurtbox.
If you don't have Tabuu, then it's a bit tougher. You'll have to manually read the file in a hex editor and look for a string of "FFFFFFFF FFFFFFFF" after the last subaction of the character and its articles. After that and a few integers you'll come upon the hurtboxes - without a bit of experience you may not recognize them, but the flags should give them away after a while.
Q: What is a hurtbox composed of?
A: A hurtbox is made of seven floats and a set of flags. In order, these values are:
- X Offset
- Y Offset
- Z Offset
- X Stretch
- Y Stretch
- Z Stretch
- Size
- Flags
Q: What are "offset" and "size"?
A: Just like hitboxes, hurtboxes start out centered on their parent bones, and can be shifted along the bone's relative axes through a nonzero offset. Also like hitboxes they have a size, given as a radius.
Q: What's "stretch"?
A: This is best described by example. Let's go back to that image above:
The hurtbox on the left has all its stretch values equal to 0; it remains a perfect sphere. Note that all these hurtboxes have a size of 1.
Hurtbox number 2 has an X Stretch of 2. The hurtbox is now 2 units longer along the X-axis in the positive direction - it retains its radius of 1, and the ends are half-spheres. Think of it like duplicaing the sphere, moving it a distance equal to the stretch value, and then joining the two along a line.
The third hurtbox has an X Stretch of 2 and a Y Stretch of 1, while the fourth also has a Z Stretch of 1. Note that changing the hurtbox's size will not change how much it gets stretched, it will only chang ethe radius of the semispheres at each corner of the cuboid.
Also, another important note: If the stretch is negative, this does not mean the hurtbox will be flattened along the axis; it mean it will be stretched in the opposite direction. This means that, in this image:
...you cannot make a hurtbox shaped like the one on the left (a disc) by giving it a size of 1 and a negative Y Stretch. The closest you can get is the one on the right (a square), which has a size of 0.1, an X Stretch of 1.6, and a Z Strech of 1.6.
Q: What are the flags?
A: The flags are a set of 32 bits that are used for extra data (though only the first 16 bits seem to be used). Remember, while they're displayed as hex digits, you have to convert to binary in order to split up the bits.
- Bits 1-9, when interpreted as a number, are the hurtbox's parent bone. The parent bone is how the hurtbox moves with animations and is also how the game decides what to make invincible/intangible (e.g. Mario's up smash), so it's important to get this right.
- Bits 10-11 do something but I don't know what. Generally, they seem to be 00 for most body parts, 01 for lower arms, and 11 for legs. They can be 10 in some cases that don't seem to be related.
- Bits 12-13, when read as an integer, are the zone of the hurtbox. There are three zones: lower (0), middle (1), and upper (2). This is the value used to determine whether the hurtbox activates a low, middle, or high damage animation.
- Bits 14 and 15 appear to be unused.
- Bit 16 appears to always be 1. It's possible that setting it to 0 will disable the hurtbox. Since this is always 1, you can look for hurtboxes by searching for any hex string that has an odd number in position 4 followed by four 0s (place your bets on when this will backfire).
WARNING! If you're using Tabuu, it doesn't show these flags properly if you just read it off the right panel (it'll show a917 instead of 17a90000). You have to right-click on the UnknownT and open the Hex Viewer to see it properly (experts: for some reason the right panel uses little-endian ordering instead of the correct big-endian).
Q: Can I change how many hurtboxes a character has?
A: Deleting hurtboxes should be easy - you can just set flag 16 to 0 (if that's what it does), or you can give it a size of 0 and hide it in the character's body somewhere.
Adding hurtboxes, on the other hand...I'm going to claim this isn't possible at the present time. The main reason is that you would have to displace all of the file that comes after the hurtbox data - since this is after all the subaction and article data it wouldn't be too catastrophic, but it would still be a massive pain to sync everything up again - even if you knew how to tell the game there are now 16 hurtboxes instead of 14.
Q: Anything else important to know?
A: Yep.
- Some characters, like Dedede and Olimar, have hitData objects in their Sections list (in Tabuu). This contains hurtboxes for things like Waddle Dees and Pikmin.
- As for item hurtboxes - I've look for them the best I can and can only find any for Wario's bike. I think we can all agree that things like Crates and Barrels must have hurtboxes, but I can't find them.