View Issue Details

IDProjectCategoryView StatusLast Update
0003591The Dark ModSaving/Loadingpublic14.01.2016 02:01
ReporterSTiFU Assigned Tograyman  
PrioritynormalSeveritynormalReproducibilitysometimes
Status resolvedResolutionfixed 
Product VersionTDM 2.00 
Target VersionTDM 2.04Fixed in VersionTDM 2.04 
Summary0003591: Corrupt savegames possibly due to card playing behaviour
DescriptionIt seems that the spawning and removing of cards in the AI card playing behaviour can lead to corrupt saves. An example savegame for the FM "Lords & Legacy" is attached to this issue. When loading this savegame, TDM says "Game Error: IdPhysics_AF:AddBody: A Body with the name 'IdMoveable_ATDM:Prop_Single_Card_21564656896' already exists"
Additional InformationQuote from grayman: "It sounds like the game was saved between the moment that a single card was spawned in a card-player's hand and the moment when that card was to be removed. This is when the animation picks up a card from the table and places it in the player's card hand.

When the game was restored, that card was restored and somehow that conflicted with the animation's desire to spawn another card."

http://forums.thedarkmod.com/topic/15059-corrupt-quicksaves/page__view__findpost__p__325241
TagsNo tags attached.
Attached Files
Quicksave.save (4,595,980 bytes)
crash.save (4,777,235 bytes)

Relationships

duplicate of 0002955 resolvedgrayman Save during card-playing can corrupt the savegame 

Activities

grayman

grayman

24.12.2015 03:35

viewer   ~0007911

Last edited: 24.12.2015 03:37

What appears to be happening:

1 - A card player's animation runs the frame command that spawns a single card and attaches it to his hand.

2 - The game is saved.

3 - The game is restored.

4 - The card player is restored, but restoring the list of objects attached to him is delayed until those objects are spawned.

5 - The card player runs his animation and ONCE AGAIN spawns a single card and it attaches to his hand.

6 - The restore code (now that objects have all been spawned) wants to restore the list of attached objects, and goes to attach the pre-savegame card to the card player's hand. But the post-restore card is already there. They have the same name because all of this happens in the same frame.

So the solution is to find out why the card player ran the same frame command both BEFORE the savegame and AFTER the restore game.

Alternatively, if an object with the same name is already in the entity's attached list, what's the harm of ignoring the second request to attach the identically-named object?

grayman

grayman

25.12.2015 14:29

viewer   ~0007912

We've only seen this problem with the card players, when the game is saved around the frame when the card player draws a card from his deck. In theory, it could also happen when any objects are spawned by anim frame commands, i.e. the flint used to relight doused lights. The problem occurs because the list of attached objects is saved during a savegame, but during restore the list isn't recreated until after all objects have been spawned (idAFEntity_Base::RestoreAddedEnts()).

But when objects are all spawned, each object is allowed to think and update its animation. For some reason, the card player's animation replays the frame command to get a card and puts that into the attached list. When the delayed list of attached objects is allowed to be re-added to the attached list, the card is already there with the same name, because all of this happens in the same frame. I wasn't able to figure out why the frame command was running twice, but we've had problems with this in the past.

So I'm taking the simple way out, which is to delete the object already in the list and append the new one to the list.
    
Change the error message to a warning.

rev. 6563:

Physics_AF.cpp
grayman

grayman

25.12.2015 14:31

viewer   ~0007913

The second attached savegame is from Behind Closed Doors running on 2.03. It's more useful than the first attached savegame, since that one is so old now.

Issue History

Date Modified Username Field Change
31.10.2013 15:35 STiFU New Issue
31.10.2013 15:35 STiFU File Added: Quicksave.save
31.10.2013 15:36 STiFU Description Updated
31.05.2015 16:53 grayman Target Version => TDM 2.04
22.12.2015 21:04 grayman Assigned To => grayman
22.12.2015 21:04 grayman Status new => assigned
24.12.2015 03:35 grayman Note Added: 0007911
24.12.2015 03:37 grayman Note Edited: 0007911
25.12.2015 14:29 grayman Note Added: 0007912
25.12.2015 14:29 grayman Status assigned => resolved
25.12.2015 14:29 grayman Resolution open => fixed
25.12.2015 14:29 grayman Fixed in Version => TDM 2.04
25.12.2015 14:30 grayman File Added: crash.save
25.12.2015 14:31 grayman Note Added: 0007913
14.01.2016 02:01 grayman Relationship added duplicate of 0002955