v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

Saved game folder

From Dwarf Fortress Wiki
Revision as of 15:55, 26 December 2021 by Silverwing235 (talk | contribs)
Jump to navigation Jump to search
This article is about the current version of DF.
Note that some content may still need to be updated.

The saved game folder is the location where the files and information corresponding to each world (also referred to by, at least, the game, given the default characterisation of the file names as "regions") are stored and accessed by Dwarf Fortress. Knowledge on the technicalities of the saved game folder is crucial if one wishes to change their computer, make a backup, or wants to share a save with someone else.

See also: Importing and exporting worlds.

Location

Individual worlds are stored in the data/save/ directory in the game folder you Installed your game in. By default, they are saved in the format: region#, where # is a number, starting with region1 and then incrementing; however, world directories can be renamed without consequence if the game is not running (this will not change the actual name of the world).

Note: On a Windows system, if Dwarf Fortress is installed in the 'Program Files' subdirectory, the saved game folder is instead located at "Users\Myname\Appdata\Local\VirtualStore\Program Files\Dwarf Fortress\data\save".

If you have modified your d_init.txt to seasonally backup, then the backup folders will be named region#-year-month-day, for example region1-00202-01-01. (In versions prior to v0.43, the format was region#-season-year (for example region1-Spring-202) instead.)

This can become confusing if you frequently savescum. There is no way to change the name of these folders inside the game, but it is safe to change them using the standard methods of your operating system if the game is not running. However, never alter or delete the folder with the name of the game you're playing while saving from the game, or while that game is running! This can cause fatal flaws many dwarf-seasons later, and is one known cause of the "Nemesis Unit Load Failed" crash error.

Contents

The saved game folder will usually have these contents:

  • A subdirectory, raw, containing the raws directly copied from the time the world was generated.
    • Inside it, is an objects folder containing the contents of the raws. This must be kept, but the contents inside can be modified to an extent.
    • There is also a graphics folder for graphics for creatures.
    • Finally, there may be an interaction examples folder. This, along with any files or folders not present in the aforementioned two folders, can be safely deleted.
  • A series of files named art_image-#.dat. As their name would suggest, these files store information about art and are necessary for proper functioning. Don't replace!
  • A series of files named feature-#-#.dat. The amount of these files is heavily dependent on the size of the world, and they store the information about map features (such as rivers, caverns, magma seas, and spires). Replacing these files will very rarely crash the game, but usually will cause unwanted effects such as magma seas present on the surface. These files do not seem to cause too many crashes when removed, and do not exist in some peculiar worlds.
  • A series of files named region_snapshot-#.dat. These are the historical maps available in Legends mode.
  • A series of files named site-#.dat.
  • A series of files named unit-#.dat. Replacing these has been known to cause the infamous Nemesis Unit Load Failed error. Resolving the aforementioned error, however, involves copying these over from a previous backup of the save. Depending on the size of the world, there could easily be thousands of these files, making it infeasible to send the saved game folder without compressing it all in one file first.
  • Depending on the mode currently active (or the lack thereof), a large file named world.sav or world.dat. In fortress mode, this file is named world.sav and includes the current fortress data, as well as the world data. In a save without a currently active game, this is the main save folder. The custom raws generated for the forgotten beasts, titans, demons, night creatures, and evil effects are stored in this file. Replacing this entire file will almost certainly crash the game; however, replacing certain portions of the raws included may still keep the save folder working.

Missing one or more of the aforementioned important files may indicate a problem with the save; this is a very common source of crashes.

For basic backups, though, all you need to keep to is: Always copy the whole folder, not parts of it.

Backing up saves

Toady recommends that you make backups, and always save to a fresh file:

  1. Copy the relevant region folder in "data/save" to a safe location.
  2. When you want to reuse it, copy that region back to "data/save".

Do not overwrite an old folder, as it might leave residual files.

Although the game has permanent death and you might want to play it in that spirit, the game is also in alpha, can crash, and your world can become corrupted by an error. You can also make use of the auto save features settable in "data/init/d_init.txt". Making backups can save you a lot of grief.

For more info on the autosave and autobackup features, see d_init.txt.

Disappearing saves

Restoring a savegame from backup can be very confusing: The game saves back to the directory you loaded, so if you load a seasonal save, the game will save to that folder (e.g. [region1-01056-01-01]) and not to the original folder ([region1]) where you might expect it.

This can cause some high blood pressure and panic when you see your 'Region X' save is several years older than expected, and it might look like you lost all your (fortress/adv party) work to some bug. The "missing" save is, however, going to be in the directory you loaded previously. Dwarf Fortress lists the in-game year of each save on the right of the load screen; the highest year will generally be the most recent save (unless you've savescummed from earlier saves).

Dwarf Fortress autosaves to the original folder and then copies the save to a backup folder, so you should generally be able to recover from a crash by simply loading the 'main' save folder--it should be as recent as the latest "backup" save. If you want to load a backup savegame, it's recommended that you copy/rename the save to indicate that. For instance, using the examples above, copy [region1-01056-01-01] to [region1-fix] and continue play on that save (creating new backup saves of the form [region1-fix-01056-04-01]). Remember to only modify saves while the game is not running, per the instructions for savescumming above.


Warning: Save folders can be large, ranging from 20 MB for small saves to several hundred megabytes for large saves. If you run out of hard drive space while saving, Dwarf Fortress will pretend to save correctly, but the save will be unloadable. Opening other saves to verify that they still work, then saving and exiting, will corrupt your previously-working saves as well. If you don't want the game to save, just kill the application. Make sure you have sufficient free disk space before launching Dwarf Fortress! Bug:2587

Hints

You can replace the raw directory with a symlink to ../../../raw if you want to save a couple of MBs on every backup. Forum thread.