Achievement file format: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(Due to achievements.data and achievements-modded.dat having slightly different formats, they have been split up into 2 things, 1 for normal and 1 for modded, due to how similar they are, it should be looked into if condensing them back down to 1 with the differences marked is a better way of conveying the information)
(Link to migrated prototype docs)
 
Line 50: Line 50:
|-
|-
| [[Data_types#short|short]]
| [[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 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.
|}
|}


Line 74: Line 74:
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!
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 [[Prototype/Achievement]] base prototype page for more information about achievement structure.
See the [https://lua-api.factorio.com/latest/prototypes/AchievementPrototype.html AchievementPrototype] base prototype page for more information about achievement structure.


{| class="wikitable"
{| class="wikitable"
Line 80: Line 80:


|-
|-
| [[Prototype/BuildEntityAchievement|build-entity-achievement]]
| [https://lua-api.factorio.com/latest/prototypes/BuildEntityAchievementPrototype.html build-entity-achievement]
|
|
* byte[4]
* byte[4]
Line 86: Line 86:
* Unknown format, 4 bytes long.
* Unknown format, 4 bytes long.
|-
|-
| [[Prototype/CombatRobotCountAchievement|combat-robot-count]]
| [https://lua-api.factorio.com/latest/prototypes/CombatRobotCountAchievementPrototype.html combat-robot-count]
|
|
* [[Data_types#int|int]]
* [[Data_types#int|int]]
Line 92: Line 92:
* The greatest number of combat robots you've had following you.
* The greatest number of combat robots you've had following you.
|-
|-
| [[Prototype/ConstructWithRobotsAchievement|construct-with-robots-achievement]]
| [https://lua-api.factorio.com/latest/prototypes/ConstructWithRobotsAchievementPrototype.html construct-with-robots-achievement]
|
|
* [[Data_types#int|int]]
* [[Data_types#int|int]]
Line 100: Line 100:
* Unknown format, 4 bytes long.
* Unknown format, 4 bytes long.
|-
|-
| [[Prototype/DeconstructWithRobotsAchievement|deconstruct-with-robots-achievement]]
| [https://lua-api.factorio.com/latest/prototypes/DeconstructWithRobotsAchievementPrototype.html deconstruct-with-robots-achievement]
|
|
* [[Data_types#int|int]]
* [[Data_types#int|int]]
Line 106: Line 106:
* Total number of objects deconstructed using robots.
* Total number of objects deconstructed using robots.
|-
|-
| [[Prototype/DeliverByRobotsAchievement|deliver-by-robots-achievement]]
| [https://lua-api.factorio.com/latest/prototypes/DeliverByRobotsAchievementPrototype.html deliver-by-robots-achievement]
|
|
* byte[8]
* byte[8]
Line 112: Line 112:
* Unknown format, 8 bytes long.
* Unknown format, 8 bytes long.
|-
|-
| [[Prototype/DontBuildEntityAchievement|dont-build-entity-achievement]]
| [https://lua-api.factorio.com/latest/prototypes/DontBuildEntityAchievementPrototype.html dont-build-entity-achievement]
|
|
* byte[4]
* byte[4]
Line 118: Line 118:
* Null bytes, 4 bytes long.
* Null bytes, 4 bytes long.
|-
|-
| [[Prototype/DontCraftManuallyAchievement|dont-craft-manually-achievement]]
| [https://lua-api.factorio.com/latest/prototypes/DontCraftManuallyAchievementPrototype.html dont-craft-manually-achievement]
|
|
* byte[8]
* byte[8]
Line 124: Line 124:
* Null bytes, 8 bytes long.
* Null bytes, 8 bytes long.
|-
|-
| [[Prototype/DontUseEntityInEnergyProductionAchievement|dont-use-entity-in-energy-production-achievement]]
| [https://lua-api.factorio.com/latest/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 "[[Prototype/DontUseEntityInEnergyProductionAchievement#included|included]]", and excluding those listed under "[[Prototype/DontUseEntityInEnergyProductionAchievement#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]".
|-
|-
| [[Prototype/FinishTheGameAchievement|finish-the-game-achievement]]
| [https://lua-api.factorio.com/latest/prototypes/FinishTheGameAchievementPrototype.html finish-the-game-achievement]
|
|
* byte[4]
* byte[4]
Line 136: Line 136:
* Null bytes, 4 bytes long.
* Null bytes, 4 bytes long.
|-
|-
| [[Prototype/GroupAttackAchievement|group-attack-achievement]]
| [https://lua-api.factorio.com/latest/prototypes/GroupAttackAchievementPrototype.html group-attack-achievement]
|
|
* byte[4]
* byte[4]
Line 142: Line 142:
* Unknown format, 4 bytes long.
* Unknown format, 4 bytes long.
|-
|-
| [[Prototype/KillAchievement|kill-achievement]]
| [https://lua-api.factorio.com/latest/prototypes/KillAchievementPrototype.html kill-achievement]
|
|
* [[Data_types#double|double]]
* [[Data_types#double|double]]
Line 148: Line 148:
* The greatest number of an entity killed (e.g. trees, spawners).
* The greatest number of an entity killed (e.g. trees, spawners).
|-
|-
| [[Prototype/PlayerDamagedAchievement|player-damaged-achievement]]
| [https://lua-api.factorio.com/latest/prototypes/PlayerDamagedAchievementPrototype.html player-damaged-achievement]
|  
|  
* [[Data_types#float|float]]
* [[Data_types#float|float]]
Line 156: Line 156:
* True if the you survived that hit, False if you died.
* True if the you survived that hit, False if you died.
|-
|-
| [[Prototype/ProduceAchievement|produce-achievement]]
| [https://lua-api.factorio.com/latest/prototypes/ProduceAchievementPrototype.html produce-achievement]
|
|
* [[Data_types#double|double]]
* [[Data_types#double|double]]
Line 162: Line 162:
* The total number of the item you've produced.
* The total number of the item you've produced.
|-
|-
| [[Prototype/ProducePerHourAchievement|produce-per-hour-achievement]]
| [https://lua-api.factorio.com/latest/prototypes/ProducePerHourAchievementPrototype.html produce-per-hour-achievement]
|
|
* [[Data_types#double|double]]
* [[Data_types#double|double]]
Line 168: Line 168:
* The maximum amount of the item produced per hour.
* The maximum amount of the item produced per hour.
|-
|-
| [[Prototype/ResearchAchievement|research-achievement]]
| [https://lua-api.factorio.com/latest/prototypes/ResearchAchievementPrototype.html research-achievement]
|
|
* byte[4]
* byte[4]
Line 174: Line 174:
* Unknown format, 4 bytes long.
* Unknown format, 4 bytes long.
|-
|-
| [[Prototype/TrainPathAchievement|train-path-achievement]]
| [https://lua-api.factorio.com/latest/prototypes/TrainPathAchievementPrototype.html train-path-achievement]
|
|
* [[Data_types#double|double]]
* [[Data_types#double|double]]
Line 230: Line 230:
|-
|-
| [[Data_types#short|short]]
| [[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 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.  
|}
|}


Line 255: Line 255:
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!
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 [[Prototype/Achievement]] base prototype page for more information about achievement structure.
See the [https://lua-api.factorio.com/latest/prototypes/AchievementPrototype.html AchievementPrototype] base prototype page for more information about achievement structure.


{| class="wikitable"
{| class="wikitable"
Line 261: Line 261:


|-
|-
| [[Prototype/BuildEntityAchievement|build-entity-achievement]]
| [https://lua-api.factorio.com/latest/prototypes/BuildEntityAchievementPrototype.html build-entity-achievement]
|
|
* byte[4]
* byte[4]
Line 267: Line 267:
* Unknown format, 4 bytes long.
* Unknown format, 4 bytes long.
|-
|-
| [[Prototype/CombatRobotCountAchievement|combat-robot-count]]
| [https://lua-api.factorio.com/latest/prototypes/CombatRobotCountAchievementPrototype.html combat-robot-count]
|
|
* [[Data_types#int|int]]
* [[Data_types#int|int]]
Line 273: Line 273:
* The greatest number of combat robots you've had following you.
* The greatest number of combat robots you've had following you.
|-
|-
| [[Prototype/ConstructWithRobotsAchievement|construct-with-robots-achievement]]
| [https://lua-api.factorio.com/latest/prototypes/ConstructWithRobotsAchievementPrototype.html construct-with-robots-achievement]
|
|
* [[Data_types#int|int]]
* [[Data_types#int|int]]
Line 281: Line 281:
* Unknown format, 4 bytes long.
* Unknown format, 4 bytes long.
|-
|-
| [[Prototype/DeconstructWithRobotsAchievement|deconstruct-with-robots-achievement]]
| [https://lua-api.factorio.com/latest/prototypes/DeconstructWithRobotsAchievementPrototype.html deconstruct-with-robots-achievement]
|
|
* [[Data_types#int|int]]
* [[Data_types#int|int]]
Line 287: Line 287:
* Total number of objects deconstructed using robots.
* Total number of objects deconstructed using robots.
|-
|-
| [[Prototype/DeliverByRobotsAchievement|deliver-by-robots-achievement]]
| [https://lua-api.factorio.com/latest/prototypes/DeliverByRobotsAchievementPrototype.html deliver-by-robots-achievement]
|
|
* byte[8]
* byte[8]
Line 293: Line 293:
* Unknown format, 8 bytes long.
* Unknown format, 8 bytes long.
|-
|-
| [[Prototype/DontBuildEntityAchievement|dont-build-entity-achievement]]
| [https://lua-api.factorio.com/latest/prototypes/DontBuildEntityAchievementPrototype.html dont-build-entity-achievement]
|
|
* byte[4]
* byte[4]
Line 299: Line 299:
* Null bytes, 4 bytes long.
* Null bytes, 4 bytes long.
|-
|-
| [[Prototype/DontCraftManuallyAchievement|dont-craft-manually-achievement]]
| [https://lua-api.factorio.com/latest/prototypes/DontCraftManuallyAchievementPrototype.html dont-craft-manually-achievement]
|
|
* byte[8]
* byte[8]
Line 305: Line 305:
* Null bytes, 8 bytes long.
* Null bytes, 8 bytes long.
|-
|-
| [[Prototype/DontUseEntityInEnergyProductionAchievement|dont-use-entity-in-energy-production-achievement]]
| [https://lua-api.factorio.com/latest/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 "[[Prototype/DontUseEntityInEnergyProductionAchievement#included|included]]", and excluding those listed under "[[Prototype/DontUseEntityInEnergyProductionAchievement#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]".
|-
|-
| [[Prototype/FinishTheGameAchievement|finish-the-game-achievement]]
| [https://lua-api.factorio.com/latest/prototypes/FinishTheGameAchievementPrototype.html finish-the-game-achievement]
|
|
* byte[4]
* byte[4]
Line 317: Line 317:
* Null bytes, 4 bytes long.
* Null bytes, 4 bytes long.
|-
|-
| [[Prototype/GroupAttackAchievement|group-attack-achievement]]
| [https://lua-api.factorio.com/latest/prototypes/GroupAttackAchievementPrototype.html group-attack-achievement]
|
|
* byte[4]
* byte[4]
Line 323: Line 323:
* Unknown format, 4 bytes long.
* Unknown format, 4 bytes long.
|-
|-
| [[Prototype/KillAchievement|kill-achievement]]
| [https://lua-api.factorio.com/latest/prototypes/KillAchievementPrototype.html kill-achievement]
|
|
* [[Data_types#double|double]]
* [[Data_types#double|double]]
Line 329: Line 329:
* The greatest number of an entity killed (e.g. trees, spawners).
* The greatest number of an entity killed (e.g. trees, spawners).
|-
|-
| [[Prototype/PlayerDamagedAchievement|player-damaged-achievement]]
| [https://lua-api.factorio.com/latest/prototypes/PlayerDamagedAchievementPrototype.html player-damaged-achievement]
|  
|  
* [[Data_types#float|float]]
* [[Data_types#float|float]]
Line 337: Line 337:
* True if the you survived that hit, False if you died.
* True if the you survived that hit, False if you died.
|-
|-
| [[Prototype/ProduceAchievement|produce-achievement]]
| [https://lua-api.factorio.com/latest/prototypes/ProduceAchievementPrototype.html produce-achievement]
|
|
* [[Data_types#double|double]]
* [[Data_types#double|double]]
Line 343: Line 343:
* The total number of the item you've produced.
* The total number of the item you've produced.
|-
|-
| [[Prototype/ProducePerHourAchievement|produce-per-hour-achievement]]
| [https://lua-api.factorio.com/latest/prototypes/ProducePerHourAchievementPrototype.html produce-per-hour-achievement]
|
|
* [[Data_types#double|double]]
* [[Data_types#double|double]]
Line 349: Line 349:
* The maximum amount of the item produced per hour.
* The maximum amount of the item produced per hour.
|-
|-
| [[Prototype/ResearchAchievement|research-achievement]]
| [https://lua-api.factorio.com/latest/prototypes/ResearchAchievementPrototype.html research-achievement]
|
|
* byte[0]
* byte[0]
Line 355: Line 355:
* Unknown format, 0 bytes long.
* Unknown format, 0 bytes long.
|-
|-
| [[Prototype/TrainPathAchievement|train-path-achievement]]
| [https://lua-api.factorio.com/latest/prototypes/TrainPathAchievementPrototype.html train-path-achievement]
|
|
* [[Data_types#double|double]]
* [[Data_types#double|double]]
Line 361: Line 361:
* The longest path (in tiles) planned by a train.
* The longest path (in tiles) planned by a train.
|-
|-
| [[Prototype/Achievement|achievement]]
| [https://lua-api.factorio.com/latest/prototypes/AchievementPrototype.html achievement]
|
|
* byte[0]
* byte[0]

Latest revision as of 14:25, 23 September 2024

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
  • byte[4]
  • Unknown format, 4 bytes long.
combat-robot-count
  • The greatest number of combat robots you've had following you.
construct-with-robots-achievement
  • Total number of objects constructed using robots.
  • Unknown format, 4 bytes long.
deconstruct-with-robots-achievement
  • Total number of objects deconstructed using robots.
deliver-by-robots-achievement
  • byte[8]
  • Unknown format, 8 bytes long.
dont-build-entity-achievement
  • byte[4]
  • Null bytes, 4 bytes long.
dont-craft-manually-achievement
  • byte[8]
  • Null bytes, 8 bytes long.
dont-use-entity-in-energy-production-achievement
  • Maximum number of Joules produced per hour, only including power produced from entities listed under "included", and excluding those listed under "excluded".
finish-the-game-achievement
  • byte[4]
  • Null bytes, 4 bytes long.
group-attack-achievement
  • byte[4]
  • Unknown format, 4 bytes long.
kill-achievement
  • The greatest number of an entity killed (e.g. trees, spawners).
player-damaged-achievement
  • The maximum amount of damage you've taken in a single hit.
  • True if the you survived that hit, False if you died.
produce-achievement
  • The total number of the item you've produced.
produce-per-hour-achievement
  • The maximum amount of the item produced per hour.
research-achievement
  • byte[4]
  • Unknown format, 4 bytes long.
train-path-achievement
  • The longest path (in tiles) planned by a train.

"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
  • byte[4]
  • Unknown format, 4 bytes long.
combat-robot-count
  • The greatest number of combat robots you've had following you.
construct-with-robots-achievement
  • Total number of objects constructed using robots.
  • Unknown format, 4 bytes long.
deconstruct-with-robots-achievement
  • Total number of objects deconstructed using robots.
deliver-by-robots-achievement
  • byte[8]
  • Unknown format, 8 bytes long.
dont-build-entity-achievement
  • byte[4]
  • Null bytes, 4 bytes long.
dont-craft-manually-achievement
  • byte[8]
  • Null bytes, 8 bytes long.
dont-use-entity-in-energy-production-achievement
  • Maximum number of Joules produced per hour, only including power produced from entities listed under "included", and excluding those listed under "excluded".
finish-the-game-achievement
  • byte[4]
  • Null bytes, 4 bytes long.
group-attack-achievement
  • byte[4]
  • Unknown format, 4 bytes long.
kill-achievement
  • The greatest number of an entity killed (e.g. trees, spawners).
player-damaged-achievement
  • The maximum amount of damage you've taken in a single hit.
  • True if the you survived that hit, False if you died.
produce-achievement
  • The total number of the item you've produced.
produce-per-hour-achievement
  • The maximum amount of the item produced per hour.
research-achievement
  • byte[0]
  • Unknown format, 0 bytes long.
train-path-achievement
  • The longest path (in tiles) planned by a train.
achievement
  • byte[0]
  • Unknown format, 0 bytes long.

"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