Bay 12 Games Forum

Dwarf Fortress => DF General Discussion => Topic started by: Blomquistador on May 21, 2020, 03:35:56 pm

Title: DF Save File Format
Post by: Blomquistador on May 21, 2020, 03:35:56 pm
I would really like to make external tools for Dwarf Fortress which can parse and gather information from the save file.
Does anybody know if there has been any work in decoding and making sense of the .dat files as of late?
I know that most of the work has gone into mapping in-memory structures for DFHack.

After a bunch of searching these are the only things I could find. (Horribly out of date as well)
http://www.bay12forums.com/smf/index.php?topic=86417.0 (http://www.bay12forums.com/smf/index.php?topic=86417.0)
https://dwarffortresswiki.org/index.php/User:Rick/Save_research (https://dwarffortresswiki.org/index.php/User:Rick/Save_research)

Is it even worth the effort of decoding the save format? Or should we just continue to focus on in-memory manipulation (like DFHack)?

Just a thought. It would be great to be able to process and view information about a world without having to have the world loaded in memory by Dwarf Fortress.
Title: Re: DF Save File Format
Post by: wierd on May 30, 2020, 03:58:11 am
Wasted effort:  The save data changes (sometimes radically!) on each version.  This is why memory manipulation is the better option in most cases.
Title: Re: DF Save File Format
Post by: Warmist on May 30, 2020, 07:15:01 am
I would really like to make external tools for Dwarf Fortress which can parse and gather information from the save file.
Does anybody know if there has been any work in decoding and making sense of the .dat files as of late?
I know that most of the work has gone into mapping in-memory structures for DFHack.

After a bunch of searching these are the only things I could find. (Horribly out of date as well)
http://www.bay12forums.com/smf/index.php?topic=86417.0 (http://www.bay12forums.com/smf/index.php?topic=86417.0)
https://dwarffortresswiki.org/index.php/User:Rick/Save_research (https://dwarffortresswiki.org/index.php/User:Rick/Save_research)

Is it even worth the effort of decoding the save format? Or should we just continue to focus on in-memory manipulation (like DFHack)?

Just a thought. It would be great to be able to process and view information about a world without having to have the world loaded in memory by Dwarf Fortress.

Usually you can find the saving procedure and with info from dfhack (the offsets and layouts of structures) is not that hard to piece it together. However it'll be very sparse. Some from dfhack team are doing the reverse - if something is being saved you can see it's layout better. I've said it "not that hard" but disclaimer - never tried it and probably it's a slog :)
Title: Re: DF Save File Format
Post by: Urlance Woolsbane on May 31, 2020, 07:51:15 pm
Usually you can find the saving procedure and with info from dfhack (the offsets and layouts of structures) is not that hard to piece it together. However it'll be very sparse. Some from dfhack team are doing the reverse - if something is being saved you can see it's layout better. I've said it "not that hard" but disclaimer - never tried it and probably it's a slog :)
It can be tedious, but not especially difficult. DF is, by its nature, a fairly transparent game; .xml dumps, world-gen parameters, and raw files make tracing much of the saved data fairly trivial. I find that names are particularly helpful, since they are usually unique; one need merely know the order in which a given word appears in its language file. Files other than world.dat are a bit trickier, since they don't, as far as I am aware, affect anything in legends mode, and player-site files are yet another kettle of fish, given their inherent complexity.