Forum

The quick brown dog jumped over the lazy corpse...

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

The quick brown dog jumped over the lazy corpse...

Postby frag.machine » Sat Jun 29, 2019 10:39 pm

... and got stuck.

OK, I had implemented destructible corpses (using FTEQW's SOLID_CORPSE extension) and pretty much everything works as expected, except when a dog does a leap attack and gets stuck on any corpse in the way.

Besides, I observed that when items like backpacks (that uses SOLID_ITEM + MOVETYPE_TOSS) drops over corpses they don't fall on ground, but stay over the corpse. Is this expected behavior ? While this is not a big deal, I got a bit surprised.

Now I know the dog leap code is a mess and was always prone to weird behavior like floating dogs, but what are the options to fix it with FTEQW ?

Also, an unrelated request: I want some monsters to spill GREEN blood instead the regular red one. What's the best approach with FTEQW ?
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2118
Joined: Sat Nov 25, 2006 1:49 pm

Re: The quick brown dog jumped over the lazy corpse...

Postby madf0x » Sun Jun 30, 2019 2:05 am

The unrelated request I might have a clue, although not sure it is confirming.
The Tutorial download contained a file called "Rainbow Blood".
You don't need all colours but it could be a start.

It is in the weapon.qc scrolling down before the shotgun :
Code: Select all
void(vector org, vector vel, float damage) SpawnBlood =
Particle(org, vel*0.1, 73, damage*2);


which is (a particle, origin, velocity, color, ?)
The colour is currently 73, which is red.
If you can find the number for green you are close in range.

Quaketatic has all files that were in the tutorial thread.
User avatar
madf0x
 
Posts: 5
Joined: Sun Mar 17, 2019 3:09 am

Re: The quick brown dog jumped over the lazy corpse...

Postby Dr. Shadowborg » Sun Jun 30, 2019 7:09 pm

Looks like there needs to be some collision exclusion filters for SOLID_CORPSE. Note that monsters won't walk over SOLID_CORPSE, and oddly, hitscan attacks don't connect.

Maybe Spike should add collision exclusion for FL_MONSTER and FL_ITEM with SOLID_CORPSE?

Regarding blood, you need to modify SpawnBlood and spawn_touchblood. 73 is default blood color, 57 is the corresponding shade of green. You can refer to the palette in qme if you need other color index numbers. Simple hardcoding based on classname would suffice, unless you want more from your blood function (such as sparks from shootable buttons / doors, dust from breakable walls, etc.) Personally, I'd just modify SpawnBlood and spawn_touchblood to take an entity pointer, and make a separate function like CheckBloodType to return a number based on what kind of entity got passed.

Functional Example:
Code: Select all
/*
================
CheckBloodType
DRS:
Function to return a palette index number for specific stuff.  If entity is undefined, return default 73
================
*/
float(entity what) CheckBloodType
{
   if(what.solid == SOLID_BSP) // doors / buttons do yellow sparky stuff
    return 198;
   if(what.classname == "monster_boss") // Flame colored stuff for Mr. Lavabutt, only works if his takedamage is set to yes / aim...
    return 233;
//   if(what.classname == "monster_wizard") // green shit for scrags?  But scrag gibs are red...
    return 57;
   
   return 73;  // Default blood color
};
/*
================
SpawnBlood
================
*/
void(vector org, vector vel, float damage, entity what) SpawnBlood =
{
   particle (org, vel*0.1, CheckBloodType(what), damage*2);
};

/*
================
spawn_touchblood
================
*/
void(float damage, entity what) spawn_touchblood =
{
   local vector   vel;

   vel = wall_velocity () * 0.2;
   SpawnBlood (self.origin + vel*0.01, vel, damage, what);
};


Note that if you use the above, you'll need to add the entity pointer for everything that uses them, most of which should be in weapons.qc and one or two in enforcer.qc
User avatar
Dr. Shadowborg
InsideQC Staff
 
Posts: 1119
Joined: Sat Oct 16, 2004 3:34 pm

Re: The quick brown dog jumped over the lazy corpse...

Postby frag.machine » Mon Jul 01, 2019 11:01 am

Thanks Madfox and DoctorShadowborg. I should have added that I already didi exactly this change, down to the exact same color index and it works, but visually is not the same as for red blood which is a bit jarring. I had hope that FTEQW could have a trick under the sleeve like a shader or something.

As for SOLID_CORPSE I already change the origin entity to SOLID_BBOX before traceline during attacks and switch back to the old value after, as Spike instructed on fteextensions.qc. But then there is the jump for dog and fiend to fix, and I was hoping for a best direction tip...
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2118
Joined: Sat Nov 25, 2006 1:49 pm

Re: The quick brown dog jumped over the lazy corpse...

Postby Spike » Tue Jul 02, 2019 9:51 pm

try .hitcontentsmaski if you want to be explicit about the types of volumes with which an entity can collide with, be that regular solids, playerclip, monsterclip, bodies (read: normal bbox ents), or corpses.
Spike
 
Posts: 2908
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: The quick brown dog jumped over the lazy corpse...

Postby Dr. Shadowborg » Sat Jul 06, 2019 9:55 pm

Spike wrote:try .hitcontentsmaski if you want to be explicit about the types of volumes with which an entity can collide with, be that regular solids, playerclip, monsterclip, bodies (read: normal bbox ents), or corpses.


Just as a follow up, it seems like there's something odd going on here with SOLID_CORPSE. According to fteextensions.qc SOLID_CORPSE is non-solid to SOLID_SLIDEBOX and SOLID_CORPSE, however that doesn't entirely seem to be the case. One example is skill 2 e1m1, kill the grunt on the beginning elevator, then activate the elevator and stand over the corpse as the elevator moves down, it will sometimes get stuck in the air. O_o

Also, monsters are incapable of walking or flying over corpses it would seem (like hitting a brick wall, which is weird in the case of monsters mid-jump; No walkmove / movetogoal can be blamed here), if dogs (and presumably, fiends) somehow manage to land on top of a corpse, they indeed to get stuck (zero velocity) and do not animate either. They can still attack if you're close enough though. (all dogs tested were SOLID_SLIDEBOX, I set them to SOLID_CORPSE as well as an experiment, same issue.)

.hitcontentsmaski doesn't appear to help either. :neutral:

Best solution right now I can come up with is to just not use SOLID_CORPSE at all, and go with some kind of corpse proximity detection for hitscan (like my old shock rifle did for combos) / projectiles. Or maybe use some invisible SOLID_BSP entity with MOVETYPE_FOLLOW?
User avatar
Dr. Shadowborg
InsideQC Staff
 
Posts: 1119
Joined: Sat Oct 16, 2004 3:34 pm

Re: The quick brown dog jumped over the lazy corpse...

Postby frag.machine » Wed Jul 10, 2019 8:10 pm

Dr. Shadowborg wrote:Also, monsters are incapable of walking or flying over corpses it would seem (like hitting a brick wall, which is weird in the case of monsters mid-jump; No walkmove / movetogoal can be blamed here), if dogs (and presumably, fiends) somehow manage to land on top of a corpse, they indeed to get stuck (zero velocity) and do not animate either. They can still attack if you're close enough though. (all dogs tested were SOLID_SLIDEBOX, I set them to SOLID_CORPSE as well as an experiment, same issue.)


Yup, that's pretty much what I observed. Oh well...

@Spike: I can quickly slap a small test map with a corpse and a dog and upload it to quaketastic, let me know if you need an actual test scenario.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2118
Joined: Sat Nov 25, 2006 1:49 pm


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest