Improved Gibbable Corpses Tutorial, and "Semisolid"

Discuss programming in the QuakeC language.
Seven
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany

Post by Seven »

@ Lightning Hunter

I cannot confirm, that head gibs and body corpses fade away like normal gibs.
I dont know if this is engine dependend. In DarkPlaces they stay forever as they should.


Regarding the body sinks into the floor:
This is an issue in EVERY gibable corpse mod, that exist until today.
The original setzise from Wazat makes them NEVER sink in the floor (at least in DP).
Thats why I was very happy about Wazats new mod.
The only negative thing was the big size (blocking bullets).

I couldnt test Wazats NEW setzise yet. This evening I will do it and tell you my experiences.
If it is really true, that now the body sinks into floors as well, it must have something to do with the new (smaller) setsize code.
In that case we will have to find the correct values as a compromise, where the body doesnt sink, but still have a reasonable height.
This will need finetuning then.


Regarding the "body hopping":
It does not exist in DP as well.
So either it is an engine issue or you put the call after the wrong animation sequenz Lightning Hunter ?


Thank you all for your great teamwork. That is the spirit from inside3D, that I love. :)

Kind regards,
Seven
Lightning Hunter
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Post by Lightning Hunter »

Seven, I just now tested this mod on Glquake.exe, and obtained these same bugs. As far as I'm concerned, this means the bugs will happen on every engine except darkplaces. As great as Darkplaces is, many of us do not use it. I double checked the placement of the animation sequence, and it's identical to your version. Something else is causing the animation bug...
Lightning Hunter
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Post by Lightning Hunter »

Hey Seven, would you be able to do me a favor and download the version I have compiled here, and see if those bugs are there for you? I'm just curious if our versions are different at all.

http://filebeam.com/f49b8a0b5ba9d5eb3b04ade73dbca1d2

Oh, and enjoy the new Wyvern Monster in the mod. :o
Seven
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany

Post by Seven »

Hello Lightning Hunter,

dont understand me wrong.
I dont say: DP is best, forget the rest.
Unfortunately I can only give Wazat feedback regarding DP behaviour,
because I use this engine for Quake.
I am fully aware, that many other amazing engines exist.
There is no doubt about that. Every engine has its pros and cons.
Directly related to your personal liking.

A mod must be able to be used for ALL engines if possible. I think we all agree on that. :)


I will use and test your mod this evening. Thank you for sharing.
In return, please do the same with my mod compilation (availabe at quakeone.com).
Unfortunately it can only be used with DP, due to dpextensions.qc usage.
But I am sure, that you have somewhere on your harddisc (maybe on a hidden partition) a DP installation.
Then we both know if we made a mistake ourselves during QC editing, or if it is really engine depending behaviour.


This will help Wazat in ironing out small issues in his mod.


Thank you for your understanding.
Seven
Seven
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany

Post by Seven »

Hello Wazat, Lightning Hunter

I made some very interesting findings / experience:

1.) The "body hopping"
I noticed something like this very seldom. Lets say 1 out of 10 kills.
It is more like a very short blinking of the corpse (1 time off and on). Almost not noticable in my eyes. Even less when in a fight.
For me really no problem.

2.) New setsize code
Wazat´s new code works perfect. No more bullet/nail/rocket hitting the corpse by mistake.
I played especially on maps with slopes or stairs (like Lightning Hunter described) to see if the body will sink into the floor. But could never find it.
So it works very good for me.

3.) Body and head gib disappearing
This is the most important finding !
You can kill 4 monsters and wait for as long as you want. The body or head gib will never disappear.
BUT: If you kill the 5th monster, the 1st of the 4 already killed will disappear.
This is absolutely reproducable.
Only 4 bodies OR head gibs can be there at once.
As soon as the 5th monster is killed, the first of the 4 will vanish.
That is VERY interesting.

The normal gibs work as usual: After 20 or 30 seconds they vanish as they should.

I bet, that this behaviour of max. 4 killed monster differes from engine to engine.
So most likely Lightning Hunter will have different experience with Qrack.

This is te last secret, that has to be revealed. ;)



