In other languages:

Map exchange string format: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
Line 101: Line 101:
| boolean || enabled || Evolution enabled.
| boolean || enabled || Evolution enabled.
|-  
|-  
| int || time_factor || Time factor.
| double || time_factor || Time factor.
|-  
|-  
| int || destroy_factor || Destroy factor.
| double || destroy_factor || Destroy factor.
|-  
|-  
| int || pollution_factor || Pollution factor.
| double || pollution_factor || Pollution factor.
|-
! * !! enemy_expansion !! Enemy Expansion
|-
| boolean || enabled || Enemy expansion enabled.
|-
| int || max_expansion_distance || Maximum expansion distance.
|-
| int || friendly_base_influence_radius || ???
|-
| int || enemy_building_influence_radius || ???
|-
| double || building_coefficient || ???
|-
| double || other_base_coefficient || ???
|-
| double || neighbouring_chunk_coefficient || ???
|-
| double || neighbouring_base_chunk_coefficient || ???
|-
| double || max_colliding_tiles_coefficient || ???
|-
| int || settler_group_min_size || ???
|-
| int || settler_group_max_size || ???
|-
| int || min_expansion_cooldown || ???
|-
| int || max_expansion_cooldown || ???
|-
! * !! unit_group !! Unit Group
|-
| int ||  || ???
|-
| int ||  || ???
|-
| int ||  || ???
|}
|}



Revision as of 06:00, 1 May 2017


This is a technical description of the map exchange string format, used to share map generating configurations with other users.

Factorio line wraps the entire map exchange string after 55 characters during export, but ignores all whitespace during import. The outer layer of the map exchange string format includes three angle brackets on either side: ">>>" and "<<<", which must be present for Factorio to accept the string. Between those two tokens is the map exchange data, encoded using base 64 as defined by RFC 4648 (or 3548, 2535, 2045, 1421, et al). All numerical values are stored in unsigned little-endian format.

This document will use the terms "int" to refer to 4 byte numbers and "short" to refer to 2 byte numbers. Boolean is a single byte that represents true if equal to 1, otherwise it is equal to false. Strings are Pascal-style int length prefixed strings. The format described below is valid at least for Factorio 0.14.x, other versions may use a different encoding scheme.

Factorio 0.14.x and beyond

short[4] The version string of Factorio that generated this string, used to determine encoding format.
byte Water frequency.
byte Water size.
ore_def[int] An array of ore definitions. The array length is stored as an integer prefix. Factorio doesn’t care what order these are in, but it always alphabetizes during export. Vanilla has six ores: coal, copper-ore, crude-oil, enemy-base, iron-ore, and stone. Unknown ores are ignored and missing ores are set to their defaults.
int Map seed.
int Map width.
int Map height.
byte Starting area size.
boolean Peaceful mode. Enabled if set to 1, disabled otherwise.
byte[*] 0.15.x map string data, if version >= 0.15. This chunk consists of the remainder of the data (minus the checksum)
int CRC32 checksum of all preceding data, as defined by ANSI X3.66 / FIPS 71 / ITU-T V.42 (the same one used by zlib, ethernet, etc.)

0.15 Map Exchange Data

All of the following data values have a special encapsulation format. Preceding each value is a single byte that states whether or not the value is present. If the byte is equal to zero, then the field value is not present. Otherwise, then the field's value follows.

In the LUA structure, this information is stored in the "map_settings" table, which is created by the "map-settings" prototype. Each section in the table below represents a nested sub-table in "map-settings", where the LUA key listed is the key of the table, and all subsequent fields are part of the sub-table. See data/base/prototypes/map-settings.lua for a description of all attributes.

Type LUA key Description
* pollution Pollution
boolean enabled Pollution enabled.
double diffusion_ratio Diffusion ratio.
double min_to_diffuse ???
double ageing Dissipation rate.
double expected_max_per_chunk ???
double min_to_show_per_chunk ???
double min_pollution_to_damage_trees Minimum to damage trees.
double pollution_with_max_forest_damage ???
double pollution_per_tree_damage ???
double pollution_restored_per_tree_damage Absorbed per damaged tree.
double max_pollution_to_restore_trees ???
* steering.default Steering (Default)
double ??? ???
double ??? ???
double separation_force ???
boolean force_unit_fuzzy_goto_behavior ???
* steering.moving Steering (Moving)
double ??? ???
double ??? ???
double separation_force ???
boolean force_unit_fuzzy_goto_behavior ???
* enemy_evolution Evolution
boolean enabled Evolution enabled.
double time_factor Time factor.
double destroy_factor Destroy factor.
double pollution_factor Pollution factor.
* enemy_expansion Enemy Expansion
boolean enabled Enemy expansion enabled.
int max_expansion_distance Maximum expansion distance.
int friendly_base_influence_radius ???
int enemy_building_influence_radius ???
double building_coefficient ???
double other_base_coefficient ???
double neighbouring_chunk_coefficient ???
double neighbouring_base_chunk_coefficient ???
double max_colliding_tiles_coefficient ???
int settler_group_min_size ???
int settler_group_max_size ???
int min_expansion_cooldown ???
int max_expansion_cooldown ???
* unit_group Unit Group
int ???
int ???
int ???

Ore_def Ore Definitions

See the page on world generation for more information on frequency, size, and richness.

string Ore name.
byte Ore frequency.
byte Ore size.
byte Ore richness.

Magnitudes (Frequencies / Sizes / Richness)

These are the values used for the frequencies, sizes, and richnesses of ores, water, and the starting area size. None is a valid value for all three options. Anything greater than 5 will crash the game!

0 None / None /None
1 Very Low / Small / Poor
2 Low / Small / Poor
3 Normal / Medium / Regular
4 High / Big / Good
5 Very High / Big / Good