In other languages:

Map exchange string format

From Official Factorio Wiki
Jump to navigation Jump to search


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).

This document will use the terms "int" to refer to 4 byte numbers and "short" to refer to 2 byte numbers. All numerical values are stored in unsigned little-endian format. "boolean" is a single byte that represents true if equal to 1, otherwise it is equal to false. "string"s are Pascal-style int length prefixed strings. The format described below is valid at least for Factorio 0.14.x, older versions may use a different encoding scheme.

Factorio 0.14 and Beyond

This is the base map exchange string format for all Factorio versions 0.14.x and greater.

Type Description
short[4] The version string of Factorio that generated this string, used to determine encoding format.
byte[*] Map Gen Settings. Variable length. See linked section for information on how to parse.
byte[*] 0.15.x Map Settings. If present, 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.)

Map Gen Settings

This format is very similar to, but not identical to, MapGenSettings - it is missing both the "terrain_segmentation" and "shift" fields.

For the purpose of the "autoplace_controls" field, a dictionary is an array-like structure, where the number of dictionary entries are encoded at the beginning of the dictionary as an integer (int). Following is a sequence of (key, value) pairs, with the specified data types - e.g. a dictionary[string, int] would consist of a sequence of (string, int) pairs.

Type LUA key Description
byte Water frequency.
byte water Water size.
dict<string, byte[3]> autoplace_controls An dictionary of Autoplace Controls, with string keys, where the key represents the ore name. Factorio doesn’t care what order this dictionary is in, but it always alphabetizes during export. Vanilla has seven resources: coal, copper-ore, crude-oil, enemy-base, iron-ore, stone, and uranium-ore. Unknown ores are ignored and missing ores are set to their defaults.
int seed Map seed.
int width Map width.
int height Map height.
byte starting_area Starting area size.
boolean peaceful_mode Peaceful mode. Enabled if set to 1, disabled otherwise.

0.15 Map Settings

All of the following data fields (until noted at the end) 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 this section, the data type "double" refers to the 64-bit floating point format described by IEEE 754.

In the LUA structure, this information is stored in the "game.map_settings" table, which is created by the "MapSettings" 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.

Fields marked with a check (✓) in the "GUI" column are configurable in the new game map generator GUI.

Type GUI LUA key Description
* pollution Pollution
boolean enabled Pollution enabled.
double diffusion_ratio The amount of pollution that is diffused into neighboring chunk per second.
double min_to_diffuse This many PUs must be on the chunk to start diffusing.
double ageing [Modifier of] the pollution eaten by a chunks tiles.
double expected_max_per_chunk Anything bigger than this is visualised as this value.
double min_to_show_per_chunk Anything lower than this (but > 0) is visualised as this value.
double min_pollution_to_damage_trees Any pollution above this amount starts to damage trees.
double pollution_with_max_forest_damage ???
double pollution_per_tree_damage ???
double pollution_restored_per_tree_damage The amount of pollution absorbed by a tree when it is damaged by pollution.
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 Percent increase in the evolve factor for every second.
double destroy_factor Percent increase in the evolve factor for every destroyed spawner.
double pollution_factor Percent increase in the evolve factor for every 1000 PU [produced].
* enemy_expansion Enemy Expansion
boolean enabled Enemy expansion enabled.
int max_expansion_distance Distance in chunks from the furthest base around.
int friendly_base_influence_radius ???
int enemy_building_influence_radius ???
double building_coefficient Expansion algorithm. See LUA file for details.
double other_base_coefficient
double neighbouring_chunk_coefficient
double neighbouring_base_chunk_coefficient
double max_colliding_tiles_coefficient A chunk has to have at most this much percent unbuildable tiles for it to be considered a candidate.
int settler_group_min_size Size of the group that goes to build new base (in game this is multiplied by the evolution factor).
int settler_group_max_size
int min_expansion_cooldown Minimum cooldown.
int max_expansion_cooldown Maximum cooldown.
* unit_group Unit Group
int min_group_gathering_time ???
int max_group_gathering_time ???
int max_wait_time_for_late_members ???
double max_group_radius ???
double min_group_radius ???
double max_member_speedup_when_behind ???
double max_member_slowdown_when_ahead ???
double max_group_slowdown_factor ???
double max_group_member_fallback_factor ???
double member_disown_distance ???
int tick_tolerance_when_member_arrives ???
int max_gathering_unit_groups ???
int max_unit_group_size ???
* path_finder Path Finder
int fwd2bwd_ratio ???
double goal_pressure_ratio ???
bool use_path_cache ???
double max_steps_worked_per_tick ???
int short_cache_size ???
int long_cache_size ???
double short_cache_min_cacheable_distance ???
int short_cache_min_algo_steps_to_cache ???
double long_cache_min_cacheable_distance ???
int cache_max_connect_to_cache_steps_multiplier ???
double cache_accept_path_start_distance_ratio ???
double cache_accept_path_end_distance_ratio ???
double negative_cache_accept_path_start_distance_ratio ???
double negative_cache_accept_path_end_distance_ratio ???
double cache_path_start_distance_rating_multiplier ???
double cache_path_end_distance_rating_multiplier ???
double stale_enemy_with_same_destination_collision_penalty ???
double ignore_moving_enemy_collision_distance ???
double enemy_with_different_destination_collision_penalty ???
double general_entity_collision_penalty ???
double general_entity_subsequent_collision_penalty ???
int max_clients_to_accept_any_new_request ???
int max_clients_to_accept_short_new_request ???
int direct_distance_to_consider_short_request ???
int short_request_max_steps ???
double short_request_ratio ???
int min_steps_to_check_path_find_termination ???
double start_to_goal_cost_multiplier_to_terminate_path_find ???
Note: The following fields do not use the special encapsulation method.
byte[4] . (root) Other
int max_failed_behavior_count ???
Type GUI LUA key Description

Difficulty Settings

This information is instead stored in the LUA structure at game.difficulty_settings, which is prototyped by DifficultySettings. These fields do not use the special encapsulation method noted above.

Type GUI LUA key Description
byte[10] difficulty_settings Difficulty Settings
byte recipe_difficulty Recipe difficulty. 0 for Normal, 1 for Expensive.
byte technology_difficulty Technology difficulty. 0 for Normal, 1 for Expensive.
double technology_price_multiplier Technology price multiplier.

Autoplace Control

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.

Map Gen Size

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.

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

Each of the values in a triplet (such as "low", "small", and "poor") are synonymous.