Save File Corruption in Modified Games When Docked at Outposts

Ask here if you experience technical problems with X³: Terran Conflict, X³: Albion Prelude or X³: Farnham's Legacy.

Moderators: timon37, Moderators for English X Forum

isosphere
Posts: 9
Joined: Fri, 3. May 24, 23:47
x4

Save File Corruption in Modified Games When Docked at Outposts

Post by isosphere » Wed, 15. May 24, 20:31

TL;DR: When playing Mayhem 3: Renegades with a variety of other mods (details below), sometimes a saving the game generates a save file that is invisible to the game - it cannot be loaded. It does however exist on disk.

This problem exists in the Windows version of X3AP run on my fairly modern Desktop and the Linux version run on my ancient laptop; it is hardware and operating system independent.


Edit: This has been patched in the latest Mayhem Renegades patch available at the top of the Renegades thread.


Installation Details

Items that have been shown to not be part of this issue have been edited with NR2R (Not Required To Reproduce). I've kept them in the list to prevent invalidating references made to them later in the thread.
  • Steam X3AP 3.3.0.0 English (bonus package disabled)
  • Modified with the following files deployed in the following order; misc steps are shown in italics:
    1. Renegades 2.50 Installation package
    2. Renegades 3.00 Incremental Release
    3. Renegades Patch
    4. NR2R: ZH Sector backgrounds pack
    5. cleanup.bat executed
    6. X3AP 3.3 nonsteam executable deployed
    7. NR2R: a font replacement that I made myself is deployed at F/Tahoma13.abc and F/Tahoma13.tga
    8. NR2R: CockpitmodNGforLU
    9. NR2R: X3-Colour-By-Race 2.0.1
    10. NR2R: SpaceSuitSurvivalKit_and_EjectorSeat_v1.01_2012-12-15
Reproduction Steps

Some of these steps are probably unnecessary, but until I reproduce with fewer I'll keep it accurate.
  1. Quickstart game (get a mammoth)
  2. Deploy Outpost and Research Station in empty sector
  3. Dock and save at Research Station
  4. Dock and save at Outpost
  5. Order a construction of a new outpost
  6. Assign all provided traders to outpost
  7. Undock
  8. Dock to outpost again, save
  9. Observe that this save file doesn't exist in the save or load menu
Additional Notes

When saving at outposts on your second docking (e: sometimes first), the save file is corrupt and will not show up in X3AP despite the file existing on-disk. No errors are printed to the console by X3AP, the file simply is invisible. When uncompressed and viewed in a hex editor, the field early in the save file that shows the station name has what looks like a lot of superfluous 0x1b 0x57 bytes before it, and a bunch of 0x1b 0x58 characters after it, but this may be a red herring.

Working Solution

The strangeness about the station name prompted me to try renaming the outpost. This does in fact allow you to save a file that is not invisible to the game - but it does not prevent it from happening again. I tried a fresh playthrough where I renamed the outpost before docking and my second save was corrupt. While still docked I renamed the station and I was able to save again. This requires one to always verify that the save file they just saved is visible in the save or load menu after saving, but it does appear to work.

I have not yet tested this solution with a long-running game.

The strange bytes padding the name also appear in a game where the outpost has been renamed, but there seems to be about half as much of it. Again, it might be a red herring, but I wonder if this binary field in the save file has a maximum length that is being exceeded rendering the file corrupt. I have attempted to manually delete all padding but this does not fix a corrupted save file.

Closing Thoughts

I could not find any reference to a similar issue on the forums or on Discord, so I am sharing it here in the hopes that it helps someone else. I'm disappointed that X3AP isn't producing any errors about these corrupt files - they simply don't show up in the save or load menus. Nothing of note is printed to STDOUT or the log files under Egosoft/X3AP. This is almost certainly related to the game being modified, but this lack of feedback makes it challenging to troubleshoot.


---------

New Solution

