Thanks to bitfields, e.g. for MSVC sizeof(Blood::XSPRITE) is 80 bytes, for GCC it's 70.Graf Zahl wrote:Makes me wonder why the compiler creates such different results compared to MSVC.
[0.4.2] [Blood] Enemy state is reset on savegame load
Moderator: Raze Developers
Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Re: [0.4.2] [Blood] Enemy state is reset on savegame load
- sinisterseed
- Posts: 1349
- Joined: Tue Nov 05, 2019 6:48 am
- Preferred Pronouns: He/Him
- Graphics Processor: nVidia with Vulkan support
- Contact:
Re: [0.4.2] [Blood] Enemy state is reset on savegame load
Never said it ain't worth investigatingGraf Zahl wrote:This still warrants investigation, if it happens so frequently on Linux. That's a clear sign that the code isn't doing what's to be expected. When it comes to pointer<->integer conversions one has to be careful - some compiler writers seem to treat such things as their playground for unsafe optimizations.
I'll hook up something here and let Manuel test it.
EDIT: done. It now prints some diagnostics when saving and loading. Let's hope this gives us a hint at what's happening here.

- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49230
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: [0.4.2] [Blood] Enemy state is reset on savegame load
The savegame code overall really needs to be redone. Even when writing binary data it cannot be done as blobs, it needs to write out all fields in a defined fashion so that such architectural differences do not affect the result. ZDoom never had such problems because even with its binary format, every single bit of data was written out separately in a machine independent form._mental_ wrote:Thanks to bitfields, e.g. for MSVC sizeof(Blood::XSPRITE) is 80 bytes, for GCC it's 70.Graf Zahl wrote:Makes me wonder why the compiler creates such different results compared to MSVC.
Of course this also means that bitfields are a no-go.
Re: [0.4.2] [Blood] Enemy state is reset on savegame load
Clang 6.0, as included in Ubuntu's 18.04 repositories.Manuel-K wrote:Does Rachael use gcc or clang?
Code: Select all
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
I'll probably upgrade to Clang 9 at some point, but I have to remove something else from the system first.
Re: [0.4.2] [Blood] Enemy state is reset on savegame load
I have a 100% bug trigger rate on Windows 8.1. On Linux my rate is a lot lower.Graf Zahl wrote:(…) if it happens so frequently on Linux.

–––
So all in all I've triggered the bug if the engine was compiled by gcc, by clang and by msvc. I'll call that a huge success.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49230
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: [0.4.2] [Blood] Enemy state is reset on savegame load
I'd still like to see what the debug output says which I added this morning.
Re: [0.4.2] [Blood] Enemy state is reset on savegame load
That's the output with the bug.
Edit: Shouldn't the printf inside the if of UnindexAIState after the assignment to state?
Edit: Shouldn't the printf inside the if of UnindexAIState after the assignment to state?
- Attachments
-
- blood_debug_output.txt
- (38.87 KiB) Downloaded 31 times
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49230
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: [0.4.2] [Blood] Enemy state is reset on savegame load
How precisely do you manage to get it?
Re: [0.4.2] [Blood] Enemy state is reset on savegame load
The bug?Graf Zahl wrote:How precisely do you manage to get it?
Hit a zombie with the pitchfork, wait until it's starting to get up again and save when it's almost standing.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49230
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: [0.4.2] [Blood] Enemy state is reset on savegame load
I think I know what's going on. If you whack the zombie before it fully rises from the grave it never switches to its attacking AI - it stays in its rising-from-the-grave AI, and in that state cannot find any targets. That can be reproduced 100% even without savegames. Of course, if you save after knocking it down it will stay in that phase and aimlessly run around.
In other words: Totally unrelated to the savegame feature, it's a bug from the original game.
In other words: Totally unrelated to the savegame feature, it's a bug from the original game.
Re: [0.4.2] [Blood] Enemy state is reset on savegame load
That seems reasonable and I can confirm it on my end. It seems that I've been too fast during my previous tests.
I'm sorry for causing unnecessary confusion.
I'm sorry for causing unnecessary confusion.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49230
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: [0.4.2] [Blood] Enemy state is reset on savegame load
Don't worry. Finding the cause of that bug was worth it. Now I can investigate how to avoid it.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49230
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: [0.4.2] [Blood] Enemy state is reset on savegame load
The cluelessly running around zombie should be fixed now.
Re: [0.4.2] [Blood] Enemy state is reset on savegame load
This bug has been present since the DOS original. Amazing to see it fixed!