@ Lightning Hunter:
I saw that you also included the kickable gibs in your mod.
But the head gib cannot be kicked in your compilation.
I had a struggle with this issue for quite a long time.
The solution was simple in the end:

Look into my modified void() corpse_die code

Code: Select all

void() corpse_die =
{
sound (self, CHAN_VOICE, "zombie/z_hit.wav", 1, ATTN_NORM);
self.semisolid = "n";
ThrowHead (self.netname, self.health); 
ThrowGib ("progs/gib1.mdl", self.health);
ThrowGib ("progs/gib2.mdl", self.health);
ThrowGib ("progs/gib3.mdl", self.health);

self.takedamage = DAMAGE_NO;
self.th_die = SUB_Null;
};
You have to set self.semisolid = "n" before the corpse become the head gib.
Then you can kick it like the other gibs.


Thank you all for this great Mod !


Kind regards,
Seven
Lightning Hunter
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Post by Lightning Hunter »

Seven wrote: 1.) The "body hopping"
I noticed something like this very seldom. Lets say 1 out of 10 kills.
It is more like a very short blinking of the corpse (1 time off and on). Almost not noticable in my eyes. Even less when in a fight.
For me really no problem.
I see this bug much more often than this, and it's much more visible than what you speak of in GLQuake and Qrack. Darkplaces must have a side effect of making this bug less noticeable, but other engines have more of a problem here. I'd go as far as saying that the issue is too distracting to really use this mod without darkplaces.
2.) New setsize code
Wazat´s new code works perfect. No more bullet/nail/rocket hitting the corpse by mistake.
I played especially on maps with slopes or stairs (like Lightning Hunter described) to see if the body will sink into the floor. But could never find it.
So it works very good for me.
I think I've solved the corpse sinking into the floor issue by simply increasing the height of the corpse from 4 to 17. Apparently, 4 was just a little too thin, I guess.

Edit: I guess I spoke too soon... I just saw an Ogre sink through the floor on E1M2. What causes this, and how can it be fixed? :?

3.) Body and head gib disappearing
This is the most important finding !
You can kill 4 monsters and wait for as long as you want. The body or head gib will never disappear.
BUT: If you kill the 5th monster, the 1st of the 4 already killed will disappear.
This is absolutely reproducable.
Only 4 bodies OR head gibs can be there at once.
As soon as the 5th monster is killed, the first of the 4 will vanish.
That is VERY interesting.
Yes, indeed you are correct! Once more than 4 corpses exist, the first of them will disappear. This means there is a limit of 4 somewhere in the code.
@ Lightning Hunter:
I saw that you also included the kickable gibs in your mod.
But the head gib cannot be kicked in your compilation.
I had a struggle with this issue for quite a long time.
The solution was simple in the end:

Look into my modified void() corpse_die code

Code: Select all

void() corpse_die =
{
sound (self, CHAN_VOICE, "zombie/z_hit.wav", 1, ATTN_NORM);
self.semisolid = "n";
ThrowHead (self.netname, self.health); 
ThrowGib ("progs/gib1.mdl", self.health);
ThrowGib ("progs/gib2.mdl", self.health);
ThrowGib ("progs/gib3.mdl", self.health);

self.takedamage = DAMAGE_NO;
self.th_die = SUB_Null;
};
You have to set self.semisolid = "n" before the corpse become the head gib.
Then you can kick it like the other gibs.
I actually didn't really mess around with kickable gibs yet, but thanks for this information. I'll go ahead and get the kickable gibs working. Actually, come to think of it, how DO you even kick the gibs? By just walking into them?
Seven
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany

Post by Seven »

Hello Lightning Hunter,

regarding kickable gibs:
It is offtopic here, so I will make it short.
Feel free to contact me at quakeone.com for a more detailed discussion.

As a base I took Ivana Gibson´s mod.
This one has 2 serious issues (described in my mod thread at quakeone.com), that I had to remove.

Yes, you simply walk towards the gibs and automatically move them.


EDITED:
Regardind your issue with corpses "fall" through the floor (which I dont encounter in DP):
Due to the fact, that this is a setsize issue, please try playing with slightly different limit values.
Example:
instead of: min_z = ent.mins_z;
try this: min_z = ent.mins_z + 0.3;


