Attnam / ivan

Iter Vehemens ad Necem - a continuation of the graphical roguelike by members of http://attnam.com
GNU General Public License v2.0
303 stars 42 forks source link

Sometimes you switch body with the mirror or clone of yourself #445

Open jakwings opened 6 years ago

jakwings commented 6 years ago

I don't know how to trigger the bug. It mostly happens when I go up or down a level — then each turn I either control the mirror/clone or the original body — the save file is then also corrupted. Last time I ascended to the world map and my character appeared in the new land but the mirror appeared above the cave of UT.

AquariusPower commented 6 years ago

this branch is outdated, I will try to update it to the master so you can further merge with your own branches, https://github.com/AquariusPower/ivan/tree/FixDupPlayerAfterCrashOnLoadAutosave I put quite a lot of time on it, and managed to recover some games, that is quite difficult situation to happen indeed and I also dont know how that happens. May be, such code can be reintegrated in separate files (.h and .cpp) as bug workaround, despite solving the problem would be better.

I thought the safe saving (with .bkp and .tmp files) could prevent it. Well seems not all the time :>

AquariusPower commented 6 years ago

here https://github.com/Attnam/ivan/pull/344 it has some usage/help info may be I can reopen that PR as soon I reorganize/isolate that code.

you can upload your test-case to that PR if you like, it may help too.

and manually backup your savegames before trying this fix :)

jakwings commented 6 years ago

I once observed that the slave I bought in the shop "reappeared" in the shop (without any armor) after I came back from the lost tomb. My slaved was still alived (after resurrection ;-). So the NPCs could be duplicated somehow. The Game failed when saving.

I just keep deleting my save files anyway — currently there are two deadly bugs:

  1. This duplicated entities bug.
  2. Mysterious crashes about spawning new monsters.

I hope I have the time and energy to dig into the source code. 😟

AquariusPower commented 6 years ago

reappeared" in the shop (without any armor

this sounds like a respawn, like the entire level was generated again, do you remember if the shop had the items you dropped and not the ones you bought before?

The Game failed when saving

the save happens like this when moving from one dungeon to another:

between these steps are generated .tmp (volatile) and .bkp (persistent til save to menu) files, to workaround critical aborting bugs and system crashes/blackout but they do not interfere with the normal saving, are just an additional security.

I've letting wizard autoplay do frenzied moves, enter/exit dungeons as fast as it want, and caught some bugs in the past :)

as always, a savegame.7z.zip highly compressed is always welcome xD (github only accepts ending with .zip I think and I am behind 100MB/day connection :P )

jakwings commented 6 years ago

reappeared" in the shop (without any armor

this sounds like a respawn, like the entire level was generated again,

do you remember if the shop had the items you dropped and not the ones you bought before?

Yes, the dropped items were still there and the empty tiles were not filled by new stuff.

AquariusPower commented 6 years ago

I guess that you have a save that was made while the friend was still not hired, and you left Attnam. Then you came back and hired him and left again, but... this time saving Attnam failed (crashed may be). When you loaded Attnam later, that was not the updated Attnam but the old one, still having the friend un-hired. There is a probability that this Attnam was recovered from a .bkp file I think.

Entering sumo grounds, it starts unsafe character duplication as I remember, and that code flow could be the other source of the problem.