GZDoom loads the wrong map on reload

Thu Jan 20, 2022 11:29 pm

A quirky behavior I've been noticing. To reproduce:

Open a map in UDB, add a resource. hit F9, GZD loads, everything is cool. Make a change to the map, don't save it, hit F9, GZDoom loads with the changed map.
Now make a breaking change to the resource - take a semicolon off the end of a ZScript line or something - and save the resource. Back to UDB, still don't save the map, but hit F9 again. GZDoom comes up and chokes, gives you the option to reload or exit. Leave it open, go back to the resource and unbreak it and save it. Go back to GZDoom window and hit reload. It comes up with the last saved version of the map, not the current one in UDB.

Re: GZDoom loads the wrong map on reload

Thu Jan 20, 2022 11:58 pm

The simple answer is, "Don't load saved games with different versions of the map." At best you're verging into undefined behavior (i.e. you're lucky if it works as intended, but most of the time it'll just be glitchy and broken), at worst GZDoom will flip out and crash on you.

You should really only have your file(s) open in one program at a time, for that matter; never leave the map open in UDB while also editing it in SLADE while also having GZDoom open and running it. This is just asking for data corruption.

Re: GZDoom loads the wrong map on reload

Fri Jan 21, 2022 1:01 am

The file system does not and cannot support live refresh of mounted data. Problems are to be expected if you try.

Re: GZDoom loads the wrong map on reload

Fri Jan 21, 2022 1:34 am

OK, I watched it a little closer this time. It seems that UDB hands a temp file over to GZDoom. That temp file disappears as soon as GZDoom goes to restart. I'm guessing there is some kind of watchdog running that associates that temp file with the GZDoom process, and when GZDoom restarts it pulls a new process id so the watchdog kill the file. That watchdog might be a UDB feature, but I have a feeling it's an FS/OS feature. Either way, not a GZD problem.

Re: GZDoom loads the wrong map on reload

Fri Jan 21, 2022 3:36 am

I think you are correct. When you hit F9, UDB saves whatever state the map is in as a temp file and it's that file that gets loaded for testing. I *think* as soon as you quit, the temp file vanishes and I guess the same thing happens if gzdoom is unable to progress and you get the restart dialogue.

But, like you said, not GZDoom.