Achievement file format
This is a technical description of the achievement file format, used by Factorio to store player's achievement progress in the files "achievements.dat" and "achievements-modded.dat".
Yes - this information can be used to "cheat" Factorio by simply writing to the achievement file(s) in such a way as if you had met all the achievement requirements, open up Factorio, and then suddenly have all achievements unlocked. The goal of this document is to share how to read the achievement file(s) - so that third party applications can do new and interesting things with that information. Enjoy!
See the page on data types for an explanation of the different types of data used in this document.
achievements.dat
File Format
The overall file format is as follows. Note that in this file, array length is stored as a short, not an int!
Type | Description |
---|---|
short[4] | The version string of Factorio that generated this file. |
bool | A bool that is always false |
array<bytes> | Achievement header info. Variable length. See the section for more information. |
array<bytes> | Achievement content info. Variable length. See the section for more information. |
short[*] | Currently tracked achievements, given as a series of shorts up until the end of the file, with each representing the index number of an achievement. The order of achievements in this series matches the order of which the player has them tracked in game. Some shorts may have a value of 0, it is unknown currently why, but they don't seem to store meaningful data |
This format has been valid since at least version 1.1.0.
Achievement Header Info
The header contains information about what type of data fields each achievement has.
Type | Description |
---|---|
Space optimized string | Achievement type. This determines what kind of data fields this achievement contains in the content array. |
array<Header Subobject> | An array of achievements that use this achievement type |
Header Subobject
Type | Description |
---|---|
Space optimized string | Achievement string id - the one used internally by Factorio. |
short | Achievement index number. This number is used to map achievements between this header info array, the content info array, and the tracked achievements list in this file. These index numbers are non-normative, so they won't always match up with the same achievement. Note: the mapping of index numbers to achievement ids are continuous, but start at index 1 (there is no index 0) - because Lua tables start at 1. |
Achievement Content Info
This contains the actual data of each achievement. It's important to note that not every achievement listed in the header has a matching content section here.
Also note that this array always ends with an index number of 0. When reading, either ignore this, or manually add in a blank achievement into your meta table at index zero with no fields.
Type | Description |
---|---|
short | Achievement index number. This matches up with the index number in the Achievement header info. |
byte[*] | The achievement's progress information. The structure and length of this is determined by the achievement's type. See the table below for a list of achievement types. |
Achievement Types
If new achievement types are added in the future, the achievement files will be unparse-able. Please add any new types you find here, thanks!
See the AchievementPrototype base prototype page for more information about achievement structure.
Achievement Type |
Binary Fields(s) |
Field(s) Description |
---|---|---|
build-entity-achievement |
|
|
combat-robot-count |
| |
construct-with-robots-achievement |
|
|
deconstruct-with-robots-achievement |
| |
deliver-by-robots-achievement |
|
|
dont-build-entity-achievement |
|
|
dont-craft-manually-achievement |
|
|
dont-use-entity-in-energy-production-achievement | ||
finish-the-game-achievement |
|
|
group-attack-achievement |
|
|
kill-achievement |
| |
player-damaged-achievement |
| |
produce-achievement |
| |
produce-per-hour-achievement |
| |
research-achievement |
|
|
train-path-achievement |
|
"combat-robot-count" is currently the only achievement type that doesn't end in "-achievement". This is not an error.
achievements-modded.dat
File Format
The overall file format is simular to the non modded version but slightly different. Note some arrays here will use an int and others a short for storing their length, assume they use an int unless referred to as short arrays, in which they will use shorts for their length
Type | Description |
---|---|
short[4] | The version string of Factorio that generated this file. |
bool | A bool that is always false |
short array<bytes> | Achievement header info. Variable length. See the section for more information. |
array<bytes> | Achievement Content info. Variable length. See the section for more information. |
short[*] | Currently tracked achievements, given as a series of shorts up until the end of the file, with each representing the index number of an achievement. The order of achievements in this series matches the order of which the player has them tracked in game. Some shorts may have a value of 0, it is unknown currently why, but they don't seem to store meaningful data |
This format has been valid since at least version 1.1.0.
Achievement Header Info
The header contains information about what type of data fields each achievement has.
Type | Description |
---|---|
Space optimized string | Achievement type. This determines what kind of data fields this achievement contains in the content array. |
short array<Header Subobject> | An array of achievements that use this achievement type |
Header Suboject
Type | Description |
---|---|
Space optimized string | Achievement string id - the one used internally by Factorio. |
short | Achievement index number. This number is used to map achievements between this header info array, the content info array, and the tracked achievements list in this file. These index numbers are non-normative, so they won't always match up with the same achievement. Note: the mapping of index numbers to achievement ids are continuous, but start at index 1 (there is no index 0) - because Lua tables start at 1. |
Achievement Content Info
This a object representing achievements, their type and their data
Type | Description |
---|---|
Space optimized string | Achievement Type |
Space optimized string | Achievement string id - the one used internally by Factorio. |
byte[*] | The achievement's progress information. The structure and length of this is determined by the achievement's type. See the table below for a list of achievement types. |
Achievement Types
If new achievement types are added in the future, the achievement files will be unparse-able. Please add any new types you find here, thanks!
See the AchievementPrototype base prototype page for more information about achievement structure.
Achievement Type |
Binary Fields(s) |
Field(s) Description |
---|---|---|
build-entity-achievement |
|
|
combat-robot-count |
| |
construct-with-robots-achievement |
|
|
deconstruct-with-robots-achievement |
| |
deliver-by-robots-achievement |
|
|
dont-build-entity-achievement |
|
|
dont-craft-manually-achievement |
|
|
dont-use-entity-in-energy-production-achievement | ||
finish-the-game-achievement |
|
|
group-attack-achievement |
|
|
kill-achievement |
| |
player-damaged-achievement |
| |
produce-achievement |
| |
produce-per-hour-achievement |
| |
research-achievement |
|
|
train-path-achievement |
| |
achievement |
|
|
"combat-robot-count" is currently the only achievement type that doesn't end in "-achievement". This is not an error.
Also for some reason, in the 2nd Header the research-achievement type has no data bytes