Jump to content

Save files becoming extremely huge


Koddra

Recommended Posts

So I have been normally playing ksp 2 and I have noticed that the time it took for the game to save my progress was becoming progressively longer. When it took like 3 minutes to save my game I have decided to look into the folder where it saves the game and I have discovered something horrible. The last save had 1.63 GB, yeah GIGABYTES. I have managed to look inside these files and at the bottom (it did not manage to load as a whole so I did not manage to get to the real bottom) I found a lot of text that was repeating itself (I added the image below). I have no idea what causes this, I have no mods installed nor did I change anything with the game. I really need some help because this is making my game completely unplayable. 

You can see the images below (most of the text will be in Czech but it's useless anyways so just ignore it):

Below is the image of the repeating text in the save file

H4g3vR0.png

Below is the first image of the save file folder.

2lWR8Ov.png

Below is the second image of the save file folder.

ARg0ok5.png

 

Link to comment
Share on other sites

I ran into this same issue 2GB+ save file. When trying to load it would stall out on the loading bar and eventually revert to the main menu screen without any UI.

All the duplicates were in the TravelLogData -> ObjectEvents. It was mainly just about 5-10 logs that got duplicated a ridiculous amount. I went through and removed all the duplicates and the save file is now 1.6 KB and loads fine.

Link to comment
Share on other sites

11 hours ago, D4rkFr4g said:

I ran into this same issue 2GB+ save file. When trying to load it would stall out on the loading bar and eventually revert to the main menu screen without any UI.

All the duplicates were in the TravelLogData -> ObjectEvents. It was mainly just about 5-10 logs that got duplicated a ridiculous amount. I went through and removed all the duplicates and the save file is now 1.6 KB and loads fine.

Thank you, I have tried this and it worked. I am not sure if it will help to prevent this in the future tho.

Link to comment
Share on other sites

It happened again. I noticed that the game would stall out for a long period of time and then work fine for a little bit and then stall again. When it starts getting duplicated it happens during the autosave.  Eats up all the available ram trying to write the save. The save file was up to 8GB this time. It's pretty simple to identify the duplicates because they are timestamped the same. If it's not fixed by this weekend and I've got some time I may write a python parser to fix the save files when it happens.

For now if you notice the autosaves getting bigger it's best to stop the game and clean up the saves before relaunching. Otherwise they will just keep growing the autosaves.

Link to comment
Share on other sites

  • 3 weeks later...

Still getting this issue in the latest patch, very similar situation to OP's. Massive duplication of TravelObjectIds blocks, with each event repeating itself thousands of times.

It becomes exponential as the safe file grows to the point that once its over a couple of hundred mb's, the save is unusable:

Here is an except of one of the pieces of data that gets repeated

{
        "TravelObjectIds": [
          "4a1b57f0-56ee-473b-8f5d-950bdc075713",
          "a7d70165-6e64-4ec2-ae53-128f669705e4",
          "7b5c52a5-a2f6-427f-a624-c061dc567253",
          "ffbce690-479a-4b9a-895a-633b629f3fe6",
          "ffbce690-479a-4b9a-895a-633b629f3fe6",
          "ffbce690-479a-4b9a-895a-633b629f3fe6"
        ],
        "EventKey": "vesselSOIEntered",
        "UT": 32885750.697483897,
        "FlightReportArgs": [
          "Jool",
          "Vall"
        ]
      },

 

I believe this growth is happening while creating a new save. Events that would generate an autosave (leaving VAB, entering a new SOI, etc) are all taking a really long time to complete (because the save is huge). Watching the new saves grow confirms this theory. In addition, I also notice an associated spike in RAM usage with the game using over 11gb's at one point just to write a new Save File, before dropping back to a more respectable 5gb while actually playing the game

Link to comment
Share on other sites

I tried this. My save file was 1.6 GB and after deleting duplicate "ObjectEvents" it was down to 3 MB. But, it didn't load properly. It took forever to load, and when it finally did, all my vessels were either invisible or were stationary (they were in space but were apparently at 0 feet and 0 m/s and could not be controlled). Also, when attempting to launch a vehicle from the VAB, it was invisible and not controllable on the launchpad.

Anybody run into that issue and know how to fix?

Link to comment
Share on other sites

Just want to add that this is an issue for me as well. After all of the bugs I've worked around to continue playing and enjoying the game, this one is the straw that broke the camels back. I have a station in Kerbin orbit, three vehicles on the Mun and five Kerbals. If this has brought the game to a standstill, I can't even begin to explore further than the Mun. Hope this gets fixed soon so I can continue to enjoy :0.0:

Link to comment
Share on other sites

On 2/28/2023 at 8:02 AM, D4rkFr4g said:

I ran into this same issue 2GB+ save file. When trying to load it would stall out on the loading bar and eventually revert to the main menu screen without any UI.

All the duplicates were in the TravelLogData -> ObjectEvents. It was mainly just about 5-10 logs that got duplicated a ridiculous amount. I went through and removed all the duplicates and the save file is now 1.6 KB and loads fine.

I had that exact piece of code repeated about two and a half *MILLION* times like, 2.584Gb auto-save files that outright broke the game. Had to erase all the save files, but this isn't an isolated event and has happened three times now in a couple days. Thought it was something up with laptop to be honest but I'm seeing a fair few people reporting the same thing.

Link to comment
Share on other sites

I wrote a save cleaner. Use at your own risk. It removes the TravelLogData -> ObjectEvents like you said. Not sure how to file a bug report but it cuts out like 1GB from a 1.2 GB save lol.

[Download link removed by moderator]

Edited by Snark
Download link removed by moderator
Link to comment
Share on other sites

On 4/1/2023 at 9:38 PM, ericpar said:

I wrote a save cleaner. Use at your own risk.

Thank you for being helpful to the community!  :)

