Valheim

Valheim

 This topic has been pinned, so it's probably important
Munin Jul 7, 2022 @ 3:02am
How To Restore Most Recent Working World Save After Crash
A Guide by MayaOmkara, ported to Steam by Munin.

  • Section 1: General information about saves
  • Section 2: Information about new Steam Cloud saves
  • Section 3: List of all possible save file locations
  • Section 4: What to do if Valheim frequently crashes during saving process
  • Section 5: How to restore most recent working world save

Section 1: General information about saves
When Player selects a new character and defines its name, Valheim creates charactername.fch file, which works as a character save. In that file, Valheim stores Player's character skills, trophies, inventory contents, map, last location in worlds, etc.

When Player selects a new world, and defines its name and seed, Valheim creates worldname.fwl file, which contains information about seed and game version the world was created on. The combination of the seed and game version, tells Valheim how it should populate world with content, when Player launches the world and start exploring.

When Player launches this newly created world based on worldname.fwl file, Valheim creates worldname.db file, which works as a world save. In that file, Valheim stores explored areas, buildings, enemy locations, etc.

Valheim updates world and character saves when:
  • Player closes the game
  • Player logs out
  • Player manually types save command in console
  • Player manually types /save in chat
  • no saves has been initiated for the past 20min during gameplay

At any given moment, Valheim always keeps last 2 world and last 2 character saves: the most recent save, and previous save. Previous (older) saves have additional .old extension at the end of file name.
https://steamcommunity.com/sharedfiles/filedetails/?id=2831715662
Section 2: Information about new Steam Cloud saves
On 20th of June 2022, new saving system has been implemented in Valheim, for purposes of fixing Steam bugs, which often resulted in players losing their saves in cases when they used multiple Steam accounts on same PC.

Characteristics of new Steam Cloud saves:
Pros:
  • Ability to easily transfer saves from one device to another
  • Easier and safer file management when using multiple Steam accounts on same PC

Cons (devs are working on solution):
  • As Player's Steam Cloud world save file gets larger in size, the more they explore and build in that world, the longer they will have to wait for Steam Cloud to upload world save, every time they close Valheim.
  • Saving process for large Steam Cloud world save files causes longer stuttering during world saving compared to saving process for Local saves. Simplified, if Player uses Local saves, during saving process, valheim.exe will simply rename worldname.db to worldname.db.old, and then create new worldname.db file which gets filled with newest data from RAM.
    However, if Player uses Steam Cloud saves, saving process is being done by steam.exe, which due to its security related restrictions, can't simply rename files, rather it has to copy entire contents of one file into another. Check example of stuttering during Cloud saving as opposed to stuttering during Local saving.
  • When playing on Steam Cloud saves, saving times can last longer, if windows starts running background transfers at the same time. This can cause Valheim.exe to be unresponsive for longer period of time while waiting for steam.exe to finish saving. During this unresponsive phase, Player might close the program or cause it to crash by trying to manipulate the window, which usually results in corrupt save file.

Section 3: List of all possible save file locations
  1. Prior to 20th of June 2022, Valheim was storing all saves in Valheim Appdata folder: C:\Users\yourWindowsUser\AppData\LocalLow\IronGate\Valheim. Character saves were being stored in characters subfolder, and world saves were being stored in worlds subfolder. Saves located in this subfolders were being synced with saves on Steam Cloud server, which can be found on this link: https://store.steampowered.com/account/remotestorageapp/?appid=892970. They are still being synced, but they won't interfere with saves described in point 3.
  2. After 20th of June 2022, Valheim stores Local saves in same Valheim Appdata folder: C:\Users\yourWindowsUser\AppData\LocalLow\IronGate\Valheim, but in different subfolders, which are now called characters_local and worlds_local.
  3. After 20th of June 2022, Valheim stores Steam Cloud saves in folder: C:\Program Files (x86)\Steam\userdata\yourSteamIDnumber\892970\remote. Saves located in this folders are synced with saves on Steam Cloud server, which can also be found on this link: https://store.steampowered.com/account/remotestorageapp/?appid=892970, but they won't interfere with saves described in point 1.
  4. If Player used multiple Steam accounts on same PC, they may find some of their older saves in folder: C:\Program Files (x86)\Steam\userdata\yourSteamIDnumber\892970\ac\WinAppDataLocalLow\IronGate\Valheim, because of Steam autocloud feature that moves them for safety reasons, when different Steam account logs in to Steam. Player may have to check multiple SteamIDnumber subfolders to find saves, if they used multiple Steam accounts on same PC.
  5. If Player has System restore enabled, they may extract some of older saves from shadow copies of their volume by using tools such as VSC Toolset. Shadow copies contain save files from all folders mentioned above. Using this example Player can check if System restore created restore points. Using this example Player can find Valheim save using VSC Toolset. By clicking with right mouse button on the save, Player can select copy and then choose the location they want the save files to be copied to.

Section 4: What to do if Valheim frequently crashes during saving process
If you experience frequent Valheim crashes in general, go through this Valheim crash guide. It might help you with troubleshooting and finding the cause of crash.

Until you resolve your crash problems, it is recommended that you move saves from Steam Cloud to Local using GUI in main menu, and that you do manual backups of save files after each play-session, and especially immediately after a crash, and before you launch game. This must be done in order to backup previous saves (.old files). If you don't this, after you launch your world and see something is wrong with it, and you normally close your game, you will overwrite previous saves (.old files) with saves with corrupt world. Devs are working on better solution that will preserve previous saves.

If Valheim becomes unresponsive during saving process, don't alt-tab or try to activate the window. Wait for the saving process to finish. Saving process may last several minutes depending on what Windows is doing in the background, and how much the disk is being used. If you don't wait for the process to finish on its own and you interrupt it, Valheim may crash in the middle of saving process, rendering save unusable.

