Hit boxes on oblong/shaped shots?
-
Pixel_Outlaw
- Posts: 2646
- Joined: Sun Mar 26, 2006 3:27 am
Hit boxes on oblong/shaped shots?
Does anyone know what the standard hitbox is like for the oblong bullets?
I know in rRootage you can see them as squares but I'm not sure about the games with hidden hitboxes like those offered in the arcades.
I assume they just use a square hitbox the same width as the narrowest part of the shaped bullet?
I can't imagine doing pixel perfect collision for shaped bullets back in the early Cave days.
Most people would not try to fly between oblong shots if they overlap visually maybe they get away with squares there.
Any information might be helpful, thinking about adding oblong shots in a game of mine.
From a programming perspective rectangle hitboxes are the easiest collision test on the CPU in most cases.
I know in rRootage you can see them as squares but I'm not sure about the games with hidden hitboxes like those offered in the arcades.
I assume they just use a square hitbox the same width as the narrowest part of the shaped bullet?
I can't imagine doing pixel perfect collision for shaped bullets back in the early Cave days.
Most people would not try to fly between oblong shots if they overlap visually maybe they get away with squares there.
Any information might be helpful, thinking about adding oblong shots in a game of mine.
From a programming perspective rectangle hitboxes are the easiest collision test on the CPU in most cases.
Some of the best shmups don't actually end in a vowel.
No, this game is not Space Invaders.
No, this game is not Space Invaders.
Re: Hit boxes on oblong/shaped shots?
I remember seeing an image showing hitboxes for various bullet types in Touhou (anybody got a link to it?) - they were all squares including the knife bullets.
Re: Hit boxes on oblong/shaped shots?
Most oblong shots just have a small circular or square or pixel-sized hitbox right in the middle from what I've seen, this makes it annoying (but still sort of fun in a weird way) to dodge through very slow oblong shots since most of their sprite is a "fake threat" and their oblong shape doesn't help you quickly judge their direction anymore which is the original purpose of oblong shots.
There's still some anomalies, like Pink Sweets had some very large oblong bullets and used multiple small squares for their collision, looked really odd since the two squares were so far apart it seemed you could fly between them.
There's still some anomalies, like Pink Sweets had some very large oblong bullets and used multiple small squares for their collision, looked really odd since the two squares were so far apart it seemed you could fly between them.
Re: Hit boxes on oblong/shaped shots?
Anything other than squares, lines or single pixels would be way too heavy to calculate for any shoot'em up running on old school 2D hardware, or even bullet hell shooters running on somewhat newer hardware. Remember they have to check if every single bullet or obstacle hits the player on every single frame.
Re: Hit boxes on oblong/shaped shots?
Circle-to-circle collision detection is also cheap, as that's just a distance check. But yes, there's little reason for shmups to use more than rectangles and/or circles. Players aren't going to mind if the hitbox is a little more forgiving than it looks. There's a lot you can do with just rectangles. IIRC "Taito lasers" in games like RayForce are made of a string of rectangles.
Re: Hit boxes on oblong/shaped shots?
Looking through the test mode in Batrider is pretty fun, you can find all orientations of Envy's giant blue scream attack there and each has its collision done separately with lots of small rectangles, presumably hand-placed.Shepardus wrote: There's a lot you can do with just rectangles. IIRC "Taito lasers" in games like RayForce are made of a string of rectangles.
Re: Hit boxes on oblong/shaped shots?
A 2 dimensional distance check requires trigonometry though. Not a problem on modern hardware, but definitely a lot more expensive than simple additions and subtractions.Shepardus wrote:Circle-to-circle collision detection is also cheap, as that's just a distance check. But yes, there's little reason for shmups to use more than rectangles and/or circles.

