Achievement file format: Difference between revisions
Link to migrated prototype docs |
Update documentation for Factorio 2.x |
||
| Line 1: | Line 1: | ||
This is a technical description of the achievement file format, used by Factorio to store player's achievement progress in the files | This is a technical description of the achievement file format, used by Factorio to store player's achievement progress in the files <code>achievements.dat</code> and <code>achievements-modded.dat</code>. | ||
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. | 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. | ||
See the page on [[data types]] for an explanation of the different types of data used in this document. | See the page on [[data types]] for an explanation of the different types of data used in this document. | ||
= achievements.dat | |||
= Factorio 2.x = | |||
Factorio 2.x uses the same format for both <code>achievements.dat</code> and <code>achievements-modded.dat</code>. | |||
== File Format == | == File Format == | ||
{| class="wikitable" | {| class="wikitable" | ||
| Line 17: | Line 20: | ||
| A bool that is always false | | A bool that is always false | ||
|- | |- | ||
| [[Data_types#array|array]]<[[#Achievement Header Info|bytes]]> | | short [[Data_types#array|array]]<[[#Achievement Header Info|bytes]]> | ||
| [[#Achievement Header Info|Achievement header info]]. Variable length. See the section for more information. | | [[#Achievement Header Info|Achievement header info]]. Variable length. See the section for more information. | ||
|- | |- | ||
| Line 23: | Line 26: | ||
| [[#Achievement Content Info|Achievement content info]]. Variable length. See the section for more information. | | [[#Achievement Content Info|Achievement content info]]. Variable length. See the section for more information. | ||
|- | |- | ||
| [[Data_types#short| | | [[Data_types#short|byte]][*] | ||
| | | Unknown. Probably tracked achievements like in [[#Factorio 1.x]], but this is not confirmed. | ||
|} | |} | ||
This format | This format is valid as of version 2.0.72. | ||
== Achievement Header Info == | == Achievement Header Info == | ||
| Line 38: | Line 41: | ||
| Achievement type. This determines what kind of data fields this achievement contains in the content array. | | Achievement type. This determines what kind of data fields this achievement contains in the content array. | ||
|- | |- | ||
| [[Data_types#array|array]]<Header Subobject> | | short [[Data_types#array|array]]<Header Subobject> | ||
| An array of achievements that use this achievement type | | An array of achievements that use this achievement type. | ||
|} | |} | ||
| Line 45: | Line 48: | ||
{| class="wikitable" | {| class="wikitable" | ||
! Type !! Description | ! Type !! Description | ||
|- | |- | ||
| [[Data_types#Space_Optimized|Space optimized]] [[Data_types#string|string]] | | [[Data_types#Space_Optimized|Space optimized]] [[Data_types#string|string]] | ||
| Achievement string id - the one used internally by Factorio. | | Achievement string id - the one used internally by Factorio. | ||
|- | |- | ||
| [ | | byte[2] | ||
| | | Unknown. Probably an index number like in [[#Factorio 1.x]], but this is not confirmed. | ||
|} | |} | ||
| Line 57: | Line 60: | ||
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. | 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. | ||
{| class="wikitable" | {| class="wikitable" | ||
! Type !! Description | ! Type !! Description | ||
|- | |- | ||
| [[Data_types# | | [[Data_types#Space_Optimized|Space optimized]] [[Data_types#string|string]] | ||
| Achievement | | Achievement type. This determines what kind of data fields this achievement contains in the progress field. | ||
|- | |||
| [[Data_types#Space_Optimized|Space optimized]] [[Data_types#string|string]] | |||
| Achievement id - the one used internally by Factorio. | |||
|- | |- | ||
| byte[*] | | byte[*] | ||
| Line 72: | Line 76: | ||
== 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 | If new achievement types are added in the future, the achievement files will be unparse-able. Please add any new types you find here. | ||
See the [https://lua-api.factorio.com/latest/prototypes/AchievementPrototype.html | See the [https://lua-api.factorio.com/latest/defines.html#defines.prototypes Defines.prototypes] and bas [https://lua-api.factorio.com/latest/prototypes/AchievementPrototype.html AchivementPrototype] documentation for more information about achievement types and data structures. | ||
{| class="wikitable" | {| class="wikitable" | ||
! Achievement<br>Type !! Binary<br>Fields(s) !! Field(s) Description | ! Achievement<br>Type !! Binary<br>Fields(s) !! Field(s) Description | ||
|- | |||
| [https://lua-api.factorio.com/latest/prototypes/AchievementPrototype.html achievement] | |||
| | |||
* byte[0] | |||
| | |||
* Unknown format, 0 bytes long. | |||
|- | |- | ||
| [https://lua-api.factorio.com/latest/prototypes/BuildEntityAchievementPrototype.html build-entity-achievement] | | [https://lua-api.factorio.com/latest/prototypes/BuildEntityAchievementPrototype.html build-entity-achievement] | ||
| Line 85: | Line 95: | ||
| | | | ||
* Unknown format, 4 bytes long. | * Unknown format, 4 bytes long. | ||
|- | |||
| [https://lua-api.factorio.com/latest/prototypes/ChangedSurfaceAchievementPrototype.html change-surface-achievement] | |||
| | |||
* byte[1] | |||
| | |||
* Unknown format, 1 byte long. | |||
|- | |- | ||
| [https://lua-api.factorio.com/latest/prototypes/CombatRobotCountAchievementPrototype.html combat-robot-count] | | [https://lua-api.factorio.com/latest/prototypes/CombatRobotCountAchievementPrototype.html combat-robot-count] | ||
| Line 91: | Line 107: | ||
| | | | ||
* The greatest number of combat robots you've had following you. | * The greatest number of combat robots you've had following you. | ||
|- | |||
| [https://lua-api.factorio.com/latest/prototypes/CompleteObjectiveAchievementPrototype.html complete-objective-achievement] | |||
| | |||
* byte[0] | |||
| | |||
* Unknown format, 0 bytes long. | |||
|- | |- | ||
| [https://lua-api.factorio.com/latest/prototypes/ConstructWithRobotsAchievementPrototype.html construct-with-robots-achievement] | | [https://lua-api.factorio.com/latest/prototypes/ConstructWithRobotsAchievementPrototype.html construct-with-robots-achievement] | ||
| Line 98: | Line 120: | ||
| | | | ||
* Total number of objects constructed using robots. | * Total number of objects constructed using robots. | ||
* Unknown format, 4 bytes long. | |||
|- | |||
| [https://lua-api.factorio.com/latest/prototypes/CreatePlatformAchievementPrototype.html create-platform-achievement] | |||
| | |||
* byte[4] | |||
| | |||
* Unknown format, 4 bytes long. | * Unknown format, 4 bytes long. | ||
|- | |- | ||
| Line 108: | Line 136: | ||
| [https://lua-api.factorio.com/latest/prototypes/DeliverByRobotsAchievementPrototype.html deliver-by-robots-achievement] | | [https://lua-api.factorio.com/latest/prototypes/DeliverByRobotsAchievementPrototype.html deliver-by-robots-achievement] | ||
| | | | ||
* byte[ | * byte[4] | ||
| | |||
* Unknown format, 4 bytes long. | |||
|- | |||
| [https://lua-api.factorio.com/latest/prototypes/DepleteResourceAchievementPrototype.html deplete-resource-achievement] | |||
| | |||
* byte[4] | |||
| | |||
* Unknown format, 4 bytes long. | |||
|- | |||
| [https://lua-api.factorio.com/latest/prototypes/DestroyCliffAchievementPrototype.html destroy-cliff-achievement] | |||
| | |||
* byte[4] | |||
| | | | ||
* Unknown format, | * Unknown format, 4 bytes long. | ||
|- | |- | ||
| [https://lua-api.factorio.com/latest/prototypes/DontBuildEntityAchievementPrototype.html dont-build-entity-achievement] | | [https://lua-api.factorio.com/latest/prototypes/DontBuildEntityAchievementPrototype.html dont-build-entity-achievement] | ||
| | |||
* byte[5] | |||
| | |||
* Unknown format, 5 bytes long. | |||
|- | |||
| [https://lua-api.factorio.com/latest/prototypes/DontCraftManuallyAchievementPrototype.html dont-craft-manually-achievement] | |||
| | | | ||
* byte[4] | * byte[4] | ||
| | | | ||
* | * Unknown format, 4 bytes long. | ||
|- | |||
| [https://lua-api.factorio.com/latest/prototypes/DontKillManuallyAchievementPrototype.html dont-kill-manually-achievement] | |||
| | |||
* ??? | |||
| | |||
* Unknown format, unknown length. | |||
|- | |- | ||
| [https://lua-api.factorio.com/latest/prototypes/ | | [https://lua-api.factorio.com/latest/prototypes/DontResearchBeforeResearchingAchievementPrototype.html dont-research-before-researching-achievement] | ||
| | | | ||
* | * ??? | ||
| | | | ||
* | * Unknown format, unknown length. | ||
|- | |- | ||
| [https://lua-api.factorio.com/latest/prototypes/DontUseEntityInEnergyProductionAchievementPrototype.html dont-use-entity-in-energy-production-achievement] | | [https://lua-api.factorio.com/latest/prototypes/DontUseEntityInEnergyProductionAchievementPrototype.html dont-use-entity-in-energy-production-achievement] | ||
| Line 130: | Line 182: | ||
* Maximum number of Joules produced per hour, only including power produced from entities listed under "[https://lua-api.factorio.com/latest/prototypes/DontUseEntityInEnergyProductionAchievementPrototype.html#included included]", and excluding those listed under "[https://lua-api.factorio.com/latest/prototypes/DontUseEntityInEnergyProductionAchievementPrototype.html#excluded excluded]". | * Maximum number of Joules produced per hour, only including power produced from entities listed under "[https://lua-api.factorio.com/latest/prototypes/DontUseEntityInEnergyProductionAchievementPrototype.html#included included]", and excluding those listed under "[https://lua-api.factorio.com/latest/prototypes/DontUseEntityInEnergyProductionAchievementPrototype.html#excluded excluded]". | ||
|- | |- | ||
| [https://lua-api.factorio.com/latest/prototypes/ | | [https://lua-api.factorio.com/latest/prototypes/EquipArmorAchievementPrototype.html equip-armor-achievement] | ||
| | | | ||
* byte[4] | * byte[4] | ||
| | | | ||
* | * Unknown format, 4 bytes long. | ||
|- | |- | ||
| [https://lua-api.factorio.com/latest/prototypes/GroupAttackAchievementPrototype.html group-attack-achievement] | | [https://lua-api.factorio.com/latest/prototypes/GroupAttackAchievementPrototype.html group-attack-achievement] | ||
| Line 147: | Line 199: | ||
| | | | ||
* The greatest number of an entity killed (e.g. trees, spawners). | * The greatest number of an entity killed (e.g. trees, spawners). | ||
|- | |||
| [https://lua-api.factorio.com/latest/prototypes/ModuleTransferAchievementPrototype.html module-transfer-achievement] | |||
| | |||
* byte[4] | |||
| | |||
* Unknown format, 4 bytes long. | |||
|- | |||
| [https://lua-api.factorio.com/latest/prototypes/PlaceEquipmentAchievementPrototype.html place-equipment-achievement] | |||
| | |||
* byte[4] | |||
| | |||
* Unknown format, 4 bytes long. | |||
|- | |- | ||
| [https://lua-api.factorio.com/latest/prototypes/PlayerDamagedAchievementPrototype.html player-damaged-achievement] | | [https://lua-api.factorio.com/latest/prototypes/PlayerDamagedAchievementPrototype.html player-damaged-achievement] | ||
| Line 169: | Line 233: | ||
|- | |- | ||
| [https://lua-api.factorio.com/latest/prototypes/ResearchAchievementPrototype.html research-achievement] | | [https://lua-api.factorio.com/latest/prototypes/ResearchAchievementPrototype.html research-achievement] | ||
| | |||
* byte[0] | |||
| | |||
* Unknown format, 0 bytes long. | |||
|- | |||
| [https://lua-api.factorio.com/latest/prototypes/ResearchWithSciencePackAchievementPrototype.html research-with-science-pack-achievement] | |||
| | |||
* byte[4] | |||
| | |||
* Unknown format, 4 bytes long. | |||
|- | |||
| [https://lua-api.factorio.com/latest/prototypes/ShootAchievementPrototype.html shoot-achievement] | |||
| | |||
* byte[4] | |||
| | |||
* Unknown format, 4 bytes long. | |||
|- | |||
| [https://lua-api.factorio.com/latest/prototypes/SpaceConnectionDistanceTraveledAchievementPrototype.html space-connection-distance-traveled-achievement] | |||
| | | | ||
* byte[4] | * byte[4] | ||
| Line 175: | Line 257: | ||
|- | |- | ||
| [https://lua-api.factorio.com/latest/prototypes/TrainPathAchievementPrototype.html train-path-achievement] | | [https://lua-api.factorio.com/latest/prototypes/TrainPathAchievementPrototype.html train-path-achievement] | ||
| | |||
* [[Data_types#double|double]] | |||
| | |||
* The longest path (in tiles) planned by a train. | |||
|- | |||
| [https://lua-api.factorio.com/latest/prototypes/UseEntityInEnergyProductionAchievementPrototype.html use-entity-in-energy-production-achievement] | |||
| | |||
* byte[5] | |||
| | |||
* Unknown format, 5 bytes long. | |||
|- | |||
| [https://lua-api.factorio.com/latest/prototypes/UseItemAchievementPrototype.html use-item-achievement] | |||
| | |||
* byte[4] | |||
| | |||
* Unknown format, 4 bytes long. | |||
|} | |||
= Factorio 1.x = | |||
Factorio 1.x uses different formats for <code>achievements.dat</code> and <code>achievements-modded.dat</code>. | |||
== achievements.dat == | |||
=== File Format === | |||
The overall file format is as follows. Note that in this file, [[Data_types#array|array]] length is stored as a [[Data_types#short|short]], not an [[Data_types#int|int]]! | |||
{| class="wikitable" | |||
! Type !! Description | |||
|- | |||
| [[Data_types#short|short]][4] | |||
| The [[Version_string_format|version string]] of Factorio that generated this file. | |||
|- | |||
| [[Data_types#bool|bool]] | |||
| A bool that is always false | |||
|- | |||
| [[Data_types#array|array]]<[[#Achievement Header Info|bytes]]> | |||
| [[#Achievement Header Info|Achievement header info]]. Variable length. See the section for more information. | |||
|- | |||
| [[Data_types#array|array]]<[[#Achievement Content Info|bytes]]> | |||
| [[#Achievement Content Info|Achievement content info]]. Variable length. See the section for more information. | |||
|- | |||
| [[Data_types#short|short]][*] | |||
| Currently tracked achievements, given as a series of [[Data_types#short|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. | |||
{| class="wikitable" | |||
! Type !! Description | |||
|- | |||
| [[Data_types#Space_Optimized|Space optimized]] [[Data_types#string|string]] | |||
| Achievement type. This determines what kind of data fields this achievement contains in the content array. | |||
|- | |||
| [[Data_types#array|array]]<Header Subobject> | |||
| An array of achievements that use this achievement type. | |||
|} | |||
==== Header Subobject ==== | |||
{| class="wikitable" | |||
! Type !! Description | |||
|- | |||
| [[Data_types#Space_Optimized|Space optimized]] [[Data_types#string|string]] | |||
| Achievement string id - the one used internally by Factorio. | |||
|- | |||
| [[Data_types#short|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.<br> 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. | |||
{| class="wikitable" | |||
! Type !! Description | |||
|- | |||
| [[Data_types#short|short]] | |||
| Achievement index number. This matches up with the index number in the [[#Achievement Header Info|Achievement header info]]. | |||
|- | |||
| byte[*] | |||
| The achievement's progress information. The structure and length of this is determined by the [[#Achievement Types|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. | |||
See the [https://lua-api.factorio.com/1.1.110/prototypes/AchievementPrototype.html AchievementPrototype] base prototype page for more information about achievement structure. | |||
{| class="wikitable" | |||
! Achievement<br>Type !! Binary<br>Fields(s) !! Field(s) Description | |||
|- | |||
| [https://lua-api.factorio.com/1.1.110/prototypes/BuildEntityAchievementPrototype.html build-entity-achievement] | |||
| | |||
* byte[4] | |||
| | |||
* Unknown format, 4 bytes long. | |||
|- | |||
| [https://lua-api.factorio.com/1.1.110/prototypes/CombatRobotCountAchievementPrototype.html combat-robot-count] | |||
| | |||
* [[Data_types#int|int]] | |||
| | |||
* The greatest number of combat robots you've had following you. | |||
|- | |||
| [https://lua-api.factorio.com/1.1.110/prototypes/ConstructWithRobotsAchievementPrototype.html construct-with-robots-achievement] | |||
| | |||
* [[Data_types#int|int]] | |||
* byte[4] | |||
| | |||
* Total number of objects constructed using robots. | |||
* Unknown format, 4 bytes long. | |||
|- | |||
| [https://lua-api.factorio.com/1.1.110/prototypes/DeconstructWithRobotsAchievementPrototype.html deconstruct-with-robots-achievement] | |||
| | |||
* [[Data_types#int|int]] | |||
| | |||
* Total number of objects deconstructed using robots. | |||
|- | |||
| [https://lua-api.factorio.com/1.1.110/prototypes/DeliverByRobotsAchievementPrototype.html deliver-by-robots-achievement] | |||
| | |||
* byte[8] | |||
| | |||
* Unknown format, 8 bytes long. | |||
|- | |||
| [https://lua-api.factorio.com/1.1.110/prototypes/DontBuildEntityAchievementPrototype.html dont-build-entity-achievement] | |||
| | |||
* byte[4] | |||
| | |||
* Null bytes, 4 bytes long. | |||
|- | |||
| [https://lua-api.factorio.com/1.1.110/prototypes/DontCraftManuallyAchievementPrototype.html dont-craft-manually-achievement] | |||
| | |||
* byte[8] | |||
| | |||
* Null bytes, 8 bytes long. | |||
|- | |||
| [https://lua-api.factorio.com/1.1.110/prototypes/DontUseEntityInEnergyProductionAchievementPrototype.html dont-use-entity-in-energy-production-achievement] | |||
| | |||
* [[Data_types#double|double]] | |||
| | |||
* Maximum number of Joules produced per hour, only including power produced from entities listed under "[https://lua-api.factorio.com/1.1.110/prototypes/DontUseEntityInEnergyProductionAchievementPrototype.html#included included]", and excluding those listed under "[https://lua-api.factorio.com/1.1.110/prototypes/DontUseEntityInEnergyProductionAchievementPrototype.html#excluded excluded]". | |||
|- | |||
| [https://lua-api.factorio.com/1.1.110/prototypes/FinishTheGameAchievementPrototype.html finish-the-game-achievement] | |||
| | |||
* byte[4] | |||
| | |||
* Null bytes, 4 bytes long. | |||
|- | |||
| [https://lua-api.factorio.com/1.1.110/prototypes/GroupAttackAchievementPrototype.html group-attack-achievement] | |||
| | |||
* byte[4] | |||
| | |||
* Unknown format, 4 bytes long. | |||
|- | |||
| [https://lua-api.factorio.com/1.1.110/prototypes/KillAchievementPrototype.html kill-achievement] | |||
| | |||
* [[Data_types#double|double]] | |||
| | |||
* The greatest number of an entity killed (e.g. trees, spawners). | |||
|- | |||
| [https://lua-api.factorio.com/1.1.110/prototypes/PlayerDamagedAchievementPrototype.html player-damaged-achievement] | |||
| | |||
* [[Data_types#float|float]] | |||
* [[Data_types#bool|bool]] | |||
| | |||
* The maximum amount of damage you've taken in a single hit. | |||
* True if the you survived that hit, False if you died. | |||
|- | |||
| [https://lua-api.factorio.com/1.1.110/prototypes/ProduceAchievementPrototype.html produce-achievement] | |||
| | |||
* [[Data_types#double|double]] | |||
| | |||
* The total number of the item you've produced. | |||
|- | |||
| [https://lua-api.factorio.com/1.1.110/prototypes/ProducePerHourAchievementPrototype.html produce-per-hour-achievement] | |||
| | |||
* [[Data_types#double|double]] | |||
| | |||
* The maximum amount of the item produced per hour. | |||
|- | |||
| [https://lua-api.factorio.com/1.1.110/prototypes/ResearchAchievementPrototype.html research-achievement] | |||
| | |||
* byte[4] | |||
| | |||
* Unknown format, 4 bytes long. | |||
|- | |||
| [https://lua-api.factorio.com/1.1.110/prototypes/TrainPathAchievementPrototype.html train-path-achievement] | |||
| | | | ||
* [[Data_types#double|double]] | * [[Data_types#double|double]] | ||
| Line 181: | Line 456: | ||
|} | |} | ||
"combat-robot-count" is | "combat-robot-count" is the only achievement type in 1.x that doesn't end in "-achievement". This is not an error. | ||
= achievements-modded.dat = | == achievements-modded.dat == | ||
== File Format == | === File Format === | ||
The overall file format is simular to the non modded version but slightly different. | 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 | 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 | ||
| Line 204: | Line 479: | ||
|- | |- | ||
| [[Data_types#short|short]][*] | | [[Data_types#short|short]][*] | ||
| Currently tracked achievements, given as a series of [[Data_types#short|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 | | Currently tracked achievements, given as a series of [[Data_types#short|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. | This format has been valid since at least version 1.1.0. | ||
== Achievement Header Info == | === Achievement Header Info === | ||
The header contains information about what type of data fields each achievement has. | The header contains information about what type of data fields each achievement has. | ||
| Line 219: | Line 494: | ||
|- | |- | ||
| short [[Data_types#array|array]]<Header Subobject> | | short [[Data_types#array|array]]<Header Subobject> | ||
| An array of achievements that use this achievement type | | An array of achievements that use this achievement type. | ||
|} | |} | ||
=== Header Suboject === | ==== Header Suboject ==== | ||
{| class="wikitable" | {| class="wikitable" | ||
! Type !! Description | ! Type !! Description | ||
| Line 234: | Line 509: | ||
== Achievement Content Info == | === Achievement Content Info === | ||
This a object representing achievements, their type and their data | This a object representing achievements, their type and their data | ||
| Line 251: | Line 526: | ||
|} | |} | ||
== 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 | If new achievement types are added in the future, the achievement files will be unparse-able. Please add any new types you find here. | ||
See the [https://lua-api.factorio.com/ | See the [https://lua-api.factorio.com/1.1.110/prototypes/AchievementPrototype.html AchievementPrototype] base prototype page for more information about achievement structure. | ||
{| class="wikitable" | {| class="wikitable" | ||
| Line 261: | Line 536: | ||
|- | |- | ||
| [https://lua-api.factorio.com/ | | [https://lua-api.factorio.com/1.1.110/prototypes/BuildEntityAchievementPrototype.html build-entity-achievement] | ||
| | | | ||
* byte[4] | * byte[4] | ||
| Line 267: | Line 542: | ||
* Unknown format, 4 bytes long. | * Unknown format, 4 bytes long. | ||
|- | |- | ||
| [https://lua-api.factorio.com/ | | [https://lua-api.factorio.com/1.1.110/prototypes/CombatRobotCountAchievementPrototype.html combat-robot-count] | ||
| | | | ||
* [[Data_types#int|int]] | * [[Data_types#int|int]] | ||
| Line 273: | Line 548: | ||
* The greatest number of combat robots you've had following you. | * The greatest number of combat robots you've had following you. | ||
|- | |- | ||
| [https://lua-api.factorio.com/ | | [https://lua-api.factorio.com/1.1.110/prototypes/ConstructWithRobotsAchievementPrototype.html construct-with-robots-achievement] | ||
| | | | ||
* [[Data_types#int|int]] | * [[Data_types#int|int]] | ||
| Line 281: | Line 556: | ||
* Unknown format, 4 bytes long. | * Unknown format, 4 bytes long. | ||
|- | |- | ||
| [https://lua-api.factorio.com/ | | [https://lua-api.factorio.com/1.1.110/prototypes/DeconstructWithRobotsAchievementPrototype.html deconstruct-with-robots-achievement] | ||
| | | | ||
* [[Data_types#int|int]] | * [[Data_types#int|int]] | ||
| Line 287: | Line 562: | ||
* Total number of objects deconstructed using robots. | * Total number of objects deconstructed using robots. | ||
|- | |- | ||
| [https://lua-api.factorio.com/ | | [https://lua-api.factorio.com/1.1.110/prototypes/DeliverByRobotsAchievementPrototype.html deliver-by-robots-achievement] | ||
| | | | ||
* byte[8] | * byte[8] | ||
| Line 293: | Line 568: | ||
* Unknown format, 8 bytes long. | * Unknown format, 8 bytes long. | ||
|- | |- | ||
| [https://lua-api.factorio.com/ | | [https://lua-api.factorio.com/1.1.110/prototypes/DontBuildEntityAchievementPrototype.html dont-build-entity-achievement] | ||
| | | | ||
* byte[4] | * byte[4] | ||
| Line 299: | Line 574: | ||
* Null bytes, 4 bytes long. | * Null bytes, 4 bytes long. | ||
|- | |- | ||
| [https://lua-api.factorio.com/ | | [https://lua-api.factorio.com/1.1.110/prototypes/DontCraftManuallyAchievementPrototype.html dont-craft-manually-achievement] | ||
| | | | ||
* byte[8] | * byte[8] | ||
| Line 305: | Line 580: | ||
* Null bytes, 8 bytes long. | * Null bytes, 8 bytes long. | ||
|- | |- | ||
| [https://lua-api.factorio.com/ | | [https://lua-api.factorio.com/1.1.110/prototypes/DontUseEntityInEnergyProductionAchievementPrototype.html dont-use-entity-in-energy-production-achievement] | ||
| | | | ||
* [[Data_types#double|double]] | * [[Data_types#double|double]] | ||
| | | | ||
* Maximum number of Joules produced per hour, only including power produced from entities listed under "[https://lua-api.factorio.com/ | * Maximum number of Joules produced per hour, only including power produced from entities listed under "[https://lua-api.factorio.com/1.1.110/prototypes/DontUseEntityInEnergyProductionAchievementPrototype.html#included included]", and excluding those listed under "[https://lua-api.factorio.com/1.1.110/prototypes/DontUseEntityInEnergyProductionAchievementPrototype.html#excluded excluded]". | ||
|- | |- | ||
| [https://lua-api.factorio.com/ | | [https://lua-api.factorio.com/1.1.110/prototypes/FinishTheGameAchievementPrototype.html finish-the-game-achievement] | ||
| | | | ||
* byte[4] | * byte[4] | ||
| Line 317: | Line 592: | ||
* Null bytes, 4 bytes long. | * Null bytes, 4 bytes long. | ||
|- | |- | ||
| [https://lua-api.factorio.com/ | | [https://lua-api.factorio.com/1.1.110/prototypes/GroupAttackAchievementPrototype.html group-attack-achievement] | ||
| | | | ||
* byte[4] | * byte[4] | ||
| Line 323: | Line 598: | ||
* Unknown format, 4 bytes long. | * Unknown format, 4 bytes long. | ||
|- | |- | ||
| [https://lua-api.factorio.com/ | | [https://lua-api.factorio.com/1.1.110/prototypes/KillAchievementPrototype.html kill-achievement] | ||
| | | | ||
* [[Data_types#double|double]] | * [[Data_types#double|double]] | ||
| Line 329: | Line 604: | ||
* The greatest number of an entity killed (e.g. trees, spawners). | * The greatest number of an entity killed (e.g. trees, spawners). | ||
|- | |- | ||
| [https://lua-api.factorio.com/ | | [https://lua-api.factorio.com/1.1.110/prototypes/PlayerDamagedAchievementPrototype.html player-damaged-achievement] | ||
| | | | ||
* [[Data_types#float|float]] | * [[Data_types#float|float]] | ||
| Line 337: | Line 612: | ||
* True if the you survived that hit, False if you died. | * True if the you survived that hit, False if you died. | ||
|- | |- | ||
| [https://lua-api.factorio.com/ | | [https://lua-api.factorio.com/1.1.110/prototypes/ProduceAchievementPrototype.html produce-achievement] | ||
| | | | ||
* [[Data_types#double|double]] | * [[Data_types#double|double]] | ||
| Line 343: | Line 618: | ||
* The total number of the item you've produced. | * The total number of the item you've produced. | ||
|- | |- | ||
| [https://lua-api.factorio.com/ | | [https://lua-api.factorio.com/1.1.110/prototypes/ProducePerHourAchievementPrototype.html produce-per-hour-achievement] | ||
| | | | ||
* [[Data_types#double|double]] | * [[Data_types#double|double]] | ||
| Line 349: | Line 624: | ||
* The maximum amount of the item produced per hour. | * The maximum amount of the item produced per hour. | ||
|- | |- | ||
| [https://lua-api.factorio.com/ | | [https://lua-api.factorio.com/1.1.110/prototypes/ResearchAchievementPrototype.html research-achievement] | ||
| | | | ||
* byte[0] | * byte[0] | ||
| Line 355: | Line 630: | ||
* Unknown format, 0 bytes long. | * Unknown format, 0 bytes long. | ||
|- | |- | ||
| [https://lua-api.factorio.com/ | | [https://lua-api.factorio.com/1.1.110/prototypes/TrainPathAchievementPrototype.html train-path-achievement] | ||
| | | | ||
* [[Data_types#double|double]] | * [[Data_types#double|double]] | ||
| Line 361: | Line 636: | ||
* The longest path (in tiles) planned by a train. | * The longest path (in tiles) planned by a train. | ||
|- | |- | ||
| [https://lua-api.factorio.com/ | | [https://lua-api.factorio.com/1.1.110/prototypes/AchievementPrototype.html achievement] | ||
| | | | ||
* byte[0] | * byte[0] | ||
| Line 368: | Line 643: | ||
|} | |} | ||
"combat-robot-count" is | "combat-robot-count" is the only achievement type that in 1.x doesn't end in "-achievement". This is not an error. <br> | ||
Also for some reason, in the 2nd Header the research-achievement type has no data bytes | Also for some reason, in the 2nd Header the research-achievement type has no data bytes. | ||
[[Category:Technical]] | [[Category:Technical]] | ||
Latest revision as of 20:48, 16 November 2025
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.
See the page on data types for an explanation of the different types of data used in this document.
Factorio 2.x
Factorio 2.x uses the same format for both achievements.dat and achievements-modded.dat.
File Format
| 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. |
| byte[*] | Unknown. Probably tracked achievements like in #Factorio 1.x, but this is not confirmed. |
This format is valid as of version 2.0.72.
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 Subobject
| Type | Description |
|---|---|
| Space optimized string | Achievement string id - the one used internally by Factorio. |
| byte[2] | Unknown. Probably an index number like in #Factorio 1.x, but this is not confirmed. |
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.
| Type | Description |
|---|---|
| Space optimized string | Achievement type. This determines what kind of data fields this achievement contains in the progress field. |
| Space optimized string | Achievement 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.
See the Defines.prototypes and bas AchivementPrototype documentation for more information about achievement types and data structures.
| Achievement Type |
Binary Fields(s) |
Field(s) Description |
|---|---|---|
| achievement |
|
|
| build-entity-achievement |
|
|
| change-surface-achievement |
|
|
| combat-robot-count |
| |
| complete-objective-achievement |
|
|
| construct-with-robots-achievement |
|
|
| create-platform-achievement |
|
|
| deconstruct-with-robots-achievement |
| |
| deliver-by-robots-achievement |
|
|
| deplete-resource-achievement |
|
|
| destroy-cliff-achievement |
|
|
| dont-build-entity-achievement |
|
|
| dont-craft-manually-achievement |
|
|
| dont-kill-manually-achievement |
|
|
| dont-research-before-researching-achievement |
|
|
| dont-use-entity-in-energy-production-achievement | ||
| equip-armor-achievement |
|
|
| group-attack-achievement |
|
|
| kill-achievement |
| |
| module-transfer-achievement |
|
|
| place-equipment-achievement |
|
|
| player-damaged-achievement |
| |
| produce-achievement |
| |
| produce-per-hour-achievement |
| |
| research-achievement |
|
|
| research-with-science-pack-achievement |
|
|
| shoot-achievement |
|
|
| space-connection-distance-traveled-achievement |
|
|
| train-path-achievement |
| |
| use-entity-in-energy-production-achievement |
|
|
| use-item-achievement |
|
|
Factorio 1.x
Factorio 1.x uses different formats for achievements.dat and achievements-modded.dat.
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.
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 the only achievement type in 1.x 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.
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 the only achievement type that in 1.x 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.