is there a way to do location specific damage in QC?

Discuss programming in the QuakeC language.
hondobondo
Posts: 207
Joined: Tue Sep 26, 2006 2:48 am
Contact:

is there a way to do location specific damage in QC?

Post by hondobondo »

or does it have to be first done in the engine?
leileilol
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Post by leileilol »

The only thing you'll do is rough estimation by vector height and that's stupid
i should not be here
hondobondo
Posts: 207
Joined: Tue Sep 26, 2006 2:48 am
Contact:

Post by hondobondo »

leileilol wrote:The only thing you'll do is rough estimation by vector height and that's stupid
why would that be stupid
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Post by Spike »

because shooting from up high is always a headshot.
Sajt
Posts: 1215
Joined: Sat Oct 16, 2004 3:39 am

Post by Sajt »

And shooting from below you'll have to aim at a narrow strip of air three feet in front of his face to get a headshot.
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Swift
Posts: 60
Joined: Tue Jan 26, 2010 11:02 am

Post by Swift »

That's a bit rough isn't it? How do we know he's not using Quake 3 models in Darkplaces or something?
leileilol
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Post by leileilol »

sdquake.exe isn't darkplaces, and quake3 models don't allow for locational damage stuff either
i should not be here
Swift
Posts: 60
Joined: Tue Jan 26, 2010 11:02 am

Post by Swift »

Arguable. Might be the 'wrong' way to do things - but could you spawn multiple entitys for the head etc and set them to SOLID_BSP (per poly collision?), doing away with the BBOX?

Of course this is all pointless if setting the head as a tag_entity means it doesn't get checked for collisions - which I'm not sure on.

//DP_GFX_QUAKE3MODELTAGS
//idea: id Software
//darkplaces implementation: LordHavoc
//field definitions:
.entity tag_entity; // entity this is attached to (call setattachment to set this)
.float tag_index; // which tag on that entity (0 is relative to the entity, > 0 is an index into the tags on the model if it has any) (call setattachment to set this)
Sajt
Posts: 1215
Joined: Sat Oct 16, 2004 3:39 am

Post by Sajt »

It's possible that you could cook up some hack for headshots. If the traceline hits the monster's box, then check manually if the line also intersects some hard-coded smaller box representing the monster's head...
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
hondobondo
Posts: 207
Joined: Tue Sep 26, 2006 2:48 am
Contact:

leilei

Post by hondobondo »

no one even mentioned sdquake. if you ever played it, you would know headshots would be an enormous waste of time to code. i'm thinking more of a zombie mod. i can't believe no one's even done it for quake before, or has they? i mean real zombie not those weird quake zombies. what are those
gnounc
Posts: 428
Joined: Mon Apr 06, 2009 6:26 am

Post by gnounc »

The Horror is a zombie mod ;)
Orion
Posts: 476
Joined: Fri Jan 12, 2007 6:32 pm
Location: Brazil

Post by Orion »

Unfortunately Quake only uses ONE bounding box per entity. On modern games there are multiple bounding boxes for each part of the body, or per-poly collision. So locational damage gets a bit weird in Quake because of that but anyway I still like it.

See a simple diagram below:

Image


I've drawn the bbox accordingly, that's why you see little spheres between the lines. :wink:
As you can see, if you shoot between the player's legs, he will take damage, the bullet will not pass through them.


The simplest way to do this is simply checking where the projectile is hitting.

Use this for hitscan weapons:

Code: Select all

damage = 100; // initial damage value (changeable)
if (trace_endpos_z > (trace_ent.origin_z + trace_ent.maxs_z) - 10) // headshot
 damage = damage * 3; // this will do 3x damage, change to whatever you like
else if (trace_endpos_z < trace_ent.origin_z) // leg shot
 damage = damage * 0.5; // this will do half damage (changeable)
And use this for projectile weapons:

Code: Select all

damage = 100; // initial damage value
if (self.origin_z > (other.origin_z + other.maxs_z) - 10) // headshot
 damage = damage * 3; // same thing as above
else if (self.origin_z < other.origin_z)
 damage = damage * 0.5;
Hope it helps, not tested, just came from the top of my head. :)
frag.machine
Posts: 2126
Joined: Sat Nov 25, 2006 1:49 pm

Post by frag.machine »

Q2K4 has per-poly collision, which could give a little more precise results against hitscan projectiles (shotguns and alike), unfortunately not very helpful against nails and, obviously, rockets. And, unfortunately, there's no way to tell to QuakeC which triangle in the mesh was hit.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
ceriux
Posts: 2230
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Post by ceriux »

question could a multi bbox system be implemented into the quake engine? for better model formats?
Urre
Posts: 1109
Joined: Fri Nov 05, 2004 2:36 am
Location: Moon
Contact:

Post by Urre »

I've implemented multi-bbox systems in QC. It's all perfectly possible...

Do basicly what Sajt said, it's not far from what most games do anyway.
I was once a Quake modder
Post Reply