Re: Hit boxes on oblong/shaped shots?
Not between two circles, unless you count squaring numbers and using the Pythagorean Theorem as trigonometry. Maybe the multiplication's more expensive than addition, but it's not like you're taking sines or cosines. It should be negligible even on old processors.
Re: Hit boxes on oblong/shaped shots?
Circle collision is pretty efficient, some devs like it so much, they use it even on bosses, not exactly where you'd expect to see it


-
Squire Grooktook
- Posts: 5997
- Joined: Sat Jan 12, 2013 2:39 am
Re: Hit boxes on oblong/shaped shots?
Hishouzame uses circles, and that games pretty ancient.
As I understand it, the generally accepted method is to divide the screen into a grid and then only check for collisions within the sector that the player currently occupies. So, IIRC you're not doing checks on things outside a certain range of the player.Sumez wrote:Remember they have to check if every single bullet or obstacle hits the player on every single frame.
Aeon Zenith - My STG.RegalSin wrote:Japan an almost perfect society always threatened by outsiders....................
Instead I am stuck in the America's where women rule with an iron crotch, and a man could get arrested for sitting behind a computer too long.
Re: Hit boxes on oblong/shaped shots?
Yeah, that's pretty much the 101 on collision detection. That said, without having done the actual math, and assuming you only have basic CPU opcodes to work with (no GPU to help you do complex math), checking an axis aligned box should always be several times as fast as a circular hitbox, meaning you can afford as many more hitboxes on screen.
I'm sure a ton of shmups use circular hitboxes, especially newer games, just like there are probably a lot that use slanted boxes, etc., I'm just outlining the advantage to "faking out" and sticking to square hitboxes that I'm sure a lot of games in the genre still does. If you go all the way back to the NES you'll probably find a bunch of games that will occasionally allow you to pass directly through a bullet without being detected, as the game may not check for bullet collisions on every single frame.
I'm sure a ton of shmups use circular hitboxes, especially newer games, just like there are probably a lot that use slanted boxes, etc., I'm just outlining the advantage to "faking out" and sticking to square hitboxes that I'm sure a lot of games in the genre still does. If you go all the way back to the NES you'll probably find a bunch of games that will occasionally allow you to pass directly through a bullet without being detected, as the game may not check for bullet collisions on every single frame.
Re: Hit boxes on oblong/shaped shots?
I'd be curious to see the hitbox for the long bullets in muchi muchi pork since a lot of those hitboxes seem very large.
a creature... half solid half gas
Re: Hit boxes on oblong/shaped shots?
DOJ does this too - I tink it checks half the bullets every frame.Sumez wrote:the game may not check for bullet collisions on every single frame.
-
Pixel_Outlaw
- Posts: 2646
- Joined: Sun Mar 26, 2006 3:27 am
Re: Hit boxes on oblong/shaped shots?
Me too, especially the big green shot in the middle there. Don't recall if they have rotated versions of those or not. If not you could use a tall rectangle and be good to go.Some-Mist wrote:I'd be curious to see the hitbox for the long bullets in muchi muchi pork since a lot of those hitboxes seem very large.

I recall Cardinal Sins/Judgement Silversword and V-V/Grindstormer both having some rotating enemy shots too. That spin as they move.
They have odd pill shaped shots. Like em stylistically though.


