XCOM 2
[WOTC] Fix Save Bloat
31 Comments
Nitsah 5 Apr @ 6:53am 
Yeah eventually there stuff that just builds up and it doesn't get cleared.
DaViper 29 Jan @ 9:22pm 
@[BofG]DaBigKahuna
Really not sure what the tactical issue is for you. The ONLY issues over the last couple years (other than the strat bloat + my described 'soft-lock' on initial load) have been maps. Tactical hasn't been issue at all through the last...4 CI campaigns. The last one was the largest mod count I'd done at 501, and no problems...oh wait. MoCX. I'm sooo over that mod. :steamhappy:
[BofG]DaBigKahuna 29 Jan @ 3:03pm 
@Zelfana, thanks for all you have done. This utility is on the right track and I hope you'll crack the CI incompatibility soon.

@DaViper, I noticed the same thing, when you just return to strategic from tactical, your saves are at the smallest. It just goes up from there, until the next tactical mission. The way I was managing save sizes before was to equip the squad on assault missions only, then cancel, switch to infiltration / ops, and immediately deploy without any changes. This keeps the save growth to only 0.5 MBs per CI mission, vs equipping and deploying from ops grows 1.5 MB per mission and infiltration grows 4 - 5 MBs. Sounds weird, but this was my tried and tested method. What eventually ends game for me though is the tactical layer just crashes trying to load. No matter what kind of strategic save management I do, eventually I reach a point where the game crashes switching over to tactical. Usually around FL 13 - 15.
DaViper 28 Jan @ 11:01pm 
part 2
Late game really busy tactical saves can also be large, but I have never seen one past 10meg or so, and have had no issues with tactical save/restores.
-------caveat: this specifically excludes issues with new-mod/maps.

My biggest 'grrrr' with strategic restores is the lag time that happens between selecting the game load on the main screen to the time it takes to get to the cut screen that prefaces the return to the avenger screen.

After the 1/2 way point in a campaign this soft lock gets longer and longer. I'm on a decently speccd box, and I've seen that 'lock' take up to 40 seconds to clear.

This is specific to strat saves. Tactical saves do not exhibit this lag-lock when restoring.

I appreciate the work you're doing with this one.
DaViper 28 Jan @ 10:59pm 
I follow this mod/thread as it does interest me.

I am a dedicated CI player though, and right now just not willing to futz that up. (500 mods + troubleshooting + curating is enough to mess with, heh heh.)

