Format of level.dat and blueprint.dat?

Enhance Your Overall Game-Play.
Mod-Database, Calculators, Cheatsheets, Multiplayer, Scripts, Libs and Other Useful Stuff.
Post Reply
sillyfly
Smart Inserter
Smart Inserter
Posts: 1099
Joined: Sun May 04, 2014 11:29 am
Contact:

Format of level.dat and blueprint.dat?

Post by sillyfly »

Is there any info on the format of the level.dat and blueprint.dat (scenario) files?
I am mostly interested in the format of the chunks and resource layers - as the map editor is very lacking at the moment, and I want to be able to do more advanced stuff with much larger maps than it's currently possible.

So - anybody god any hints? Anyone tried to RE some parts of the files and wants to share their progress?
Maybe the developers would like to chime in and help us out? :D

Thanks!

(Side note: Not sure if this is the correct sub-forum for this, so please move it elsewhere if there is a better one)

Oxyd
Factorio Staff
Factorio Staff
Posts: 1377
Joined: Thu May 07, 2015 8:42 am
Contact:

Re: Format of level.dat and blueprint.dat?

Post by Oxyd »

They are serialised internal data structures. The format is described by the source code – that is the only description of the format that I know of.

Trying to RE the format by hand sounds very painful. So, good luck & have fun.

sillyfly
Smart Inserter
Smart Inserter
Posts: 1099
Joined: Sun May 04, 2014 11:29 am
Contact:

Re: Format of level.dat and blueprint.dat?

Post by sillyfly »

I'll try to :D

Can you just tell me this - are there any checksums in these files, and if so what checksum format you are using? Those specifically can be a real pain to RE.
Also, do you have any objections to me trying to RE and publishing my results? I think it would be nice to have community-made map editors (Minecraft sure has a lot of these!), but I wouldn't want to do this if you guys are against it...
Last edited by sillyfly on Tue Oct 06, 2015 7:41 pm, edited 1 time in total.

Zeblote
Filter Inserter
Filter Inserter
Posts: 972
Joined: Fri Oct 31, 2014 11:55 am
Contact:

Re: Format of level.dat and blueprint.dat?

Post by Zeblote »

You've got factorio.exe and a matching factorio.pdb, reverse engineering the file format wouldn't be all that hard. :D

tamat
Burner Inserter
Burner Inserter
Posts: 11
Joined: Fri Oct 31, 2014 5:21 pm
Contact:

Re: Format of level.dat and blueprint.dat?

Post by tamat »

I was also thinking about making a web visualizer of the maps, so you can inspect from the browser the state of a map, zoomin, add comments, etc, something similar to overviewer for minecraft. The only info I need are the chunks and the codification of the cells. I understand that being a serialization of the memory is not going to be easy, but if I can get just the memory region with the chunks and the size of every chunk from the level.dat I could make a nice render.

Thanks!

asheiduk
Burner Inserter
Burner Inserter
Posts: 11
Joined: Sat Dec 05, 2020 9:46 am
Contact:

Re: Format of level.dat and blueprint.dat?

Post by asheiduk »

I've decoded the blueprint-storage.dat format -- you can see the code here: GitHub: Factorio Blueprint Decoder. The tool transforms the file into a JSON structure of a blueprint-book. The JSON can be encoded into a standard import/export string.

The file format for level.dat seems to use similar datastructures but with much more details. So my code might be a base for digging deeper into level.dat

asdff45
Long Handed Inserter
Long Handed Inserter
Posts: 56
Joined: Sun Aug 07, 2016 1:23 pm
Contact:

Re: Format of level.dat and blueprint.dat?

Post by asdff45 »

The level.dat header is really good reverse engineered, i'm currently working on getting the new fields in 1.1. (no new fields in 1.1)
The project where we read the header: https://github.com/OpenFactorioServerMa ... ave.go#L79

Also a python-script as available, where the old code, that was used is posted: viewtopic.php?f=5&t=8568&p=277892&hilit ... on#p277892

For reading/writing the mod-settings.dat (not tested for 0.18/1.0/1.1): https://github.com/knoxfighter/factorio ... dat.go#L24. I will work on that, when the factorio-server-manager released v1.0.

asheiduk
Burner Inserter
Burner Inserter
Posts: 11
Joined: Sat Dec 05, 2020 9:46 am
Contact:

Re: Format of level.dat and blueprint.dat?

Post by asheiduk »

asdff45 wrote:
Sun Dec 27, 2020 1:52 am
The level.dat header is really good reverse engineered, [...] The project where we read the header: https://github.com/OpenFactorioServerMa ... ave.go#L79
Just to make sure the difference is clear: The linked project (Go) and the linked Python scripts (outdated) only parse a minuscule part of the save file -- the header. On the hand: The "Factorio Blueprint Decoder" can decode the complete blueprints file down to the details of each entity. So -- for example -- the circuit connections and configured circuit conditions of an inserter are parsed.

I suspect that this level of detail can help to better understand the format of level.dat beyond the header.

Post Reply

Return to “Tools”

Who is online

Users browsing this forum: No registered users