Troubleshoot script(?) causing GZDoom to hang

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
necros
Posts: 28
Joined: Mon Dec 30, 2019 10:26 pm

Troubleshoot script(?) causing GZDoom to hang

Post by necros »

I have some very weird stuff going on that I am trying to debug, but the problem is GZDoom just hangs without giving me any feedback on what the problem is...

I have this custom monster based on the Baron of Hell/Hell Knight. The hang *seems* to occur when this monster is involved in combat. If I remove the monster (by just removing the zscript include to the file), I haven't see the hang occur.

Here's the script:
Spoiler:
However, the one time I saw anything out of the ordinary before the game hung, it was this scenario:
There was one of these custom fire barons, a few other random things like a couple of pinkies, a zombie and an arachnotron along with a single arch vile. I had god mode on and was killing some of the monsters and having the archvile resurrect them until finally the archvile died.
I then started killing other monsters but suddenly I heard the gib sound and watched one of the pinkies resurrect. I checked and the archvile's corpse was still there. Another monster resurrected, almost like there was an invisible archvile running around somehow. Then the game hung.

Is it at all possible for the code I posted above to somehow cause this behaviour? I've never seen that kind of thing happen in stock doom, so it's obviously something to do with my mod... I have some other custom code but none of those other things were involved in this scenario.
User avatar
ramon.dexter
Posts: 1562
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Troubleshoot script(?) causing GZDoom to hang

Post by ramon.dexter »

Upload your file. The code for the actors looks okay, so there must be something other that affects performance...
necros
Posts: 28
Joined: Mon Dec 30, 2019 10:26 pm

Re: Troubleshoot script(?) causing GZDoom to hang

Post by necros »

http://shoresofnis.com/temp/doom/ne_tall_hang.pk3
To replicate the issue:
1. Start map 1 (any skill)
2. Turn on god mode (so you don't die)
3. Open the door behind you and shoot; this will alert an archvile and some chaingunners.
4. Let the monsters all come into the large room you start in and they should infight a bit (you don't really have to encourage, there just needs to be some combat going on).
5. Wait. If you wait more than 15-20 seconds, try jumping into the large pit of water and waiting down there.

Note: I didn't include all the textures as those take a lot of space.

edit: More testing seems to indicate it is the Arachnotrons causing this hang. When I remove the archvile and the custom monster, I still get the hang, but when I remove the arachnos, I don't see to trigger the hang... Not sure what I'll try next, but this is certainly interesting...

edit2: I think it might also have something to do with that room you spawn in too. This doesn't seem to happen anywhere else in the map. Either monsters being / pathing in the room or something that happens during combat.
necros
Posts: 28
Joined: Mon Dec 30, 2019 10:26 pm

Re: Troubleshoot script(?) causing GZDoom to hang

Post by necros »

Is there a call stack limit in ZDoom? Like infinite loops in the script engine, would they properly crash the engine or would they just loop forever and lock the game?
necros
Posts: 28
Joined: Mon Dec 30, 2019 10:26 pm

Re: Troubleshoot script(?) causing GZDoom to hang

Post by necros »

Well, I kept messing around, and I've managed to isolate it even further: http://shoresofnis.com/temp/doom/ne_tall_hang.pk3

It is definitely something to do with the room, and further, it seems like it has something to do with the 3d floor in this area as well.
The monster type doesn't seem to have any impact, and I haven't had this hang occur anywhere else in the map.

In the current map I've uploaded, all you need to do to replicate the hang is to shoot to wake up the mancubus and custom monster. the custom monster will usually attack within a few seconds behind the mancubus and then the game hangs.
but it only seems to hang when you stand on the 3d floor (that you start on when loading the map). If you fly over to the main room's floor (where the mancubus and custom monster spawns), the crash doesn't seem to happen, you need to wake up other monsters and have them enter into this room and it's not guaranteed to trigger the hang. But just standing on that 3d floor and waking up the monsters in that room is almost a guaranteed hang.
necros
Posts: 28
Joined: Mon Dec 30, 2019 10:26 pm

Re: Troubleshoot script(?) causing GZDoom to hang

Post by necros »

Not sure if anyone is interested, but I'll post some updates when I find anything new about this weird issue...

I think this actually might be something to do with the level/engine/sectors/etc... as opposed to a script issue but I've spammed this board enough so I'll just leave this post here for now.

Testing more today, I think the issue is related to either traces or projectiles passing through the large room across into the water sectors, in the area where the 3d floors are located.

This is why the custom monster, arachnotrons and mancubus seem to cause this problem more: they tend to fire more projectiles. I somehow managed to replicate the issue myself by first killing the monsters there myself, then firing a LOT of plasma, missiles and shotgun tracers from the north area to the south area then flying over to the 3d floor area. Once I turned north, the game hung. Will continue investigating...

Return to “Scripting”