As suggested by Hairless-Ape, I have re-coloured my outpost via Select Outpost -> Advanced -> Command Console -> Slot x -> Colour Station Name -> Default and it seems to address the problem, I haven't been able to reproduce it. The save file generated does not show the extra padding characters I have mentioned when viewed in a hex editor. I think these hex characters before and after the outpost name are colour escape codes, and I think that my hypothesis that we're accidentally reapplying colour on top of something that is already coloured would explain this behaviour. I believe if all colour is stripped before being applied, we could have our outpost colours and save stability too.
Last edited by isosphere on Sat, 18. May 24, 15:58, edited 9 times in total.

Alan Phipps
Moderator (English)
Moderator (English)
Posts: 30551
Joined: Fri, 16. Apr 04, 19:21
x4

Re: Save File Corruption in Modified Games When Docked at Outposts

Post by Alan Phipps » Wed, 15. May 24, 20:41

I'm no expert, but are you using any unusual characters or font/colour output in your asset or save naming convention - it may be that the game accepts them when input but a script cannot process them. Maybe employed mod no 7 on your list? Just a theory.
A dog has a master; a cat has domestic staff.

isosphere
Posts: 9
Joined: Fri, 3. May 24, 23:47
x4

Re: Save File Corruption in Modified Games When Docked at Outposts

Post by isosphere » Wed, 15. May 24, 20:48

Alan Phipps wrote:
Wed, 15. May 24, 20:41
I'm no expert, but are you using any unusual characters or font/colour output in your asset or save naming convention - it may be that the game accepts them when input but a script cannot process them. Maybe employed mod no 7 on your list? Just a theory.

A worthy idea. I will try without No. 7 and without No. 9 which both have something to do with at least the display of names. I'll edit this post with my findings.

e:

Sadly this does not address the issue. I copied my verified clean install and followed my deployment steps minus 7 and 9 and still encountered save issues after following my procedure. A good idea though, thank you.

Alan Phipps
Moderator (English)
Moderator (English)
Posts: 30551
Joined: Fri, 16. Apr 04, 19:21
x4

Re: Save File Corruption in Modified Games When Docked at Outposts

Post by Alan Phipps » Wed, 15. May 24, 21:20

Thanks - although you disabled/removed the mods, are you quite sure that assets with the name irregularities were not left in the save you loaded - or did you do a fresh gamestart without the mods?
A dog has a master; a cat has domestic staff.

isosphere
Posts: 9
Joined: Fri, 3. May 24, 23:47
x4

Re: Save File Corruption in Modified Games When Docked at Outposts

Post by isosphere » Wed, 15. May 24, 21:57

Alan Phipps wrote:
Wed, 15. May 24, 21:20
Thanks - although you disabled/removed the mods, are you quite sure that assets with the name irregularities were not left in the save you loaded - or did you do a fresh gamestart without the mods?

The above reply was with a save file that may have had irregularities as you describe, but I have just done a fresh clean start and immediately had issues saving when docking to a newly deployed outpost. I think we can confidently rule out those two mods.

e:


I have tried a fresh install with only the renegades files (Step 0, 1, 2) and the non-steam patch (Step 5). I generated a fresh galaxy with ZMap and started a fresh game. Selected a Quickstart, dropped an Outpost and Research station. Did some mundane things like assigning workers (traders). The last thing I did before docking and saving was assign my Mammoth's home base to the new outpost (after - somehow - assigning it as an architect for that outpost). Saved, and that save is corrupt.

Since this is reproducible with only Renegades installed, I've posted in the thread for that mod here. However given that this is an issue with saving/loading that is technical and deep IMO this current thread is a better place for its discussion.

Alan Phipps
Moderator (English)
Moderator (English)
Posts: 30551
Joined: Fri, 16. Apr 04, 19:21
x4

Re: Save File Corruption in Modified Games When Docked at Outposts

Post by Alan Phipps » Thu, 16. May 24, 11:54

Hmm not really, since this forum is for issues with unmodified X3 games and those don't have the issue you are reporting. That mod certainly introduces non-vanilla Outposts. Egosoft will not be changing anything in their X3 games because of it. See how the report in the mod thread in S&M goes. Good luck.
A dog has a master; a cat has domestic staff.

Return to “X³: Terran Conflict / Albion Prelude / Farnham's Legacy - Technical Support”