Page 1 of 1

Removing dead monsters after death help

Posted: Tue Jan 04, 2022 7:42 am
by Gunslaher_Pi
Hiya peeps.

So I made a horde mode map but in my ignorance I completely forgot that adding new monsters to an already cluttered cemetery of dead monster actors can....well slow lower performing PC's down.

So I was wondering if I could use A_remove or something to that effect with a tic delay to make dead monsters vanish after death. This would definitely help with slower machines. I.e - mine

Tia!

Re: Removing dead monsters after death help

Posted: Tue Jan 04, 2022 8:01 am
by Logan MTM

Code: Select all

Death.Remove:
TNT1 A 1
Stop
Just what you need is some kinf of check in the regular Death State and Jump to "Death.Remove".

If you want right after die, the last frame should not be -1. Change to something that end with positive Tic and Stop.


#HackyFTW

Re: Removing dead monsters after death help

Posted: Tue Jan 04, 2022 8:10 am
by Gunslaher_Pi
Awesome! Thank you so much! This will be key for when I finish my .wad

Especially since I'll have 4 players running around killing.

Thanks buddy!!!

Re: Removing dead monsters after death help

Posted: Wed Jan 05, 2022 11:16 am
by XASSASSINX
As a small bonus, you can also use A_FadeOut, since it looks smoother. Even better, combine it with something like A_CheckSight to only make the enemy despawn after you lose sight of him, to, you know, not dissapear in sight. Like this:

Code: Select all

  Death:
    SPOS H 5
    SPOS I 5 A_Scream
    SPOS J 5 A_NoBlocking
    SPOS K 5
DeathWait:
    SPOS L 72 A_CheckSight("DeathFade") //Make this check every 3 seconds.
    Loop
DeathFade:
    SPOS L 3 A_FadeOut(0.1)
    Loop
Just as a note, this does make enemies not being able to be ressurected, and i'm not using using a flag would make they revivable, but then it might not reduce lag as much.

Re: Removing dead monsters after death help

Posted: Tue Jan 11, 2022 7:41 am
by Player701
Just for the record, the engine also provides built-in functionality to remove excess corpses which comes from Hexen; see A_QueueCorpse/A_DeQueueCorpse for details. Basically, you need to call A_QueueCorpse somewhere in the death state and A_DeQueueCorpse somewhere in the raise state. It also does not prevent monsters from being able to be resurrected. The maximum number of corpses is controlled via the sv_corpsequeuesize CVAR (default: 64), and can also be made infinite by setting the value to -1.