YesNoOk
avatar

Capn's Questions: Why Hitboxes? (Read 579 times)

Started by CapnWTF, November 22, 2013, 12:58:39 am
Share this topic:
Capn's Questions: Why Hitboxes?
#1  November 22, 2013, 12:58:39 am
  • ***
  • Not enough Flow
    • USA
Hello, MFG, Capn here with another question...well this time less of a question and more of a discussion topic.
In video games, there are various ways to do hit detection, not necessarily with just hit BOXES, but with hit circles, trapezoids. dodeca-whoozits, etc.

But in fighting games, the most commonly(if not the only) used form of hit detection is hitboxes. Is there any reason for this? Would there be any benefit to using a shape other than a box? For those of you who have more experience working with hitboxes in M.U.G.E.N. (maybe even on other engines, iunno) I would appreciate it if you could offer your insight! I want to get to the bottom of this!
Re: Capn's Questions: Why Hitboxes?
#2  November 22, 2013, 01:28:25 am
  • ******
It's been mentioned here and there in random topics, such as the one for the 3D equivalent of Mugen. You only need two points to define a box so it's easy to save space, and then to calculate if there is a collision between two boxes, you only have to compare the horizontal and the vertical intersection, and that's also piss easy. 3D games can use spheres because it's a more logical representation of things, and calculating if a point intersects a sphere (the distance in the 3D space) isn't much different anymore from doing the same as 2D but with 3D boxes. SF4 uses boxes because it sticks to a 2D plane, MvC3 uses spheres for whatever reason.
If I struggled to the end of my determination, to the end of my way of life with my followers, if the result is ruin, then this ruin is inevitable. Grieve. Shed tears. But you cannot regret.
Re: Capn's Questions: Why Hitboxes?
#3  November 22, 2013, 01:43:04 am
  • ******
  • [E]
    • Mexico
spheres are easy in 3d because you only need to check if the distance between the spheres is smaller than the radious of one sphereand distance is very easy to calculate, so sphere collision is even easier than box where you have to compare the left most point to the right most point and then do it for the 2 other coordinates if necessary. it's one of those things where it's easier to check the negative, if it's not not colliding then it's colliding.
sphere checking requires multiplications (squareroots are not necessary) and 3d ahrdware/libs do a lot of that anyway.

talking about boxes, the hardware back then did not handle multiplication as well, on the other hand being limited to 2 coordinates made it even easier, plus if you take into account that pixels in the graphics were more noticeable back then it's logical that it was easier to move from checking pixel perfect collision to boxes as boxes are kind of big pixels, also some old hardware already natively checked boxes and collision so you did not even need to code anything regarding checking.
Re: Capn's Questions: Why Hitboxes?
#4  November 22, 2013, 02:23:02 am
  • ***
  • Not enough Flow
    • USA
I see. That makes a lot of sense actually! How did you guys learn all of this?
For a 3D game like Tekken, are the characters' hurt boxes(and/or width) controllers also spheres? Considering that all parts of the sphere are equidistant from it's center, wouldn't spheres be too big?
And since there are several gaming platforms for which memory is no longer a problem, do you think that there is any benefit to using multiple shapes in tandem (like cube and sphere or square and circle).
Re: Capn's Questions: Why Hitboxes?
#5  November 22, 2013, 06:48:43 am
  • **
  • heheh..
Its logical to use multiple spheres of different sizes to encapsulate the character model polygons. Its possible to use polygon for collision detection (think skyrim, halflife) mask but if simple geometry can handle the job no point making it complex
Re: Capn's Questions: Why Hitboxes?
#6  November 22, 2013, 12:52:53 pm
  • ***
  • Not enough Flow
    • USA
Okay! This was educational, actually. I appreciate you guys' responses. Are there any other weird hitbox things that you think are important? (not that what you guys have told me so far is weird)