Section 5: How to restore most recent working world save
Step 1: Prepare empty folders for backups of all Valheim saves

Create a new empty folder on Desktop and name it Valheim backups. Change the View in this folder to Details by clicking this option you see in the picture, so you can see detailed information of files and subfolder in that folder. Then inside of Valheim backups folder you just created, create 6 more subfolders named:
  1. Steam Cloud server backups
  2. Steam Userdata AC backups
  3. Steam Userdata remote backups
  4. Valheim Appdata backups
  5. System restore backups
  6. World save files with largest file size
https://steamcommunity.com/sharedfiles/filedetails/?id=2831715790
Step 2: Backup all Valheim saves to appropriate folders you created in Step 1

  1. Login to your Steam Cloud server located on this link: https://store.steampowered.com/account/remotestorageapp/?appid=892970, download all saves from there. If you use Google Chrome, click with right mouse button on one of those saves at bottom browser bar and select "Show in folder". Copy all of those downloaded saves to Steam Cloud server backups folder you created in Step 1. Check this screenshot for bit more detail.
  2. Manually navigate (don't copy file path) to original Steam Userdata remote folder: C:\Program Files (x86)\Steam\userdata\yourSteamIDnumber\892970\remote and copy the contents of that folder to Steam Userdata remote backups folder you created in Step 1.
  3. Manually navigate (don't copy file path) to original Steam userdata AC backups folder (if it exists): C:\Program Files (x86)\Steam\userdata\yourSteamIDnumber\892970\ac\WinAppDataLocalLow\IronGate\Valheim and copy the contents of that folder to Steam Userdata AC backups folder you created in Step 1.
  4. Manually navigate (don't copy file path) to original Valheim Appdata folder: C:\Users\yourWindowsUser\AppData\LocalLow\IronGate\Valheim and copy the contents of that folder to Valheim Appdata backups folder you created in Step 1.

Example for point 2:
https://steamcommunity.com/sharedfiles/filedetails/?id=2831715992
Step 3: Move both the character and world save (that you plan restoring) from Cloud to Local

Launch Valheim. In main menu, click on "Move to Local" button for Cloud character save you are plan restoring, and click on "Move to Local" button for Cloud world save you plan restoring restoring. If you don't see "Move to Local" button as shown on the picture below, or you see "Move to Cloud" button, you can skip this step because the saves in question are already Local saves or Steam Cloud is disabled. Exit the game when you are done.
https://steamcommunity.com/sharedfiles/filedetails/?id=2831716186
Step 4: Search through the backups you created in Step 2 and find world save file with largest file size

Go through all backup subfolders you created in Step 2 and look for all variations of .db file. Compare all of them with each other and find the world save with largest file size. Save that has the largest file size is the most recent working save you are looking for.

List of all variations of .db file you should be looking for and comparing with one another:
  • worldname.db, worldname.db.old, worldname_backup_date-time.db, worldname_backup_date-time.db.old, %WinAppDataLocalLow%IronGate_Valheim_worlds_worldname.db, %WinAppDataLocalLow%IronGate_Valheim_worlds_worldname.db.old, %WinAppDataLocalLow%IronGate_Valheim_worlds_worldname_backup_date-time.db, %WinAppDataLocalLow%IronGate_Valheim_worlds_worldname_backup_date-time.db.old, worlds_worldname.db, worlds_worldname.db.old, worldname_backup_date-time.db, worldname_backup_date-time.db.old

When you compare all of them and you find that variation of .db world save file, which has largest file size, copy that file to "World save files with largest file size" backup folder you created in Step 2.
https://steamcommunity.com/sharedfiles/filedetails/?id=2831716317
Step 5: Rename the world save file with largest file size to its original name

Rename the world save file with largest file size you copied in previous step to "World save files with largest file size" backup folder. Rename that saves to its original name worldname.db

Few examples:
  • If you have worldname.db.old, rename it to worldname.db
  • If you have worldname_backup_date-time.db, rename it to worldname.db
  • If you have worlds_worldname.db.old, rename it to worldname.db
  • If you have worlds_worldname_backup_date-time.db, rename it to worldname.db
  • If you have %WinAppDataLocalLow%IronGate_Valheim_worlds_worldname.db, rename it to worldname.db
  • If you have %WinAppDataLocalLow%IronGate_Valheim_worlds_worldname_backup_date-time.db, rename it to worldname.db

Step 6: Copy the save you renamed in Step 5 to Valheim Appdata worlds_local folder

Copy the worldname.db from "World save files with largest file size" backup folder to original Valheim Appdata worlds_local folder: C:\Users\yourWindowsUser\AppData\LocalLow\IronGate\Valheim\worlds_local and overwrite existing files there if prompted by windows.

Step 7: Launch Valheim and launch your world to test the save

Step 8: (advanced) Valheim world save file extraction from System restore volume shadow copies

If you had System restore enabled, you may try extracting some of older saves from shadow copies of their volume by using tools such as VSC Toolset, without the need to restore entire system. Shadow copies contain save files from all folders mentioned above. Check this example to see when System restore created volume shadow copies If you want to extract copies of your Valheim saves from those volume shadow copies, check this example of how to use VSC Toolset. When you find older save, click on it with right mouse button, select copy and then choose to move them to System restore backups folder you created in Step 1: C:\Users\yourWindowsUser\Desktop\Valheim backups\System restore backups into appropriate subfolders. Check file size of those saves, and if any of them are bigger than the files size of the save you found in Step 4, located in "World save file that is biggest in size" backup folder, replace them and proceed to Step 5, 6 and 7.
Last edited by Munin; Jul 7, 2022 @ 3:21am