Would be cool if anyone has a way to dig some hitboxes out of some classic games.
Some of the best shmups don't actually end in a vowel.
No, this game is not Space Invaders.
No, this game is not Space Invaders.
Re: Hit boxes on oblong/shaped shots?
As someone else said, those are most likely just made of two boxes or two circles - or maybe even just one (with the visual effect just there to indicate its direction) Anything more complex really wouldn't be worth the effort. Video game programming is full of stuff like that.
Re: Hit boxes on oblong/shaped shots?
The spinning bullets only have a hitbox in the middle. The large "bullet" bullets in most YGW games are two hitboxes placed depending on the frame. Generally most "long" bullets only have a hitbox in the middle.
Hitcircles are generally performing similarly to hitboxes, it depends on your CPU. A very large number of shooters actually don't divide the screen into buckets, because doing the adjustments for sorting/resorting every frame generally manages to take more time than just doing all the possible collision checks anyways.
Hitcircles are generally performing similarly to hitboxes, it depends on your CPU. A very large number of shooters actually don't divide the screen into buckets, because doing the adjustments for sorting/resorting every frame generally manages to take more time than just doing all the possible collision checks anyways.
@trap0xf | daifukkat.su/blog | scores | FIRE LANCER
<S.Yagawa> I like the challenge of "doing the impossible" with older hardware, and pushing it as far as it can go.
<S.Yagawa> I like the challenge of "doing the impossible" with older hardware, and pushing it as far as it can go.
Re: Hit boxes on oblong/shaped shots?
With axis-aligned (non-slanted) rectangles the process of classifying the boxes into their regions and choosing the player hitbox's region is pretty much the same logic as the collision checks themselves, just expressed differently, and circles are similar, so as trap15 said partitioning doesn't really help. It's more useful when you've got complex geometry with expensive collision tests that you want to avoid running if possible, which happens a lot more in 3D games than 2D.
Shmups can get away with relatively simple collision detection - they're 2D, deal with small areas (the play area is only the size of the screen or slightly larger), and usually only require a simple binary check (did you get hit or not), as opposed to figuring out the angle and depth of the collision or trying to resolve it. None of the algorithms should be very demanding unless you're doing something silly like Sand Scorpion with its destructible bullets.
Shmups can get away with relatively simple collision detection - they're 2D, deal with small areas (the play area is only the size of the screen or slightly larger), and usually only require a simple binary check (did you get hit or not), as opposed to figuring out the angle and depth of the collision or trying to resolve it. None of the algorithms should be very demanding unless you're doing something silly like Sand Scorpion with its destructible bullets.
Re: Hit boxes on oblong/shaped shots?
The issue with Sand Scorpion is it throws a shitload of "can be hit by player bullet" objects on screen, and it also has the player shoot a ton of bullets. Collision detection being O(n*m) means this gets really bad really quick, especially when you don't write your collision check code very efficiently.
@trap0xf | daifukkat.su/blog | scores | FIRE LANCER
<S.Yagawa> I like the challenge of "doing the impossible" with older hardware, and pushing it as far as it can go.
<S.Yagawa> I like the challenge of "doing the impossible" with older hardware, and pushing it as far as it can go.
Re: Hit boxes on oblong/shaped shots?
Yup - there's significantly less slowdown if you use the green or red weapons, which don't shoot as many bullets (though even then it still gets pretty bad).
I've been wondering if any games give the player both a circular and a square hitbox. You can use the circular hitbox for circular bullets, and the square hitbox for rectangular bullets. If I had to implement Utsuho's attacks in Subterranean Animism, which have a lot of large circular bullets, some of which change size as they move, that's what I would do (or just use circles for everything, which would be feasible in SA).
I also wonder what the hitboxes look like on Marisa's rotating Final Spark in Imperishable Night or on her laser attacks in Fairy Wars, with the "blocking the beam with ice" mechanic.
I've been wondering if any games give the player both a circular and a square hitbox. You can use the circular hitbox for circular bullets, and the square hitbox for rectangular bullets. If I had to implement Utsuho's attacks in Subterranean Animism, which have a lot of large circular bullets, some of which change size as they move, that's what I would do (or just use circles for everything, which would be feasible in SA).
I also wonder what the hitboxes look like on Marisa's rotating Final Spark in Imperishable Night or on her laser attacks in Fairy Wars, with the "blocking the beam with ice" mechanic.
Last edited by Shepardus on Tue Nov 29, 2016 10:35 am, edited 4 times in total.
Re: Hit boxes on oblong/shaped shots?
Yeah, partitioning is mostly an issue when you have a lot of object-on-object collisions, complex collisions, and physics simulations and such, not as much when all you care about is whether the player gets hit. You always gotta balance the performance and memory overhead with the cycles you can potentially save.