That said, there is a CI trick that works for me. I monitor the save file size when the game auto saves (i don't ironman). When the save file starts to balloon (more than 5-6mb), I do this:

a. I make sure to finish a tactical mission, return to the avenger.

b. Immediately move to the geoscape and then right back to the avenger screen.
This forces a strategic save and it will always be back to 'normal' (2.5-4.5meg for mid to late campaigns).


After that first save, subsequent geoscape to Avenger screens will start that balloon process up again.
Fortunately, this only needs to be done a couple times after the mid-point of the campaign thru the finish.

-part 2 next----->
RakkoHug~<3 28 Jan @ 7:44pm 
Oh, Thank you so much for you information, Kahuna.
Zelfana  [author] 28 Jan @ 2:13pm 
Yeah I tried my best to make Covert Infiltration work correctly with this but it's still very janky because of how CI did those chain things. All chains would break completely without the extra handling I put in. Honestly CI would need an overhaul on that system because it's partly at fault for bloating the saves.

I may look into improving the handling later but I already did all I could at the time and may not be able to do any more so no real promises.
[BofG]DaBigKahuna 28 Jan @ 12:57pm 
Thanks for trying to address save bloat. This mod worked pretty well for a while, dropping saves from 13 mb down to 5 mb. However, I think I found an infrequent bug where infiltration and assault missions get wiped. For example, sometimes, after deployment, the infiltration of rescuing a person or capturing a collaborator gets wiped when using the command. When the infiltration timer hits, the mission doesn't occur and the troops are sent back with a will hit.

The infiltration mission wipe is an annoyance, but the game breaker are assault mission wipes. I used the command during month start to drop the save sizes. But now all my dark event counter missions have their mission wiped, so they never trigger on the map. They are still listed on the pending mission list, but without their actual missions.

I am running odds season 9 collection, so CI is enabled. Please let me know if this is expected behavior for CI + this mod.
Nitsah 5 Jan @ 7:48pm 
Sadly the first time I enter the command it actually increases my file size and doing it again just freezes my game. Using lwotc+ted jam.
RakkoHug~<3 24 Dec, 2024 @ 1:51pm 
Pardon me, is anyone using this mod with covert infiltration?
Just a Nobody 29 Nov, 2024 @ 9:43pm 
I just started experiencing the bloated crashes. Amazing mod! Thank you
Oniwabanshu 22 Nov, 2024 @ 7:40pm 
My game was crashing to desktop when trying to load certain saves and i had no idea it was related to this.
FifiLaFleur 9 Nov, 2024 @ 8:20pm 
I just wanted to thank the developer of this mod for actually addressing the problem in a very practical way. I don't know how no one else could come up with this work-around until now. As a software developer myself, I want to recognize Zelfana for doing the community a great service, and did it with such a practical and pragmatic approach, with relatively small amount of code. Cheers :)
Zelfana  [author] 5 Nov, 2024 @ 4:01pm 
Tactical is likely impossible to fix in this manner. The only real fix there is for mods to submit less GameStates and each mod needs to do that themselves.
airpirata 5 Nov, 2024 @ 2:01pm 
Thanks for the mod, could you make the same mod, but for the tactical part of the game? And it's not the first time I've come across that if a very long mission, then I can't load the late saves, I have to play with the working save until the end of the mission
Mr.Nuke 5 Oct, 2024 @ 7:41pm 
You guys are awesome! Just now reading this. Thanks for shedding much light on this for me. XPanD is def the homie!
LeyShade 1 Oct, 2024 @ 6:28am 
@Zelfana - Thank you for confirming, and please extend thanks to XpanD for confirming the root cause of the issue, as this aligns with our own experiences, and would explain the numerical hard limit.
Zelfana  [author] 1 Oct, 2024 @ 6:18am 
The name lengths issue for save files was confirmed by XpanD on the modding Discord using hundreds of literally empty mods and changing save name and mod name lengths. It doesn't prevent the game from launching and running correctly or even making the save file but when you try to load one of these saves it can't read the data from it due to the data field that contains the list of enabled mods saved to the file being too long.
LeyShade 1 Oct, 2024 @ 6:03am 
@Zelfana - Regarding your response to Mr.Nuke, is that clarified that the hard number can be circumvented by changing the mod and save names, because in our own testing this has made no difference to the hard limit of additional modules that the engine can handle before destabilisation?
LeyShade 1 Oct, 2024 @ 6:01am 
@Fenrira - These extensive load times are mostly caused by use of unnecessary '//' line breaks in configuration files, which produce hidden redscreens as the game has to process them every single time it so much as looks at a file containing them, drastically increasing processing loops which can cause memory leaks and contribute to extraneous save file size.

Zelfana's mod here does a great job of dealing with how that effects some of the strategy lair by essentially mimicing the way the cleanup process works, but the true root to fixing it is simply content creators adhering to a universal, updated set of formatting guidelines to prevent the issue from even occuring.

Do note however that this is a functioning issue stemming from Unreal Engine itself, and updating millions of lines of code across thousands of mods would be practically impossible for most people.
Zelfana  [author] 1 Oct, 2024 @ 5:43am 
@Mr.Nuke

No, that's a separate issue. It is entirely caused by combined mod name and save name lengths becoming too long for the field that data is stored in. The only fix for that is to have less mods, move config only mods to a single local mod, etc.
Mr.Nuke 1 Oct, 2024 @ 1:53am 
This is interesting. I recently tested the limits of mods enable before saves get corrupted. I found that I can load 1337 mods and still save+load but 1292 is the sweet spot as I still had freezes and weird glitches at 1337. The save name decreases the blocks available so I used a single digit name "1" etc. I wonder if your mod has a side effect of allowing more mods to be loaded without corruption? That would be clutch af.
DaViper 29 Sep, 2024 @ 9:04pm 
@Fenrira I can't speak to the Mac (I'm on PChardware with Arch/Proton_GE). IIRC isn't there problems with the AML on mac?

