PDA

View Full Version : Hit Boxes



NinjaMicWZ
02-11-2009, 05:37 PM
I recently had to use this technique for the Contra level I'm working on for neogaf's team project as a way to simulate the way Contra bosses will register hits from bullets on any point of their body. I couldn't use a traditional set up where the player shoots individual pieces one at a time, or tries to target a specific, tiny piece of the enemy body - I needed a single hit box that would allow any hit, on any side or piece of the enemy to register as a loss to a single paint meter that controlled a single brain.

Anyone familiar with the concept of collision detection, should know what a hit box is, as most prominently found in fighting games, shooters, or FPS target reticules and seen in debug modes. These are the invisible target zones that register collision from another object and initiate a specific action or reaction in accord with the trigger event. You're not actually hitting someone's head with a sniper rifle, you're hitting a target zone that registers bullet contact and tallies up damage.

If you're ever having trouble designing a paint switch system for a complex, multi-piece multi-material object and don't want just one piece, or certain pieces to register hits from the paintinator try this simple fix -

Construct a box or a simple plank out of rubber (or another material that turns invisible when shrunken). Make sure this plank or box is big enough to fit around your object, or cover the entire area that you want to register as a hit zone - before shrinking it, attach a paint switch and attach it to your brains, set to one shot like always. Shrink the rubber box/plank until it is invisible. Now attach it to the object or place the object inside of and then shrink until it is encased in the invisible box.

Depending on the machine/object design you will probably have to variate this box/plank design quite a bit and it is sometimes difficult to construct a box that will turn completely invisible. You will probably have to construct separate planks and embed them together manually rather than simply shrinking the entire shape in one go. It also won't be needed for every type of enemy, as you sometimes will WANT it to to destroy piece by piece and have multiple hit zones.

It is imperative to attach the paint switch to the invisible piece before shrinking it, as you can't click on it or touch it once shrunken - also, once it's attached it can't be removed without cutting away what it's attached to, cutting it out, or manually detached the object from it. So proper planning is necessary.

If all goes well you should have an enemy or object that appears to be suffering a barrage of paintballs, but is actually encased in an invisible shield that takes all the damage and upon destruction takes the entire enemy/object with it regardless of complexity, pieces, number of brains, and material types.

I'm sure this explanation isn't too clear (ha, clear), and I don't have an object demo set up for this, as there's nothing to see (ha, see). I do have it implemented in my current project if anyone wants to see. Msg me on PSN and I'll attempt to show it (ha, show).

CCubbage
02-11-2009, 05:58 PM
Very cool idea. I've been implementing another kind of collision detection in my current project in which your entire vehicle will blow up if any part of it hits a boulder - but the vehicle is a fairly complex-shaped object.

To do this, I put a magnetic key on each corner of the complex vehicle object. The vehicle also contains a brain. Then, each object that the vehicle can hit (about 10 of them) contains a magnetic key which extends a piston with another magnetic key and causes the vehicle's brain to self destruct.


But I had not thought of your above idea for collision detection using paintballs - very cool!

Risen
02-11-2009, 07:40 PM
It sounds like this would have the side-effect of making the paint splats not appear on the inner object. Is that true?

Trap_T
02-11-2009, 08:08 PM
Couldn't you just hook up 1 shot paint switches to each separate part of the boss/monster's body so that when they are hit they activate an emitter via a OR switch that shoots a single paintball at another object with a paint switch on it that is attached to the brain?

NinjaMicWZ
02-11-2009, 08:30 PM
Yes, Risen. The force shield will be splattered and will not display the paint. That can actually be a useful side effect if you were wanting to avoid unstickering from paint splats.


Couldn't you just hook up 1 shot paint switches to each separate part of the boss/monster's body so that when they are hit they activate an emitter via a OR switch that shoots a single paintball at another object with a paint switch on it that is attached to the brain?

Yeah, but depending on how many pieces and how many planes it's going to require hundreds and hundreds of switches wired to hundreds and hundreds of gateways or emitters to shoot onto one switch somewhere else. That's a huge mess.

Also, if your object is to be captured and emitted, you'd have to capture the entire paintball set up with it. and have that emit as well.

The UFO boss I created this for has probably 70 odd different pieces on several different planes, on all sides of it's body, and it drops mini ufos that are constructed of 5 different pieces using about 10 different emitters. The minis are also encapsulated in a hit box that is also lethalized so that if they contact the player it will kill. If I had to have it emit mini ufos with 5 paint switches, the mag switch that's on all of them, and a logic system for each one it wouldn't even function after dropping 2 or 3. It fills the screen with about 10 mini ufos at any given time.

It's done like this so that no matter what you shoot and where, on any plane, it all takes damage for 1 life bar and will KO the brain. No logic gates and switch boxes involved.