Unfortunately, for various reasons including legal ones, anyone providing executable content (whether it's an in-game mod, or an out-of-game tool/utility) needs to follow the add-on posting rules, which involves giving it its own thread under (in this case) KSP2 Mod Releases, with information about license, link to source code, and so forth.  (yes, we know it's a standalone utility and not an actual "mod" per se, since it doesn't run in-game, but there's no separate forum for utilities, and the same rules apply as with mods)

In short, it's not allowed to just post a link to a thing, like in this post.

Yes, we know it's a hassle, and we're really sorry about that, especially since you didn't do anything wrong and are just trying to be helpful to the community.  Unfortunately, it's one of those areas where the rules are hard and we don't really have any wiggle room, because of issues around licensing and permissions and stuff.

You're welcome to post your link in the forum, but if you do, you need (alas) to jump through the necessary hoops to create a thread for it under Add-on Releases, and then you could link to your thread from here if you like.

Again, we're sorry for the inconvenience.

Link to comment
Share on other sites

  • 2 weeks later...

Many will have noticed that KSP2 game save file sizes will, at a particular point, start to exponentially grow, very quickly, until the game save becomes unplayable.

The following analysis is for a game save that is only post-Patch 2 with no mods.

Here is a chart that shows the growth of my own game save file size (in MB) over time:

image.png

Each save was created when a new ship was created, launched, then docked to a standard space station.

One can see that the game save file remains nominal for a while, with small <1MB increases. This is expected as each save has more and more vessels and other game state. Then, at Game Save 9, it goes from 4MB to 13.5MB, a jump of 9MB, ~15-20 times larger than the previous jumps. Then, Game Save 10 jumps to 70MB, a more concerning jump. Then to 1.6GB. Then to 4.4GB. Then, due to exceeding the capabilities of C#/Mono and/or it's JSON serialization capabilities, the game save reaches a limit at ~4.9GB.

I created a little Node.js CLI to analyse a typical game save that is in the exponential growth phase. This tool focuses on what appears to be the problem:

image.png

Some key observations:
1. The ObjectEvents array within the game save JSON has ~1.7 million entries.
2. The number of unique events is only 33.
3.  There are several events that are duplicated exactly 8192 times, which is a power of 2.
4. Some events are duplicated over a million times.

One of the extremely highly duplicated events is this one:

{
  "TravelObjectIds": [
    "440afbdc-50e4-4841-bfeb-bae414fcb830",
    "e010181f-0614-4698-8034-b2158744f9db",
    "4db9bd4b-ead0-470a-98dd-f4bca6e013a8"
  ],
  "EventKey": "vesselLaunched",
  "UT": 48841.746210548554,
  "FlightReportArgs": [
    "Mun"
  ]
},
Edited by samhuk
Link to comment
Share on other sites

I am having the same problem now.. over 5-10 saves my savefile grew from 200 mb to 1.5 gb. I am trying to see how far i have to go back to get to 200mb file size - Or follow a guide that said to delete all "object events".

Link to comment
Share on other sites

30 minutes ago, ericpar said:

LMK if this is ok. 

You nailed it! :)

Thank you for taking the trouble to do it up "right". I'm sure your fellow KSPers will thank you.

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...
×
×
  • Create New...