The load times DO increase with save size as the campaign progresses (with larger saves).
It feels like a softlock on the main game menu with up to 30 seconds before hitting the load animation cutscene.

On BROKEN saves (that will CTD) I've seen a load soft lock that lasted 5-7 minutes on my old hardware, and on the newer rig, up to 30 seconds in that 'hung' state before going through.

Close to the campaign completion, even with smaller (3-5meg) saves, I've never seen that take longer than 20-30 seconds...even that is annoying...but ten minutes, I would have done a Parks/n/Rec and tossed the computer in the dumpster. :steamhappy:
Fenrira 29 Sep, 2024 @ 8:56pm 
@DaViper
It’s about 5-10 seconds for newer playthroughs and it gets progressively longer, and the campaigns which run past year 2039 take 10 minutes to load. I play on an MacBook Pro. Any suggestions?
DaViper 29 Sep, 2024 @ 8:32pm 
@Fenrira
On my old rig (FX8300 cpu) RX580 gpu, load times (at their worst) were a minute or two tops WITH a heavy mod load.
The current Ryzen 5 5600x /RX6600 is 15-20 seconds at most. (450 mods running.)
--and I'm running via Arch Linux+ Proton_GE as well.

What sort of potato are you trying to run? Because if it isn't a potato, there be other issues going on.
Zelfana  [author] 29 Sep, 2024 @ 5:05pm 
Won't really do anything about loading times.

I'm recommending doing the two saves just in case the command breaks something. I'm confident enough to publish this but I still can't guarantee it working flawlessly.
Fenrira 29 Sep, 2024 @ 4:58pm 
It usually takes me 10 minutes to load into missions. Would this mod help reduce the time?

Also, after I enter the console command and load the first save, should the loading time be reduced? Or will it still take 10 minutes to load? Also, why is the second save (the save made after the console command is entered) considered the “backup?”
DaViper 29 Sep, 2024 @ 3:49pm 
The odd thing that kept throwing me is that UNDER that 8meg limit, the load time increases, BUT it does succeed to load in.
I KNOW I'm in trouble when the load seems to softlock from the main menu up to 30 seconds BEFORE getting to the load screen banners.
Zelfana  [author] 29 Sep, 2024 @ 3:47pm 
Ah yes, should mention in description this is similar to the strategy/tactical transfer but not exactly.
DaViper 29 Sep, 2024 @ 3:46pm 
As the comments are limited, this is part deux:

I just wanted to thank you for the work you've been doing! Keep it up.:steamhappy:
DaViper 29 Sep, 2024 @ 3:43pm 
I'm on CI as my primary set of mods. (I couldn't go back to vanilla if I tried after using CI.)

I've been wondering about 'bloat on strat saves for quite awhile and have been trying different approaches to keep the problem 'minimal'. On my system, once the save file hits 8meg, it is a 45 second load...crash. (This is applicable ONLY to the strategy layer saves. Tactical can get big and doesn't have an issue on the turns it is saving.)

The solution for me has been finish a tactical mission, return to the avenger, go to the geoscape and then IMMEDIATELY return to the Avenger. For whatever reason, the save goes back to a normal 2-3 meg size (later in the campaign.) --I use the game's default save setup while doing this. (I play honestman as ironman is just asking for heartburn. Heh.)

As the game is doing strategy saves every time you return to the Avenger from the Geoscape, I think it is duplicating stuff behind the scenes. The tactical > geoscape > avenger seems to clear it.