Trap_T
02-11-2009, 08:31 PM
Ahh I see, I guess I'm just not into creating such complex bosses... :P

Nice solution.

NinjaMicWZ
02-11-2009, 09:20 PM
A nice benefit of something like this, is that you can use a an invisible slab with a paint switch to give spikes some hit detection. Spikes normally never detect hits.

The secondary mid-bosses in the snow level for the original Contra are tank/truck hybrids with a set of spikes on the front bumper. In order for me to match that aesthetic I had to put 3 sets of spikes on the front of the vehicle.

To create hit detection for this on all 3 planes, I put a single slab of rubber over the front, and put a paint switch on it. Shrunk it to invisible width and cut it to the right height, and lethalized it so that the spike area still causes a kill. Glued it, and attached the switch to the brain. Now, the player can be on any of the 3 plans and fire away madly at the block of spikes in front of them and ultimately destroy the entire vehicle before it rolls over you.

snowflakecat
02-12-2009, 10:03 PM
I think the most interesting thing this concept has to offer is that you can shrink rubber to become invisible. I never knew that (always thought it only worked with dark matter). Will try later to see if it works...

NinjaMicWZ
02-12-2009, 10:12 PM
It also works with some of the metals, and dissolve materials. Usually the materials that get all jagged and mishapen when you shrink them or cut into them will eventually turn invisible when shrunken. All the vertices have nowhere else to go and seem to implode in on themselves after a certain point...

lol, I guess it isn't that useful outside of the style of project the Little Big Contra team is working on, but I was pretty happy with the solution I'd found. After building the boss, I was dreading the thought having to decide what would be weak spots or how to make it's entire body vulnerable to attack... my main priority was just trying to simulate the way an old school Contra boss is defeated. It couldn't be done MG Rex-style with red zones and multi-stage piece destruction.

I'm sure there are other uses for this concept I haven't thought of yet... especially in the realm of old-school homage... but for now it does the job I need it to.

snowflakecat
02-12-2009, 10:54 PM
I think it's very useful, but the main problem as mentioned before will be that paint would splatter on the wall instead of the enemy. A complex system would probably look better at the sacrifice of thermometer.

Trap_T
02-12-2009, 11:15 PM
The wall will be so thin, you wouldn't be able to see the paint splatter.

NinjaMicWZ
02-13-2009, 12:07 AM
Yep. It doesn't splatter on the wall... I've been shooting at them a thousand times a day while testing this new level.

It hits the wall, but leaves no stains.

Like I said before, a nice use for this could also be as a protective layer on certain stickered objects or terrain that, depending on what the player's doing (shooting hundreds of times, or using a custom weapon that emits paintballs etc), would prevent them from ever unstickering the object that they appear to be shooting at.

I have a few destructible walls in SEMINAL GEMINI that are fired upon by the player with a paint-ball cannon, while the other player aims the turret with a 3 way switch. Alot of times the player on the turret is firing for several minutes while the other player tries to aim... if the wall's weak point isn't hit in time, the paintballs cause the dissolve wall to unsticker itself and effectively "break the illusion". If I had thermometer space left, I would definitely implement a hit box shield on them just for that small little bit of polish and debugging.

snowflakecat
02-13-2009, 01:49 AM
hmm I definitely have to test this out. Isn't it a bit tedious to get the invisibility, though?

NinjaMicWZ
02-13-2009, 02:47 AM
It is tough to get it on anything other than a straight plank. What has made it easiest for me, when trying to make an invisible box, is to make 4 planks (or 2, or 3, depending on the style of box) separately then copy and embed them onto each other. Highlighting the invisible slabs makes it much easier to see your exact corner marks and placements, and it's often good to use other visible materials as place markers or levels and try to make this is grid-centric as possible, as trying to eyeball the construction of an invisible box is no easy task.

It seems to have a lower chance of having a few visible surface areas if constructed this way, whereas if you just make a rubber box and cut it into the skinniest width possible, it will never be fully invisible.

Neverynnal
02-13-2009, 04:03 AM
Yeah this is just awesome man. It really adds a whole new dimension to boss fights and I'm sure there are a ton of gameplay ideas that can be incorporated with this new idea. This would have been just awesome in SEMINAL GEMINI man. Especially for the turrets that you mentioned that have too small of a hit zone unless you know where to shoot (in my opinion). I'm pumped to check out how you implemented it.


Now imagine this. You know how in the old NES games, whenever you shot/hit a boss it flashed white/red upon getting hit? I'm sure we can tailor a way of doing this effectively. I can't think of a way of doing it at this moment, but it seems you can do almost anything you can think of with LBP. Just takes a lot of thinking through and the will to try. Great work man.

snowflakecat
02-13-2009, 10:11 AM
I just tried out making some materials invisible and it worked! Really annoying to do, though, but it can be useful for moving invisible walls... thanks!

