Made a tool to clean "cache" crash

foxxyfoxfoxxyfox Join Date: 2016-12-28 Member: 225594Members
What is this?
This fixes cache corruption crashes by deleting cache information that your base(s) does NOT occupy.

Why?
I got tired of having to manually clean my cache file so a made a small tool that "cleans" the cache.

What it looks like
xr9nQBR.jpg

Download Here (Subnautica Cache Cleaner v0.11b.rar - 34 KB) ]
Make sure to read the README.txt to see how it works

Heads Up
*This resets nodes so everything that you opened will respawn making the game easier :/
*It's only needed to clean cache if you are crashing
*After cleaning cache
  1. Go into game and load save
  2. Once your loaded in, Save the game
  3. Go back to the main menu
  4. Now you can play

Source Code
Well hopefully someone finds it useful I had fun making this, last time I programmed was about 10 years ago. I created it in Visual Studio 2015 (Visual Basic) :D

If you want to see the (horrendous) source code here you go
SubnauticaCacheCleaner Source Files v0.11.rar - 270 KB

Version History
0.10 - Initial
0.11 - Fixed screenshot update when the account has multiple saves

Comments

  • 0x6A72320x6A7232 US Join Date: 2016-10-06 Member: 222906Members
    edited December 2016
    So, for the next version, can you make it clear the entire cache, and then just re-terraform the base, so we can have those batches cleared too? xD ( j/k, although that would be amazing -- but terraforming is on the way out, so hopefully we won't have to do this much longer).

    EDIT: x-posted that to Bug Reporting for you here
  • SwimJimSwimJim Join Date: 2017-01-03 Member: 226000Members
    Worked. winrar backup of savegame folder revealed 2 CRC file errors prior to execution.

    PS Marry me ;)

    PSS This game rox
  • Excorpion2013Excorpion2013 Chile Join Date: 2016-12-29 Member: 225688Members
    This could work for my crash error ? :open_mouth:
    My game crashes on the Grand Reef and 'The guy with a code on the name'
    said that i need to clear my cache
  • 0x6A72320x6A7232 US Join Date: 2016-10-06 Member: 222906Members
    This could work for my crash error ? :open_mouth:
    My game crashes on the Grand Reef and 'The guy with a code on the name'
    said that i need to clear my cache

    Yes, it does the exact same thing, which is why I also linked to this tool in the cache cleaning instructions in case some people would prefer using it.
  • Excorpion2013Excorpion2013 Chile Join Date: 2016-12-29 Member: 225688Members
    @foxxyfox Idk why but the app doesnt work for me, i have a win10 64 bits, i need something else ?

    @0x6A7232 and Foxy too i tried the batch thing, but it doesnt seem to work, i got 3 crashes after the delete of the batches
  • foxxyfoxfoxxyfox Join Date: 2016-12-28 Member: 225594Members
    @foxxyfox Idk why but the app doesnt work for me, i have a win10 64 bits, i need something else ?

    What error do you get when you try to launch it? Most likely you need Visual C++ Redistributable for Visual Studio 2015
  • Excorpion2013Excorpion2013 Chile Join Date: 2016-12-29 Member: 225688Members
    @foxxyfox It doesnt run at all, i open it and then i cant do nothing on it.
  • donvdpdonvdp Netherlands Join Date: 2017-01-03 Member: 226031Members
    Thank you, ill be sure to give it a quick whip when i get home !
  • 0x6A72320x6A7232 US Join Date: 2016-10-06 Member: 222906Members
    @foxxyfox It doesnt run at all, i open it and then i cant do nothing on it.

    Install the redistributable foxxyfox linked.
  • Excorpion2013Excorpion2013 Chile Join Date: 2016-12-29 Member: 225688Members
    @foxxyfox and @0x6A7232
    It says thta i have another version installed, im a programmer if i change the redistribuitable maybe im going to get some troubles or not ??
  • 0x6A72320x6A7232 US Join Date: 2016-10-06 Member: 222906Members
    Create a system restore point (might have to enable that on windows 10 first) and see. If so, roll back.
  • TurielDTurielD Netherlands Join Date: 2017-01-05 Member: 226185Members
    Hey @foxxyfox , going by the info from this thread this thread the issue is just with the wrecks (they seem to load up and multiply every time you get past) so just deleting the wreck cells should be enough to fix it, rather than deleting all cells save your base.

    Could you by any chance make a reverse version of your tool, which only deletes the wreck cells?
    According to the wiki, they have particular coordinates, but that's not cells. I'll see if I can find the cell numbers.

    40-14-400
    366-6-203
    320-40-336
    413-43-310
    320-57-252
    65-25-385
    25-88-615
    320-66-431
    390-120-648
    630-50-60
    432-90-268
    940-198-593
    102-179-860
    701-346-1224
    630-125-752
    1448-332-732
    1083-190-735
    1208-332-390
    284-250-850
    865-430-1420
  • foxxyfoxfoxxyfox Join Date: 2016-12-28 Member: 225594Members
    edited January 2017
    @Excorpion2013, Here's a a download link that has an installer and should work for anyone having problems.

    I personally don't use this because it installs the program in a weird place, for me it installed it in
    C:\Users\Username\AppData\Local\Apps\2.0\BB8HZE4X.5X3\Q70278QH.P5O\subn..tion_8c3c6230bc23abe6_0001.0000_fde2023d8db22575
    

    What I would do is if you are having problems with the first download link is download the installer, install it then uninstall it. This way all the files needed to launch the application are on your system.

    @TurielD, Are those the wreck cells? If so I can have a button that just deletes wreck cells. Wait but what if you have a base right next to a wreck?
  • TurielDTurielD Netherlands Join Date: 2017-01-05 Member: 226185Members
    no, they're teleportation coordinates, and I think those actually do have negative numbers, so I copied them down wrong. Should be able to teleport to them and mark the cell number.

    There's something at 14-18-15, which is very near the spawn zone and likely to be visited (and so progressively worsen) a lot, and deleting just that cell's data solves the problem for most people.
  • Xxcookid123xXXxcookid123xX USA Join Date: 2016-12-05 Member: 224587Members
    0x6A7232 wrote: »
    So, for the next version, can you make it clear the entire cache, and then just re-terraform the base, so we can have those batches cleared too? xD ( j/k, although that would be amazing -- but terraforming is on the way out, so hopefully we won't have to do this much longer).

    EDIT: x-posted that to Bug Reporting for you here

    The auto clearing and reterraforming is possible if you learn the insides of the cache files, making the program search each file and looking for modified terrain.
  • donvdpdonvdp Netherlands Join Date: 2017-01-03 Member: 226031Members
    TurielD wrote: »
    Hey @foxxyfox , going by the info from this thread this thread the issue is just with the wrecks (they seem to load up and multiply every time you get past) so just deleting the wreck cells should be enough to fix it, rather than ...

    That would explain why i (at some locations) have to Laser Cut through many doors before gaining entrance. I acutally know a location where this is the case. When i get home i will link the camera area.
  • SwimJimSwimJim Join Date: 2017-01-03 Member: 226000Members
    And why there can be 5 SeaGlide fragments in one container.
  • TurielDTurielD Netherlands Join Date: 2017-01-05 Member: 226185Members
    edited January 2017
    I've stared on the cell list to be cleared:

    Safe Shallows 1: 12-18-10
    Safe Shallows 2: 15-18-11 (tiny, probably can be ignored)
    Kelp 1: 14-18-10 (tiny, probably can be ignored)
    Grassy Plains 1: 14-18-15 (this one is *directly* on the way from the spawn area to the Aurora... very likely to cause issues early on)
    Grassy Plains 2: 8-18-12
    Grassy Plains 3: 10-18-11
    Sea Treader: 5-17-8 and 5-18-8

    Edit 1:
    Blood Kelp: 5-16-10
    Grand Reef 1: 11-17-7
    Grand Reef 2: 7-16-3
  • 0x6A72320x6A7232 US Join Date: 2016-10-06 Member: 222906Members
    TurielD wrote: »
    Grassy Plains 1: 14-18-15 (this one is *directly* on the way from the spawn area to the Aurora... very likely to cause issues early on)

    I'd say you're right, based on this thread on SN Steam forums:
    No Need To Delete all files in CellsCache and CompiledOctreesCache
    I painstakingly went through each files in the CellCache and CompiledOctreesCache by deleting, running the game and restoring the deleted files. Seems there is just one file that's in the center of this lag and crash issue. If you don't want to reset the terrain and resources, just delete this file....

    baked-batch-cells-14-18-15.bin In the CellsCache. In the SavedGames directory.

    The corresponding file in the CompiledOctreesCache directory doesn't seem to be affecting anything but I deleted that anyway just in case.

    Optional delete: compiled-batch-14-18-15.optoctrees

    Let me know how it works at your end because it seems to be a good workaround for me here. And again, doing this doesn't reset the terrain or resources.

  • 0x6A72320x6A7232 US Join Date: 2016-10-06 Member: 222906Members
    edited January 2017
    Also, if it helps any:
    Originally posted by LumpN:
    Originally posted by BoredJedi:
    I painstakingly went through each files in the CellCache and CompiledOctreesCache by deleting, running the game and restoring the deleted files. Seems there is just one file that's in the center of this lag and crash issue. If you don't want to reset the terrain and resources, just delete this file....

    baked-batch-cells-14-18-15.bin In the CellsCache. In the SavedGames directory.

    Thanks for the tip, we'll investigate. By the way, even though we hardly ever reply, we do read the forums all the time and hints like this one are very helpful to us. Please keep in mind that it might take a very long time to find and fix the underlying issue though.

    In the meantime I can provide a little background information about these files.

    The CellsCache folder contains data about all the entities (plants, creatures, loot, etc.) in batches the player has seen. If a player never visits batch 14-18-15 then there won't be a file about it in that saved game.

    The CompiledOctreesCache contains terrain data only. Terrain data almost never causes issues unless one of the files gets corrupted while writing which may result in missing terrain.

    If a saved game runs slow at certain coordinates while a new game runs fine at the same coordinates then there is a fair chance that there is an issue with the CellsCache. The other potential culprits being the batch, global, or scene objects. You don't want to mess with the latter two though, because they contain all your built subs, bases, and items.

    By the way the warp command to go to that batch is "batch 14 18 15". Batch numbers are always positive. The dashes are added to the filename for readability only.

    So as I said, thanks, we'll add this to our long list of issues to investigate, which you can find on our Trello board. https://trello.com/b/eLEWpq3P/subnautica-playtesting

    EDIT again: Asked LumpN what the batch-objects-xx-yy-zz.txt files in the main slot directory did, response:
    Well, they contain batch objects. We don't really use them anymore but they are kept for legacy data.
  • ANGRYABOUTELVESANGRYABOUTELVES WITHIN AND BEYOND ALL THRESHOLDS Join Date: 2015-08-15 Member: 207174Members
    Selecting specific cells to not reset is not necessary anymore as base-building terraforming was removed, but the "Clean Cache" button is greyed out until you select at least one cell to not reset.
  • 0x6A72320x6A7232 US Join Date: 2016-10-06 Member: 222906Members
    @foxxyfox - ▲ can we get a patch?
  • SP_KennySP_Kenny Southpark Join Date: 2017-01-22 Member: 227115Members
    I have SN installed on a different drive then "C"
    After running it the first time and having it save the info I expected it to remember where my SN saved games were - it did not
    If I wanted to manually edit and save the .ini file what should the syntax be? Currently it is blank
  • SP_KennySP_Kenny Southpark Join Date: 2017-01-22 Member: 227115Members
    edited January 2017
    This is from the program output
    16:13:15: Previously saved SubnauticaCacheCleaner.ini loaded
    16:13:15: SubnauticaCacheCleaner.ini not found
    16:13:15: INI created (C:\Users\******\Downloads\subnautica\Subnautica Cache Cleaner v0.11b\Subnautica Cache Cleaner\SubnauticaCacheCleaner.ini)

    For some reason it is creating a new .ini after loading that one that is there and wiping any save data in it
  • HormanHorman Germany Join Date: 2016-03-16 Member: 214292Members
    What about my Cyclops and my other ships?
  • 0x6A72320x6A7232 US Join Date: 2016-10-06 Member: 222906Members
    They won't be touched.
  • mikeloevenmikeloeven Join Date: 2017-04-14 Member: 229623Members
    edited April 2017
    Can you use the full open file dialogue that supports the explorer sidebar that way you can just add the save file to favorites or a library folder and navigate to it in one click. That or just enable the text box so you can paste in a direct link. tree navigation is really outdated and cumbersome especially when you know exactly where the folder is.
  • 0x6A72320x6A7232 US Join Date: 2016-10-06 Member: 222906Members
    You could try using the batch file I made here. Drop a copy of it into whichever SavedGames\slot00xx folder needs cleaning, double-click when necessary. You could easily make a version that recursively cleared every saved game folder in SavedGames as well, just requires a bit more work.
Sign In or Register to comment.