Page 1 of 1

Placement of movement and hit bounds

Posted: Sun Feb 19, 2012 2:48 am
by AaronWizard
I'm soliciting opinions on where to place the movement and hit bounding shapes on my sprites.

My game is (will be) a top-down Robotron-style shooter. Being able to tell where your sprite can get hit is fairly important. At the same time, the tileset has perspective and I'd like the way the sprites collide and overlap with each other to match.

Movement bounds
Movement bounds
sprites00.png (97.19 KiB) Viewed 1876 times
The base movement bounds is a circle. My options are to have the sprite completely contained inside the circle or to have it taller than the circle for perspective.

Hit bounds
Hit bounds
sprites01.png (119.66 KiB) Viewed 1876 times
Then there are the bounds used to tell when a bullet has hit the sprite. I can either make it fit snugly around the sprite itself or make it match the movement bounds. Making the hit bounds match the movement bounds can introduce gaps, and may be misleading if I use the tall version of the sprite. At the same time, it would be perspective correct since the sprite would be covered by a cylinder, and I can reuse the movement bounding circle.

Perspective hit bounds
Perspective hit bounds
sprites02.png (50.02 KiB) Viewed 1876 times
For even more perspective correctness, I can have the hit bounds halfway between the top and bottom of the cylinder that surrounds the sprite, since bullets would be flying above the ground. Though this might obscure the sprite's hit region even further.


Stop me if I'm being to pedantic. :crazy:

Re: Placement of movement and hit bounds

Posted: Sun Feb 19, 2012 4:24 am
by MarekkPie
Stop. :)

But if you need an opinion, I'd say do full sprite bounding box.

Re: Placement of movement and hit bounds

Posted: Sun Feb 19, 2012 8:49 pm
by tentus
The question you should ask yourself is not "which is more correct", but rather "which will be more intuitive". Is a player going to be confused or frustrated when they get hit by something they thought would miss?

A solution you may want to consider: have the player and other "active" entities like bullets use full-coverage collision between themselves, but for more passive objects, use partial-coverage collision. No one's gonna be upset about overlapping a wall. People will be upset when they don't get a powerup.

Re: Placement of movement and hit bounds

Posted: Mon Feb 20, 2012 10:59 pm
by AaronWizard
tentus wrote:The question you should ask yourself is not "which is more correct", but rather "which will be more intuitive". Is a player going to be confused or frustrated when they get hit by something they thought would miss?

A solution you may want to consider: have the player and other "active" entities like bullets use full-coverage collision between themselves, but for more passive objects, use partial-coverage collision. No one's gonna be upset about overlapping a wall. People will be upset when they don't get a powerup.
I'll keep that in mind. Though I was wondering what people would think about having separate collision shapes for hit checks and movement.

Characters are represented by circles to make sliding around wall corners and other obstacles is easier. To keep things intuitive I may have to add a second collision shape (maybe a box) that fits more tightly around a character sprite to use for collisions between characters, bullets, and powerups. This raises the following questions (believe it or not):

1) People won't mind if characters can't get as close to the walls as they can get to each other, right?
2) Is it legal in Box2D for a shape to be set to not collide with a category that the shape itself is a part of?