Dismemberment System

Grab your favourite IDE and tinker with the innards of game engines

Re: Dismemberment System

Postby [Steve] on Sun Jan 26, 2014 8:06 pm

This is how you would check which hitbox has been hit.
This would be in your C_HL2MP_Player::TraceAttack

The hitgroup numbers correspond with there numbers in model viewer /qc and currently only support 0 - 10
They are defined in shareddefs.h so you can easily add more if you need for shooting extra parts off.

Code: Select all
   // get the damage type,
   float flDamage = info.GetDamage();

   //restrict checking hitgroups based on dmg type
   if( info.GetDamageType() & DMG_CLUB )
   {
      //if we are dmg_club dont check our hitgroups, (crowbar melee ect)
      // keep damage the same and dont gib
      flDamage *= 1.0;
      
   }
   else
   {
      // swtich to the hitgroup our trace hit.
      switch ( ptr->hitgroup )
      {
      case HITGROUP_HEAD:
         {
            Msg( "ive been shot in the head" );

            //headshots can be more powerful and thus deal more damage
            flDamage *= 3;

            
            // add call to gib here.
         }
         break;

      case HITGROUP_CHEST:
          // add call to gib here.
         break;
      case HITGROUP_STOMACH:   
          // add call to gib here.
         break;
      case HITGROUP_LEFTARM:
          // add call to gib here.
         break;
      case HITGROUP_RIGHTARM:
          // add call to gib here.      
         break;
      case HITGROUP_LEFTLEG:
          // add call to gib here.
            break;
      case HITGROUP_RIGHTLEG:
          // add call to gib here.
            break;
         case HITGROUP_GENERIC:
          // add call to gib here.
         break;

      default:
      
         break;
      }
   }
User avatar
[Steve]
Interlopers Staff
Interlopers Staff
 
Joined: Fri Mar 06, 2009 11:25 pm

Re: Dismemberment System

Postby TechieUK on Sun Jan 26, 2014 8:53 pm

Awesome, I'll work on getting that in. Obviously I'll have to change it since I'm working with SP.
Also know as WILLAM; TechieUK is my old name. If you see WILLAM on Steam or ModDB, it's me.
User avatar
TechieUK
Regular
Regular
 
Joined: Sat Apr 13, 2013 4:29 pm

Re: Dismemberment System

Postby Guessmyname on Mon Jan 27, 2014 4:57 pm

Hehe, this is the trick we used for decapitating the hospital zombies in Nightmare House 2. As a bonus, with a bit of extra work, you can randomise which 'intact' bodygroup object appears; for each zombie 'type' (doctor, janitor, surgeon and so on) we only had one 'body' mesh and had a bodygroup full of random heads to pick from, which would go to the bloody neck stump when shot.

The one downside is that, like skins, the engine has to load every submesh and texture involved even if there is only one of them present. Texture atlasing to reduce the number of textures / draw calls can get you around most of these problems.

Physics on ragdoll tend to be another image; you can shoot off the head/arm etc visually but the collision system will still think its there. Fortunately people don't tend to notice the ghost limb problem :'D
User avatar
Guessmyname
1337 p0st3r
1337 p0st3r
 
Joined: Sun Mar 27, 2005 10:38 pm

Re: Dismemberment System

Postby TechieUK on Tue Jan 28, 2014 5:09 pm

Neat. I might try model some half arms/half legs to allow some variation.

Edit:
Also, Nightmare House 2! A mod I have yet to play due to my dislike of scares.
Also know as WILLAM; TechieUK is my old name. If you see WILLAM on Steam or ModDB, it's me.
User avatar
TechieUK
Regular
Regular
 
Joined: Sat Apr 13, 2013 4:29 pm

Re: Dismemberment System

Postby TechieUK on Thu Jan 30, 2014 4:25 pm

I carefully re-did the bone weights.

Image

Image

Well worth it.

Enjoy the double post.
Also know as WILLAM; TechieUK is my old name. If you see WILLAM on Steam or ModDB, it's me.
User avatar
TechieUK
Regular
Regular
 
Joined: Sat Apr 13, 2013 4:29 pm

Re: Dismemberment System

Postby Stormy on Wed Apr 23, 2014 10:20 pm

Haha I laughed. So many problems with importing skinned models and ragdolls into source. Impressed with this progress. Any chance of making blood spurty particle trails a la Wolfires Overgrowth?
User avatar
Stormy
May Contain Skills
May Contain Skills
 
Joined: Sun Nov 28, 2010 6:03 am
Location: Cairns, QLD, AUS

Re: Dismemberment System

Postby Gambini on Wed Apr 23, 2014 10:42 pm

Looking forward to see this working and portable for all our mods :D
User avatar
Gambini
Sir Post-a-lot
Sir Post-a-lot
 
Joined: Mon Oct 20, 2008 1:52 am
Location: Buenos Aires, Argentina.
Previous

Return to Programming

Who is online

Users browsing this forum: No registered users

cron