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.

Difference between revisions of "Saved game folder"

From Dwarf Fortress Wiki
Jump to navigation Jump to search
m (→‎Saving: a couple missing words)
(→‎Save folder format: updated for portable mode)
 
(26 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{migrated article}}
+
{{Quality|Superior}}
{{Quality|Unrated}}
 
 
{{av}}
 
{{av}}
[[File:saving_v50_preview.png|thumb|280px|right|"Saving world information" always seems to take the longest time...]]The '''saved game''' files are the files that store a player's progress in ''Dwarf Fortress''. The game can be saved manually or automatically.
+
[[File:saving_v50_preview.png|thumb|280px|right|"Saving world information" always seems to take the longest time...]]The '''saved game folder''' is the location where the files containing the information for each [[world generation|world]] are stored by ''Dwarf Fortress''. Knowledge of the saved game folder is crucial to moving, backing up, or sharing saves. See '''[[Importing and exporting worlds]]''' for sharing world generation parameters and seeds.
 
 
The '''saved game folder''' is the location where the files and information corresponding to each [[world generation|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.  
 
 
 
Any mods that are subscribed to on Steam, and enabled for a world prior to [[world generation|generating]] it will be implemented into the save.
 
 
 
See also: [[Importing and exporting worlds]].
 
  
 
== Saving ==
 
== Saving ==
At any time while you are playing ''Dwarf Fortress'', you can manually save the game with the escape menu options. Press {{key|Esc}} (or click the gear button next to the mini-map) and then select ''Save and return to title menu'' or ''Save and continue playing''.
+
'''Warning''':  Make sure there is sufficient free drive space before saving in ''Dwarf Fortress''!{{bug|2587}} Save folders can be large, ranging from just a few megabytes for small worlds with short histories, to several hundred megabytes for large worlds with many events, and even a gigabyte or two is possible in extreme cases. Also, in some cases, like [[world generation]], ''Dwarf Fortress'' needs twice as much drive space for the save, since it first saves to the <code>current</code> folder, then copies that to the actual save folder. If it runs out of hard drive space while saving, ''Dwarf Fortress'' will act as if it saved correctly, but the save will be corrupted. Opening other saves to verify that they still work, then saving and exiting, will then corrupt that previously-working save as well.
 
 
There is also an auto-save feature, which will periodically (1, 2, or 4 times per year) save the game. To enable '''auto-save''' and control its behavior, see: [[Settings#Game|Game Settings]].  
 
  
When loading a save the game displays the name of the fortress and its translation, what type of save it is (Active, Manual, or Autosave), the date in game, and the folder name.
+
At any time while playing ''Dwarf Fortress'', you can manually save the game with {{Menu icon|Esc}} then selecting ''Save and return to title menu'' or ''Save and continue playing''. If the game asks for a name for the timeline or folder, type the name you want, then press {{k|Enter}} when done. There is also an autosave feature, which will periodically (1, 2, or 4 times per year) save the game. To toggle '''autosave''' and control its behavior, see [[Settings#Autosaves|game settings]].
  
The ''Retire the fortress (for the time being)'' and ''Abandon the fortress to ruin'' options also save the game, but the world will now be available to start a new game in, either with a new fortress, by unretiring a previous player fortress, or [[reclaim]]ing a ruin.
+
The ''Retire the fortress (for the time being)'', ''Retire at this location (or rest a while)'', ''Abandon the fortress to ruin'', ''Give in to starvation'', ''Succumb to the invasion'', etc, options also save the world, but end the game mode, and the world will now be available to start a new game mode in.
 
 
If the game asks for a name for the timeline or folder, type the name, then press {{k|Enter}} when done to save.
 
  
 
=== Save and return to title menu ===
 
=== Save and return to title menu ===
Line 36: Line 25:
 
[[File:Folder-orange.svg|20px|link=]] save
 
[[File:Folder-orange.svg|20px|link=]] save
 
<br>&emsp;[[File:Folder.svg|20px|link=]] current
 
<br>&emsp;[[File:Folder.svg|20px|link=]] current
<br>&emsp;[[File:Folder.svg|20px|link=]] region#  
+
<br>&emsp;[[File:Folder.svg|20px|link=]] region#
 
<br>&emsp;[[File:Folder.svg|20px|link=]] region#-year-month-day
 
<br>&emsp;[[File:Folder.svg|20px|link=]] region#-year-month-day
 
|}
 
|}
  
Your saved games are located in your <code>[[Game folder|<Dwarf Fortress>]]\save\</code> folder. The save folder will contain one or more sub-folders, each one holding one of your worlds, and a "current" folder. The "current" folder is used to track the changes to the active world while ''Dwarf Fortress'' is running; it is not important unless ''Dwarf Fortress'' is open, and can safely be deleted otherwise.
+
The location of the <code>save</code> folder depends on the [[Settings#Portable_mode|portable mode setting]], and contains one or more sub-folders, each one holding one of your worlds, and a <code>current</code> folder which is used to track the changes to the active world while ''Dwarf Fortress'' is running; it is not important unless ''Dwarf Fortress'' is open, and can safely be deleted otherwise.
  
By default, individual worlds 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). If using auto-backup, then 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.)
+
By default, individual worlds are saved with the folder name <code>region#</code>, where # is a number, starting with <code>region1</code> and then incrementing; however, world folders can be renamed without consequence '''if the game is not running''' (this will not change the actual name of the world). Autosave folders will be named starting with <code>autosave 1</code> and then incrementing.{{verify|does it only keep 2 autosave folders, alternating between?}} (''Region'' is also a term used for areas in worlds, thus is only used when referring to the folder name to avoid confusion.)
  
This can become confusing if you frequently [[cheating|savescum]]<abbr id="info" class="information" title="To reload the last saved game whenever the player character dies or an unfavorable outcome has been encountered."><sup>‡</sup></abbr>. 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!
+
''Dwarf Fortress'' shows the name of save folders when listing saves. There is no way to rename these folders in 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!
  
 
=== Contents ===
 
=== Contents ===
 
The saved game folder will usually have these contents:
 
The saved game folder will usually have these contents:
  
* 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 <code>art_image-#.dat</code>. These store information about art and are necessary for proper functioning.
* A series of files named ''feature-#-#.dat''. These files store information about map features such as [[river]]s, [[cavern]]s, [[magma sea]]s, and [[adamantine|hidden fun stuff]]. These files are only generated for parts of the world you have explored (e.g. by embarking in Fortress mode), but using the Site Finder will tend to generate them for the entire world. Replacing these files will usually cause unwanted effects such as magma seas present on the surface or spires of [[adamantine]] spiraling up into the sky.
+
* A series of files named <code>feature-#-#.dat</code>. These store information about map features such as [[river]]s, [[cavern]]s, [[magma sea]]s, and [[adamantine|hidden fun stuff]]. These are only generated for parts of the world you have explored (e.g. by embarking in Fortress mode), but using the [[site finder]] will generate them for the entire world. Replacing these files will usually cause unwanted effects such as magma seas present on the surface or spires of [[adamantine]] spiraling up into the sky.
* A series of files named ''region_snapshot-#.dat''. These are the historical maps available in [[Legends|Legends mode]].
+
* A series of files named <code>region_snapshot-#.dat</code>. These are the historical maps not currently available in [[Legends|Legends mode]].
* A series of files named ''site-#.dat''. These files store the detailed map data of previously abandoned or retired fortresses.
+
* A series of files named <code>site-#.dat</code>. These store the detailed map data of previously abandoned or retired fortresses.
* A series of files named ''unit-#.dat''. These contain the details of historical creatures which might potentially visit your fortress. Prior to version 0.44.10, modifying or deleting these files would lead to the dreaded "Nemesis Unit Load Failed" crash, but now the game will attempt to gracefully recover from such corruption by regenerating the unit from other available information.
+
* A series of files named <code>unit-#.dat</code>. These contain the details of historical creatures which might potentially visit your fortress.
* 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 beast]]s, [[titan]]s, [[demon]]s, [[night creature]]s, and [[Evil|evil effects]] are stored inside 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.
+
* A large file named <code>world.sav</code> or <code>world.dat</code>, depending on the mode currently active (or the lack thereof). This file stores the world data, and in fortress mode is named <code>world.sav</code> and includes the current fortress data. The custom raws generated for the [[forgotten beast]]s, [[titan]]s, [[demon]]s, [[night creature]]s, and [[Evil|evil effects]] are stored inside this file. Replacing this entire file will almost certainly crash the game.
  
Missing one or more of the aforementioned important files may indicate a problem with the save; this is a very common source of crashes.
+
Missing one or more of these important files may indicate a problem with the save; such save corruption is a source of crashes. While you are free to modify these files, their formats are undocumented and can be fragile, so it is recommended to instead use [[DFHack]] to change the data in memory and then let the game save those changes.
  
For basic backups, though, all you need to keep to is: Always copy the whole folder, not parts of it.
+
DFHack will sometimes add its own files to a save folder, but ''Dwarf Fortress'' ignores these, so there is no reason not to include them in backups or for sharing.
 +
 
 +
For basic backups and sharing, all you need to know is: Always copy the whole folder, not parts of it, and if the world was generated with mods, you may want to include the <code>data\installed_mods\</code> folder also, the location of which also depends on the [[Settings#Portable_mode|portable mode setting]].
  
 
== Manually backing up saves ==
 
== Manually backing up saves ==
 
Toady recommends that you make backups, and always save to a fresh file:
 
Toady recommends that you make backups, and always save to a fresh file:
  
# Copy the relevant region folder in "data/save" to a safe location.
+
# Copy the relevant folder in <code>save</code>, <code>region#</code> or whatever you may have named it, to a safe location.
# When you want to reuse it, copy that region back to "data/save".   
+
# When you want to restore a backup, copy that folder back into <code>save</code>.   
  
Do '''not''' overwrite an old folder, as it might leave residual files.
+
Do '''not''' overwrite an old folder, as it might leave residual files which could corrupt the save - always delete the old folder first.
 +
 
 +
== Automatically back up save files ==
 +
Windows systems: A batch file script can be run to handle copying the save folder from a cloud location like drobox into DF before the game starts, start the game and when it finishes copy the save folder back to the cloud location.
 +
If your interested in the script have a look at it https://onemancoder.wixsite.com/dwarffortress
 +
The script also creates date_time stamped backups of your local game folder to c:\temp\df
 +
as well as computer-name_date_time stamps of your cloud save games
 +
 
 +
(edit the info to make it more user friendly)
  
 
== Restoring saves ==
 
== Restoring saves ==
 
: ''See also: [[Save compatibility]]''
 
: ''See also: [[Save compatibility]]''
  
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.
+
Restoring a save from backup can be confusing; the game saves back to the save you loaded, so if you load a seasonal autosave, the game will save to that folder (e.g. <code>autosave 1</code>) and not to the original folder (<code>region1</code>) where you might expect.{{verify|not confirmed for v50+}} If you want to load an autosave, it is recommended that you copy and rename the folder to indicate that. For instance, using the examples above, copy <code>autosave 1</code> to <code>region1-fix</code> and continue play on that save. Remember to only modify folders while the game is '''not''' running.
  
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).
+
This can cause some panic when you see your <code>region1</code> save is several years earlier than expected, and it might look like you lost all your (fortress/adventer party) work to some bug. However, the "missing" save is going to be in the folder you loaded previously. ''Dwarf Fortress'' shows the save type, in-game year, and folder name of each save on the load screen; the highest year will usually be the most recent save, unless you've previously loaded from earlier save.
 
 
''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}}
 
  
 
==Mods==
 
==Mods==
Line 85: Line 80:
 
When this happens, you have the choice of simply updating the mod, updating ''all'' mods at once, continuing to use the older version of the mod in question without updating, selecting the previous task but not updating ''any'' possibly outdated mods or simply returning to the title screen.
 
When this happens, you have the choice of simply updating the mod, updating ''all'' mods at once, continuing to use the older version of the mod in question without updating, selecting the previous task but not updating ''any'' possibly outdated mods or simply returning to the title screen.
  
==Hints==
+
[[Category:Files]]
On Linux or macOS, you can replace the ''raw'' directory with a symbolic link to ''../../../raw'' if you want to save a few megabytes on every backup. [http://www.bay12forums.com/smf/index.php?topic=145908| Forum thread].
 
 
 
 
[[Category:Modding]]
 
[[Category:Modding]]
 +
[[Category:World]]
 
[[ru:Saved game folder]]
 
[[ru:Saved game folder]]

Latest revision as of 01:05, 23 July 2025

This article is about the current version of DF.
Note that some content may still need to be updated.

"Saving world information" always seems to take the longest time...

The saved game folder is the location where the files containing the information for each world are stored by Dwarf Fortress. Knowledge of the saved game folder is crucial to moving, backing up, or sharing saves. See Importing and exporting worlds for sharing world generation parameters and seeds.

Saving[edit]

Warning: Make sure there is sufficient free drive space before saving in Dwarf Fortress!Bug:2587 Save folders can be large, ranging from just a few megabytes for small worlds with short histories, to several hundred megabytes for large worlds with many events, and even a gigabyte or two is possible in extreme cases. Also, in some cases, like world generation, Dwarf Fortress needs twice as much drive space for the save, since it first saves to the current folder, then copies that to the actual save folder. If it runs out of hard drive space while saving, Dwarf Fortress will act as if it saved correctly, but the save will be corrupted. Opening other saves to verify that they still work, then saving and exiting, will then corrupt that previously-working save as well.

At any time while playing Dwarf Fortress, you can manually save the game with Ui Esc.pngEsc then selecting Save and return to title menu or Save and continue playing. If the game asks for a name for the timeline or folder, type the name you want, then press Enter when done. There is also an autosave feature, which will periodically (1, 2, or 4 times per year) save the game. To toggle autosave and control its behavior, see game settings.

The Retire the fortress (for the time being), Retire at this location (or rest a while), Abandon the fortress to ruin, Give in to starvation, Succumb to the invasion, etc, options also save the world, but end the game mode, and the world will now be available to start a new game mode in.

Save and return to title menu[edit]

This option provides further options, which are also offered after retiring or abandoning:

  • Save to this timeline - this is the normal save option for Dwarf Fortress which replaces the current Active save (any other saves will remain).
  • Save to new timeline - this allows to save without replacing the current Active save, will ask what to name the timeline, and the saves in this timeline will be grouped separately from the previous saves with this save being the Active save of the new group.
  • Save to new folder (same timeline) - this also allows to save without replacing the current save, but will also be grouped together with the previous Active save, and will also be classified as an Active save. This is not recommended since it can be very confusing to both the player and the game.

Since these options are also presented when retiring or abandoning a fortress, choosing to save to a new timeline or folder is useful if you want to both keep the fortress active and check Legends mode.

Save and continue playing[edit]

This option also allows to save without replacing the current save, will ask what to name the save folder, will be classified as a Manual save, and will be grouped together with the existing Active save.

Save folder format[edit]

Folder-orange.svg save
Folder.svg current
Folder.svg region#
Folder.svg region#-year-month-day

The location of the save folder depends on the portable mode setting, and contains one or more sub-folders, each one holding one of your worlds, and a current folder which is used to track the changes to the active world while Dwarf Fortress is running; it is not important unless Dwarf Fortress is open, and can safely be deleted otherwise.

By default, individual worlds are saved with the folder name region#, where # is a number, starting with region1 and then incrementing; however, world folders can be renamed without consequence if the game is not running (this will not change the actual name of the world). Autosave folders will be named starting with autosave 1 and then incrementing.[Verify] (Region is also a term used for areas in worlds, thus is only used when referring to the folder name to avoid confusion.)

Dwarf Fortress shows the name of save folders when listing saves. There is no way to rename these folders in 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!

Contents[edit]

The saved game folder will usually have these contents:

  • A series of files named art_image-#.dat. These store information about art and are necessary for proper functioning.
  • A series of files named feature-#-#.dat. These store information about map features such as rivers, caverns, magma seas, and hidden fun stuff. These are only generated for parts of the world you have explored (e.g. by embarking in Fortress mode), but using the site finder will generate them for the entire world. Replacing these files will usually cause unwanted effects such as magma seas present on the surface or spires of adamantine spiraling up into the sky.
  • A series of files named region_snapshot-#.dat. These are the historical maps not currently available in Legends mode.
  • A series of files named site-#.dat. These store the detailed map data of previously abandoned or retired fortresses.
  • A series of files named unit-#.dat. These contain the details of historical creatures which might potentially visit your fortress.
  • A large file named world.sav or world.dat, depending on the mode currently active (or the lack thereof). This file stores the world data, and in fortress mode is named world.sav and includes the current fortress data. The custom raws generated for the forgotten beasts, titans, demons, night creatures, and evil effects are stored inside this file. Replacing this entire file will almost certainly crash the game.

Missing one or more of these important files may indicate a problem with the save; such save corruption is a source of crashes. While you are free to modify these files, their formats are undocumented and can be fragile, so it is recommended to instead use DFHack to change the data in memory and then let the game save those changes.

DFHack will sometimes add its own files to a save folder, but Dwarf Fortress ignores these, so there is no reason not to include them in backups or for sharing.

For basic backups and sharing, all you need to know is: Always copy the whole folder, not parts of it, and if the world was generated with mods, you may want to include the data\installed_mods\ folder also, the location of which also depends on the portable mode setting.

Manually backing up saves[edit]

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

  1. Copy the relevant folder in save, region# or whatever you may have named it, to a safe location.
  2. When you want to restore a backup, copy that folder back into save.

Do not overwrite an old folder, as it might leave residual files which could corrupt the save - always delete the old folder first.

Automatically back up save files[edit]

Windows systems: A batch file script can be run to handle copying the save folder from a cloud location like drobox into DF before the game starts, start the game and when it finishes copy the save folder back to the cloud location. If your interested in the script have a look at it https://onemancoder.wixsite.com/dwarffortress The script also creates date_time stamped backups of your local game folder to c:\temp\df as well as computer-name_date_time stamps of your cloud save games

(edit the info to make it more user friendly)

Restoring saves[edit]

See also: Save compatibility

Restoring a save from backup can be confusing; the game saves back to the save you loaded, so if you load a seasonal autosave, the game will save to that folder (e.g. autosave 1) and not to the original folder (region1) where you might expect.[Verify] If you want to load an autosave, it is recommended that you copy and rename the folder to indicate that. For instance, using the examples above, copy autosave 1 to region1-fix and continue play on that save. Remember to only modify folders while the game is not running.

This can cause some panic when you see your region1 save is several years earlier than expected, and it might look like you lost all your (fortress/adventer party) work to some bug. However, the "missing" save is going to be in the folder you loaded previously. Dwarf Fortress shows the save type, in-game year, and folder name of each save on the load screen; the highest year will usually be the most recent save, unless you've previously loaded from earlier save.

Mods[edit]

If a world is using a mod that's been updated, and is currently using an older version of that mod, the player will be prompted about this when a save is loading. Causing a message like the following to appear:
Mod version v50 prompt.png

When this happens, you have the choice of simply updating the mod, updating all mods at once, continuing to use the older version of the mod in question without updating, selecting the previous task but not updating any possibly outdated mods or simply returning to the title screen.