NinjaMicWZ
02-13-2009, 12:57 PM
I just tried out making some materials invisible and it worked! Really annoying to do, though, but it can be useful for moving invisible walls... thanks!

Good, man... glad this helped somebody at least. I just was playuing around with it yesterday too, and even some of the materials that don't shrink to invisible... if you shrink them as thin as possible, then copy the piece and cut it even skinnier you can make almost any of the more solid materials invisible.


Yeah this is just awesome man. It really adds a whole new dimension to boss fights and I'm sure there are a ton of gameplay ideas that can be incorporated with this new idea. This would have been just awesome in SEMINAL GEMINI man. Especially for the turrets that you mentioned that have too small of a hit zone unless you know where to shoot (in my opinion). I'm pumped to check out how you implemented it.


Now imagine this. You know how in the old NES games, whenever you shot/hit a boss it flashed white/red upon getting hit? I'm sure we can tailor a way of doing this effectively. I can't think of a way of doing it at this moment, but it seems you can do almost anything you can think of with LBP. Just takes a lot of thinking through and the will to try. Great work man.

Awesome. I think I'm going to implement that.

I just need a secondary paint switch set to directional, that only has 1 hit point on the same hit box... connect it to a small red/white LED light on the boss and each hit will activate the light.

It'll be like the lights in my Metal Slug Solid level that you can shoot out for points, but purely for effect and not set on inverted. It should work, if not I'll keep playing with the settings til it does. GREAT idea.

EDIT: Ok scratch that... in order to do this you need the secondary paint switch wired to a mag key piston box, so that each hit activates the piston and then activates the light. I might implement this if I have room, but I'm on my last couple block and a quarter of therm and need to save space for a few more enemies.

I've also been playing with "on impact" noises to give the boss hit sounds... the classic "ping" from Contra, but it's been tough to find a sound that is fitting, and doesn't sound annoying every other second. Sounds also change every time they're activated, and it's tough to find one that's making the right noise consistently.

snowflakecat
02-14-2009, 07:48 PM
seriously we need new sounds

pivottt
10-18-2010, 04:26 AM
Yeah, thanks, I were tired of putting paint switches that would emit paint over another paint switch.

Antikris
11-25-2010, 04:31 PM
This is a very good idea and I particularly like how oldschool gaming is inspiring you to this. :D

Another benefit of this method is that you can construct a hitbox in a different plane than that of the boss. This is helpful because sometimes you want to reserve an entire plane for free boss movement, another for free player movement and not have them get in each others way.

Does electrifying an invisible slab of rubber make it show up?


I've also been playing with "on impact" noises to give the boss hit sounds... the classic "ping" from Contra, but it's been tough to find a sound that is fitting, and doesn't sound annoying every other second. Sounds also change every time they're activated, and it's tough to find one that's making the right noise consistently.

Sounds > Music > Hihat. Give it a high pitch and it will make a nice, yet unobtrusive ticking sound. I use it for puzzles in which the player is 'selecting' something through a cycle of objects. Hard to explain that last sentence, but you'll see it in practice soon enough. :)

Sehven
11-27-2010, 04:02 AM
Does electrifying an invisible slab of rubber make it show up?

Nope, it'll still be invisible.


Sounds > Music > Hihat. Give it a high pitch and it will make a nice, yet unobtrusive ticking sound. I use it for puzzles in which the player is 'selecting' something through a cycle of objects.

Nice of you to offer a suggestion to his problem, but his post was almost two years ago, so he's probably not actually looking for an answer any more at this point. Still, it might be helpful to others, so that was nice. Please don't double post though (post in the same thread twice in a row).

NinjaMicWZ
11-27-2010, 04:39 AM
This is a very good idea and I particularly like how oldschool gaming is inspiring you to this. :D

Another benefit of this method is that you can construct a hitbox in a different plane than that of the boss. This is helpful because sometimes you want to reserve an entire plane for free boss movement, another for free player movement and not have them get in each others way.

Does electrifying an invisible slab of rubber make it show up?



Sounds > Music > Hihat. Give it a high pitch and it will make a nice, yet unobtrusive ticking sound. I use it for puzzles in which the player is 'selecting' something through a cycle of objects. Hard to explain that last sentence, but you'll see it in practice soon enough. :)

wow. the things i used to go through back then. the dark ages.

i'll say thanks anyway, Antikris... 'cause even in the complete rebuild of Snowfield in LBP2 I still am looking for the perfect 'ping' sound. came close... but no cigar.

So glad I don't have to do stuff like this anymore, but you're right, using invisible hitboxes on separate planes went on to be a great technique. mrsupercomputer's robot siege on the bus in his Manufactured Madness level used it to the best effect I can remember.

now in 2, there's so many ways to just set hit detection in your desired range and trigger it with something besides paint.