HEC - Automatic corpse cleaner for GZDoom

Projects that alter game functions but do not include new maps belong here.
Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.
Post Reply
User avatar
hakrosinteractive
Posts: 69
Joined: Fri Apr 17, 2020 5:28 am
Graphics Processor: nVidia (Modern GZDoom)
Contact:

HEC - Automatic corpse cleaner for GZDoom

Post by hakrosinteractive »



Hi everyone!

I put this little add-on together mainly for my own maps. As a lot of you already know, my maps tend to throw huge numbers of monsters at the player, and I wanted a clean, reliable way to keep performance from tanking when all those corpses start piling up. This system automatically handles dead bodies in the background so you don’t get sudden spikes of lag or dozens of monsters vanishing at the exact same second.

Even though I built it for myself, I’m sharing it so anyone can drop it into their own maps or mods. You can either integrate the code directly into your project or simply load the PK3 alongside your WAD/mod as a standalone add-on. It’s designed with slaughter-style maps (slaughterwads) in mind, but it works perfectly fine on any map with fewer enemies as well.

All of the behaviour is configurable through the Options menu in GZDoom. Just remember that, like other advanced settings, you’ll need to open the “Full Options Menu” in order to see the add-on’s controls. From there you can enable/disable the cleaner or switch between standard and immediate modes without editing any files.

------------------------------

Detailed Information

This add-on implements a background “corpse cleaner” system using ZScript Thinkers. Every time a monster dies, the engine spawns a small helper Thinker attached to that corpse. This Thinker monitors the dead body and decides when and how to remove it according to the current configuration.

All behaviour is controlled by two global CVars:

hakros_enemy_cleaner_enabled – enables or disables the system on the fly.
hakros_enemy_cleaner_mode – switches between Standard and Immediate cleaning modes.

How it works internally

Standard mode: each dead monster gets a random wait time between 30 and 60 seconds before removal. This staggered timing prevents dozens of bodies from disappearing at once, so you get a gradual cleanup and steadier performance.
Immediate mode: the Thinker deletes the corpse as soon as it’s out of sight, without waiting.

While the Thinker is active it constantly checks:

If the corpse has already been destroyed, it stops automatically.
If there are no active players in the map, it removes the corpse immediately.
If the corpse is both out of sight and farther than 8000 map units from the player, it removes it directly.
If the countdown expires but the corpse is still visible, it resets the timer with a new random delay (30–60 s) up to three times (“grace periods” controlled by the retries counter).

After the maximum number of grace periods and once the corpse is finally out of sight, it deletes the corpse and destroys itself.

Using it in your projects

You don’t need to touch the code to configure it: open GZDoom’s Options → Full Options Menu and you’ll see a “Hakros Enemy Cleaner” section where you can enable/disable it or switch modes. If you stay in the default (simple) options menu the controls won’t appear.

You can either integrate the scripts directly into your own PK3/WAD or just load this PK3 alongside your map/mod as a standalone add-on. It’s designed primarily for slaughterwads with huge enemy counts but will work on any map.

Since it’s packaged as a PK3, it’s GZDoom-only and requires at least version 2.4.0 to run.

The addon can be downloaded from the official website:
https://hakros.itch.io/hakros-enemy-cleaner-addon

Hope it helps you keep your maps running smoother—and feel free to tweak or expand it for your own projects!

Greetings and thanks.
User avatar
FGsouL
Posts: 10
Joined: Tue Nov 08, 2022 5:37 am

Re: HEC - Automatic corpse cleaner for GZDoom

Post by FGsouL »

This sounds pretty good for massive and slaughter maps especialy for lower spec PCs. Well done :)
DanaVaughn
Posts: 1
Joined: Fri Sep 26, 2025 3:39 am

Re: HEC - Automatic corpse cleaner for GZDoom

Post by DanaVaughn »

Thanks a lot for sharing this add-on. It looks really useful for keeping performance stable. I’ll definitely try it out soon, and if I run into issues, I’ll ask here.
Last edited by DanaVaughn on Mon Nov 24, 2025 6:29 am, edited 1 time in total.
kylea
Posts: 2
Joined: Tue Sep 30, 2025 4:20 am
Location: pakistan
Contact:

Re: HEC - Automatic corpse cleaner for GZDoom

Post by kylea »

Really clever idea! Automatic corpse cleanup makes gameplay smoother and helps with performance too. It’s small mods like this that really improve the overall experience in GZDoom. Great work!
User avatar
hakrosinteractive
Posts: 69
Joined: Fri Apr 17, 2020 5:28 am
Graphics Processor: nVidia (Modern GZDoom)
Contact:

Re: HEC - Automatic corpse cleaner for GZDoom

Post by hakrosinteractive »

FGsouL wrote: Thu Sep 25, 2025 12:46 pm This sounds pretty good for massive and slaughter maps especialy for lower spec PCs. Well done :)
kylea wrote: Sat Oct 04, 2025 4:42 am Really clever idea! Automatic corpse cleanup makes gameplay smoother and helps with performance too. It’s small mods like this that really improve the overall experience in GZDoom. Great work!
DanaVaughn wrote: Fri Oct 03, 2025 2:20 am Thanks a lot for sharing this add-on. It looks really useful for keeping performance stable. I’ll definitely try it out soon, and if I run into issues, I’ll ask here.
Thanks everyone.
I'm glad you like it.
Post Reply

Return to “Gameplay Mods”