Placement of movement and hit bounds

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
AaronWizard
Citizen
Posts: 68
Joined: Sun Nov 06, 2011 2:45 pm
Location: Canada

Placement of movement and hit bounds

Post 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 1778 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 1778 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 1778 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:
User avatar
MarekkPie
Inner party member
Posts: 587
Joined: Wed Dec 28, 2011 4:48 pm
Contact:

Re: Placement of movement and hit bounds

Post by MarekkPie »

Stop. :)

But if you need an opinion, I'd say do full sprite bounding box.
User avatar
tentus
Inner party member
Posts: 1060
Joined: Sun Oct 31, 2010 7:56 pm
Location: Appalachia
Contact:

Re: Placement of movement and hit bounds

Post 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.
Kurosuke needs beta testers
User avatar
AaronWizard
Citizen
Posts: 68
Joined: Sun Nov 06, 2011 2:45 pm
Location: Canada

Re: Placement of movement and hit bounds

Post 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?
Post Reply

Who is online

Users browsing this forum: No registered users and 90 guests