Kind regards,
Seven
Lightning Hunter
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Post by Lightning Hunter »

Wait, I figured out why they fall through the floors! It happens if you are standing inside the body before the death animations finish. Try killing an ogre close up, and quickly stand inside the ogre before the death animation completes. The Ogre will fall through the floor 100% of the time, at least in Qrack and GLquake.
Seven
Posts: 301
Joined: Sat Oct 06, 2007 8:49 pm
Location: Germany

Post by Seven »

Thats why it could also happen if a monster dies and a nearby monster walks into him during death animation. Right ?

I tried to simulate it in DarkPlaces but could not. Standing directly in a solder, dog and ogre during their death animation.

Hmmm, its realy a pitty that engines behaves differently in that case.
Lightning Hunter
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Post by Lightning Hunter »

Seven wrote:Thats why it could also happen if a monster dies and a nearby monster walks into him during death animation. Right ?

I tried to simulate it in DarkPlaces but could not. Standing directly in a solder, dog and ogre during their death animation.

Hmmm, its realy a pitty that engines behaves differently in that case.
I haven't confirmed monsters also falling through the floor when other monsters pass through them during the death animation, but it's a fair bet that this is true. It's baffling to me that darkplaces behaves so differently from most other engines. I think most other engines are more closely related to GLQuake than darkplaces is. Usually, when the bug occurs in GLquake (which these bugs do), then it will also occur in 90% of the other engines out there. Darkplaces is really in the minority when it comes to the incredibly different behavior!
ooppee
Posts: 70
Joined: Thu Oct 28, 2010 2:57 am

Post by ooppee »

Just from looking at how the corpse solid applies - it looks like it'd be only the player that causes it.
The corpse becomes non solid when the player is touching it, so that's why it falls through the ground if you're near. Guess decent way to fix it would be for the corpse code to kick in a second (or 2) after it normally does - that'd way the death animation will complete before the corpse becomes non-solid (if the player is touching).
Lardarse
Posts: 266
Joined: Sat Nov 05, 2005 1:58 pm
Location: Bristol, UK

Post by Lardarse »

Seven wrote:3.) Body and head gib disappearing
This is the most important finding !
You can kill 4 monsters and wait for as long as you want. The body or head gib will never disappear.
BUT: If you kill the 5th monster, the 1st of the 4 already killed will disappear.
This is absolutely reproducable.
Only 4 bodies OR head gibs can be there at once.
As soon as the 5th monster is killed, the first of the 4 will vanish.
That is VERY interesting.
It's limited to 4 because the bodyque only has 4 entities. The limit can be increased in world.qc but by the time it's at a reasonable level for most Quake maps these days, you'll have run out of entities along the way.

The bodyque was designed for players in deathmatch, so that's why it has such a short limit. I'm curious why this can't be done using the entity that the monster had instead.
Roaming status: Testing and documentation
Wazat
Posts: 771
Joined: Fri Oct 15, 2004 9:50 pm
Location: Middle 'o the desert, USA

Post by Wazat »

Interesting. I'm not sure what would cause this bodyhopping. Are you doing this tutorial in fresh QC or in a mod? If you're doing it in a mod, try doing a fresh QC implementation and let me know if it still happens.


As for falling through the floor... hmm... Being too thin would have been my first guess. I'll increase the size in the original post since that at least seems to alleviate the problem somewhat.

As for the player being in the body at the time, the player only makes the body non-solid while the player is moving. The body's physics run only while the body is solid. Plus, having a solid of SOLID_NOT only causes it to go through other entities like players and monsters, not walls (in vanilla quake, corpses are always solid_not).

My guess is that being inside another solid object while running its physics makes the corpse stop clipping entirely, allowing it to fall through the floor.


Corpses and heads disappearing after the 4th one:
The bodyque is a linked loop data structure.
a -> b -> c -> d -> a
When all the corpses are used up, it just naturally loops around and starts recycling old corpses. It sounds to me like the linked loop is too small, allowing for too few corpses. Here's the solution:

Open world.qc and replace the InitBodyQue function with this:

void() InitBodyQue =
{
local entity e, prev;
local float numBodies, num;
numBodies = 10; // how many corpses to allow in the world at once

num = 0;
prev = world;
bodyque_head = world;
while(num < numBodies)
{
// Spawn another body
e = spawn();
e.classname = "bodyque";

// If this is the first, set the bodyque_head pointer (start of the list)
if(bodyque_head == world)
bodyque_head = e;
// Link up to previous item to form the linked list
if(prev != world)
e.owner = prev;
// Point prev to the new item
prev = e;

// Track how many we've made so we don't have an infinite loop
num = num + 1;
}

// Now that all corpse entities are created, turn the linked list into a linked loop
bodyque_head.owner = prev;
};

I'll add this as a step in the first post.
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.
Wazat
Posts: 771
Joined: Fri Oct 15, 2004 9:50 pm
Location: Middle 'o the desert, USA

Post by Wazat »

Lardarse wrote:It's limited to 4 because the bodyque only has 4 entities. The limit can be increased in world.qc but by the time it's at a reasonable level for most Quake maps these days, you'll have run out of entities along the way.

The bodyque was designed for players in deathmatch, so that's why it has such a short limit. I'm curious why this can't be done using the entity that the monster had instead.
Hi Lardarse, long time no see.

The reason I'm using the bodyque is because tying monsters into it was a clean solution that kept the tutorial simple. Then players and monsters were both using the same system and there wasn't much code to change all over the place.

It's not the only way to do it, and may not be the best way. Maybe a becomeGibbableCorpse function or something (specifically, called by each monster instead of the bodyque function, and called in the bodyque function for players), but I'd have to review my code and remember my reasons for taking this path.

However, I recently posted a solution to the short bodyque (I was writing the post while you posted yours). Going from 4 corpses to 10 or 15 solves the problem, and +6-11 entities shouldn't be a problem unless the client is incredibly limited in entity count.

I'm considering not using the bodyque, but that will require a rewrite. I'll get back to you guys on this.
When my computer inevitably explodes and kills me, my cat inherits everything I own. He may be the only one capable of continuing my work.
Lightning Hunter
Posts: 169
Joined: Wed Nov 28, 2007 6:15 am

Post by Lightning Hunter »

Wazat wrote:Interesting. I'm not sure what would cause this bodyhopping. Are you doing this tutorial in fresh QC or in a mod? If you're doing it in a mod, try doing a fresh QC implementation and let me know if it still happens.
I've been doing it through a mod, but I just now tried a fresh QC implementation for you. Same bugs still occur. Test this mod in glquake.exe to see what I mean. As far as I'm concerned, we should all be testing this in glquake, since it's the most universal. If you get everything working nicely in glquake, then it should work in all other engines just fine as well. It's not exactly the best idea to be testing in Qrack/darkplaces/other engine, when they all appear so different. Go back to the roots of Quake to make this universal, I say.
As for falling through the floor... hmm... Being too thin would have been my first guess. I'll increase the size in the original post since that at least seems to alleviate the problem somewhat.
Yes, this seems to have fixed the bodies falling through the floor issue, minus the bug in which they still fall through with the player standing in the monster death zone.
My guess is that being inside another solid object while running its physics makes the corpse stop clipping entirely, allowing it to fall through the floor.
Is this fixable?
Corpses and heads disappearing after the 4th one:
The bodyque is a linked loop data structure.
a -> b -> c -> d -> a
When all the corpses are used up, it just naturally loops around and starts recycling old corpses. It sounds to me like the linked loop is too small, allowing for too few corpses. Here's the solution:
Indeed, this is at least a temporary solution to this problem. Should I expect nasty side effects if I increase the body limit to 200 and play on a large map? It would be nice if all the bodies stayed.

I just came across another minor bug, although this one isn't absolutely terrible. If you leave a corpse on an elevator, and it's on the edge near a button, the corpse can interfere with the button. For example: on e1m1, if you frag the soldier on the edge of the first elevator and go down the elevator, the corpse will trigger the button - making the elevator go back up. Like I said, not the worst bug ever, but just thought I'd mention it.
Post Reply