Fighting Game Hitbox Detection

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Kraton
Prole
Posts: 2
Joined: Sun Mar 05, 2017 4:43 pm

Fighting Game Hitbox Detection

Post by Kraton »

So, I'm in the starting stages of creating a simple 2D fighter in Löve, not unlike Street Fighter. My question is how would I go about implementing hitboxes for such a game - I've implemented my own collision detection system with axis-aligned hitboxes in the past, but seeing as this is a fighter, I will most likely need to work with diagonal rectangles for the hitboxes. My first notion was to go with a library like HardonCollider, but I feel like it may be a bit overkill. This is because, at any given point in my game, there are, at most, only 3 collisions that need to be checked:

If player one's hitbox is colliding with player two's hurtbox (only if player one is attacking)

If player two's hitbox is colliding with player one's hurtbox (only is player two is attacking)

If player one's hurtbox is colliding with player two's hurtbox (i.e. the players are touching each other)

Thus, I'm at a crossroads. On one hand, using a library such as HardonCollider seems like overkill for my purposes, but on the other hand, I would have no idea where to start in terms of dealing with diagonal hitboxes. What do you all suggest? Is HardonCollider still the best option in this scenario, or is there some simple method for dealing with these hitboxes that I'm just not aware of?
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Fighting Game Hitbox Detection

Post by raidho36 »

It's only overkill if it weighs a ton and has unreasonably high processing overhead for what you use it for. E.g. using a 3d physics library to check if you clicked a button. Hardon Collider would be fine.

Most fighting games use axis-aligned boxes so yeah you don't even need that much.
Attachments
aDb5w.jpg
aDb5w.jpg (11.82 KiB) Viewed 5009 times
MrFariator
Party member
Posts: 548
Joined: Wed Oct 05, 2016 11:53 am

Re: Fighting Game Hitbox Detection

Post by MrFariator »

As Raidho said, most fighting games just use AABBs to handle the hit detection; thus any library like hardon collider or bump is fine (or just roll your own if need be). Just use enough boxes that they cover the desired path, and touching any single one of them counts as a hit. Perhaps apply some special properties to different hitboxes if you want to have "sweet spots" in your attacks (ex: Luigi's up-b and Marth's "tippers" in Smash).

Aside from 3D fighters (Virtual Fighter, Tekken, Soul Calibur), the only other notable exception to AABBs is Smash that uses spherical hit detection, which allows some minor depth on Z-axis, but it's for the most part hard to notice.

So on the topic of your diagonal hitboxes, I imagine you're doing it so that the animations and underlying hitboxes have a 1:1 ratio between them. For your information, Skull Girls early on had a near borderline obsession with doing just that which led to some quite silly over use for the simplest moves (particularly hurtboxes). However, one could argue that it doesn't make much sense to force tight coupling of animation and hitbox data. For instance, if you consider Guilty Gear's universal forward punch (6P) anti-air move, it doesn't make much logical sense that the character's upper body becomes invincible despite the visuals (example from this page), but it feels good in practice.

Of course, you shouldn't just go bonkers crazy with how you place hitboxes, but rather make them in a way that it serves the intended use case of that particular move.
Last edited by MrFariator on Sun Mar 05, 2017 9:56 pm, edited 3 times in total.
Kraton
Prole
Posts: 2
Joined: Sun Mar 05, 2017 4:43 pm

Re: Fighting Game Hitbox Detection

Post by Kraton »

Thank you both for your replies, especially Mr.Fariator - you really seem to know your shit. I did some more research on my own afterwards, too, and it does seem like non-AABBs are an anomaly. As such, I've decided to just stick with them for my game, as well. This opens up my options tenfold, so choosing between something like HC and my own collision-detection system becomes a much more nuanced decision that I can make by myself later down the line. Thanks for the deeper insight into how fighting games work; you guys are the best!
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 2 guests