eli5: In a video game, why is it so hard to create hit boxes? And why aren’t they exact copies of the character model?

588 views

Hopefully this hasn’t been asked before on this sub, but I was wondering why so many games struggle with good hit boxes? Why are they even “boxes” in the first place? I would assume they would just be carbon copies of the character model instead of having individual boxes that stretch out over the characters body.

In: Technology

9 Answers

Anonymous 0 Comments

It’s very easy to check the collision of a box with a box. You can check each vertex on each box and see if it’s on the inside of the other box, and then vice versa.

The problem is when you have a lot of boxes.

If you look back at something like Super Mario 64, Mario had ~750 triangles that defined the shape of his body. If you had two Mario models and wanted to check collision, you would look at the first point, check 750 others to see if there was collision, then another 750 comparisons for the second, and so on. You would get around 750^2 comparisons if you did it this way. Now imagine you took the Super Mario Odyssey model, which I believe has 15,000+ polygons making up his texture. When you do that raw comparison, you get even more things to compare against.

So we need to significantly reduce the amount of stuff we’re comparing. Instead of looking at several hundred triangles that represent Mario’s arm, we can just put one cylinder there. Instead of several thousand triangles that make up his body, we can just use a few spheroids.

Basically, perfect hitboxes are computationally expensive to keep checking. They can be done in something like a rendered movie, where you prerender the footage and can take more than 1 second to produce 1 second of footage, but in real time gameplay, they just aren’t worth the computing power.

You are viewing 1 out of 9 answers, click here to view all answers.