In other languages: Deutsch Português, Brasil Русский Українська 简体中文

Map generator: Difference between revisions

From Official Factorio Wiki
Jump to navigation Jump to search
(→‎Starting area: Major cleanup. Remember that, commas don't, have to, go after, every other, word. Do, you see, how this, could become, annoying?)
m (Updated to 0.15)
(32 intermediate revisions by 11 users not shown)
Line 1: Line 1:
{{Languages}}
{{Languages}}
Many players have problems to understand the Map Generator. This is a try to explain the basic function. But it must be also said, that a complete rework/rewrite or whatever is on the devs todo-list, but will take some more time. So the players must live with that, how it works, and if you understand the principle it is really not that bad.
World generation is, in short, a number of settings which define what the world will look like once generated. This can dramatically alter gameplay- a new player is advised to start with the default settings before deciding to change their world.


==How it works==
==How it works==
: [[File:MapGeneratorOverview.png]]
: [[File:MapGeneratorOverview.png]]
Basically you need to know, that the map generator generates most parts of the world with an algorithm, called "Perlin Noise". See below for details. You just need to know, that it works a bit like the waves in the sea.
A more technical explanation of world generation mechanics is that the map generator generates most parts of the world with an algorithm named "Perlin Noise". In short, it works a bit like the waves in the sea.


[[File:Water-ocean-waves-sea-high-resolution-pictures.jpg|thumb|left|300px]]


{{Clear}}


Everything above a defined level defines the existing (or non-existing) features of some type of terrain. The player should also know that the map is not generated at game start. Only the parts they see are generated, everything else is not. The map will be generated gradually as the player explores more terrain. See below for more technical details.


Everything above a defined level, defines the existing (or non-existing) of some type of terrain.
{{Clear}}


The following image shows an example how the world generator might create a new map.


You also need to know, that the map is not generated at game start. Only the parts you see are generated, everything else is not. The map will be generated, when you explore more terrain. See below for more technical details.
[[File:Default_123456789.png|thumb|left| World generation on default settings with map seed 123456789]]


<br clear=all>
<div style="clear: both"></div>


===The top row===
== Automatic presets ==
 
As of version 0.15, a preset may be chosen instead of manually configuring the generation. There are several options. Differences from the "default" preset are in bold parentheses.
 
{| class="wikitable"
|-
! Recipes/Tech                !! Default !! Rich Resources !! Marathon !! Dangerous !! Death World !! Rail World
|-
| Recipe difficulty          || Normal || Normal || Expensive || Normal || Expensive || Normal
|-
| Technology difficulty      || Normal || Normal || Expensive || Normal || Expensive || Normal
|-
| Technology price multiplier || 1 || 1 || 4'''(+3)''' || 1 || 4'''(+3)''' || 1
|-
|}
 
{| class="wikitable"
|-
! Enemy Expansion                  !! Default !! Rich Resources !! Marathon !! Dangerous !! Death World !! Rail World
|-
| Enabled                          || Yes || Yes || Yes || Yes || Yes || No'''(Yes)'''
|-
| Minimum chunks between new bases || 3 || 3 || 3 || 3 || 3 || 3
|-
| Maximum expansion distance      || 7 || 7 || 7 || 7 || 7 || 7
|-
| Minimum group size              || 5 || 5 || 5 || 5 || 5 || 5
|-
| Maximum group size              || 20 || 20 || 20 || 20 || 20 || 20
|-
| Minimum cooldown (Minutes)      || 4 || 4 || 4 || 4 || 4 || 4
|-
| Maximum cooldown (Minutes)      || 60 || 60 || 60 || 60 || 60 || 60
|-
|}
 
{| class="wikitable"
|-
! Enemy Evolution  !! Default !! Rich Resources !! Marathon !! Dangerous !! Death World !! Rail World
|-
| Destroy Factor  || 0.00200000 || 0.00200000 || 0.00200000 || 0.00200000 || 0.00200000 || 0.00200000
|-
| Enabled          || Yes || Yes || Yes || Yes || Yes || Yes
|-
| Pollution Factor || 0.00001500 || 0.00001500 || 0.00001500 || 0.00002000'''(+0.000005)''' || 0.00002000'''(+0.000005)''' || 0.00001500
|-
| Time Factor      || 0.00000400 || 0.00000400 || 0.00000400 || 0.00002000'''(+0.000016)''' || 0.00002000'''(+0.000016)''' || 0.00000200'''(-0.000002)'''
|-
|}
 
 
{| class="wikitable"
|-
! Pollution                !! Default !! Rich Resources !! Marathon !! Dangerous !! Death World !! Rail World
|-
| Absorbed per damaged tree || 500 || 500 || 500 || 500 || 500 || 500
|-
| Diffusion Ratio          || 2% || 2% || 2% || 2% || 2% || 2%
|-
| Dissipation Rate          || 1 || 1 || 1 || 1 || 1 || 1
|-
| Enabled                  || Yes || Yes || Yes || Yes || Yes || Yes
|-
| Minimum Damage to trees  || 3500 || 3500 || 3500 || 3500 || 3500 || 3500
|-
|}
 
 
{| class="wikitable"
|-
! Resource        !! Default !! Rich Resources !! Marathon !! Dangerous !! Death World !! Rail World
|-
| Coal Frequency  || Normal || Normal || Normal || Normal || Normal || Very Low
|-
| Coal Richness    || Regular || Very Good'''(Regular)''' || Regular || Regular || Regular || Regular
|-
| Coal Size        || Medium || Medium || Medium || Medium || Medium || Big'''(Medium)'''
|-
| Copper Frequency || Normal || Normal || Normal || Normal || Normal || Very Low'''(Normal)'''
|-
| Copper Richness  || Regular || Very Good'''(Regular)''' || Regular || Regular || Regular || Regular
|-
| Copper Size      || Medium || Medium || Medium || Medium || Medium || Big'''(Medium)'''
|-
| Crude Frequency  || Normal || Normal || Normal || Normal || Normal || Very Low'''(Normal)'''
|-
| Crude Richness  || Regular || Very Good'''(Regular)''' || Regular || Regular || Regular || Regular
|-
| Crude Size      || Medium || Medium || Medium || Medium || Medium || Big'''(Medium)'''
|-
| Enemy Bases Frequency || Normal || Normal || Normal || Very High'''(Normal)''' || Very High'''(Normal)''' || Very Low'''(Normal)'''
|-
| Enemy Bases Richness || Regular || Regular || Regular || Regular || Regular || Regular
|-
| Enemy Bases Size || Medium || Medium || Medium || Medium || Medium || Small'''(Medium)'''
|-
| Iron Frequency  || Normal || Normal || Normal || Normal || Normal || Very Low'''(Normal)'''
|-
| Iron Richness    || Regular || Very Good'''(Regular)''' || Regular || Regular || Regular || Regular
|-
| Iron Size        || Medium || Medium || Medium || Medium || Medium || Big'''(Medium)'''
|-
| Starting Area    || Medium || Medium || Medium || Medium || Medium || Medium
|-
| Stone Frequency  || Normal || Normal || Normal || Normal || Normal || Very Low'''(Normal)'''
|-
| Stone Richness  || Regular || Very Good'''(Regular)''' || Regular || Regular || Regular || Regular
|-
| Stone Size      || Medium || Medium || Medium || Medium || Medium || Big'''(Medium)'''
|-
| Uranium Frequency || Normal || Normal || Normal || Normal || Normal || Very Low'''(Normal)'''
|-
| Uranium Richness || Regular || Very Good'''(Regular)''' || Regular || Regular || Regular || Regular
|-
| Uranium Size    || Medium || Medium || Medium || Medium || Medium || Medium
|-
| Water Frequency  || Normal || Normal || Normal || Normal || Normal || Very Low'''(Normal)'''
|-
| Water Size      || Medium || Medium || Medium || Medium || Medium || Big'''(Medium)'''
|-
|}
 
== Manual config ==
 
===Settings on the top row===
====Frequency====
====Frequency====
This is '''not''', how frequent ore, coal, oil etc. is.


This defines - to keep in this picture - the wavelength of the wave-generators.
This is '''not''', how frequent ore, coal, oil etc. is, instead determining the number of individual deposits the player will encounter.


Frequency doesn't modify the amount of resources on a tile. If you increase frequency then each of the deposists has less resources in total (because it covers less area), but per tile of a deposit there will be the same number of resources.
This defines the wavelength of the wave-generators used by the Perlin Noise algorithm above, but not the total size of all the waves. This means that frequency doesn't modify the amount of resources on a tile, instead modifying the area of each deposit and the number of deposits. Additionally, changing frequency doesn't affect the average amount of resources in a limited map, only their distribution.
Also changing frequency doesn't affect the average ammount of resources in a (large) map, only their distribution.


''High frequency'': For Terrain segmentation it means: Many different types of terrain, forest, dessert and swamp could be within 10 tiles or less. For resources: Many, but very small patches of resources.
If resource frequency is increased, each of the deposits is smaller and has less resources in total (because it covers less area) and deposits are very common. If resource frequency is decreased, the deposits are larger but more rare. This also causes enemy bases to appear more often using the same distribution rules as ores - however, this can lead to rapid [[Enemies|enemy]] expansion due to the much higher number of nest clusters.


''Low frequency'': For Terrain segmentation it means: Big landscapes, vast areas only with forests. For resources: Not many, but if you found one very big patches of resources.
====Size====


In short: Low terrain segmentation means large areas with same terrain. High segmentation is the contrary, the terrain changes nature often. Typically huge forests vs. lots of small woods.
This defines the size of generated ore patches and water through defining "levels." It increases the average diameter of ore patches and lakes, allowing one to adjust the size of both of these.


====Size====
It's as simple as it seems- Small size would mean small ore patches and water masses, large means large ore patches and water masses. Note that this is effected by frequency, though it is presumably able to increase the total ore and water of the world where frequency simply re-balances it.
This defines the "level" (see below!): Everything above that defined level, defines the existing (or non-existing) of some type of terrain.
 
Finally, this causes [[Enemies|enemy bases]] to spawn larger, though bases created through the "natural process" of expansion are going to adhere to different rules.
 
The following table shows how the frequency and size settings affects the generation of ore patches. For more detail, open the images in a new tab.
 
{| class="wikitable"
|+Generation of iron patches on different frequency and size settings
!Frequency \ Size
!Very small
!Small
!Medium
!Big
!Very big
 
|-
!Very low
|[[File:Iron_freq_very_low_size_very_small.png|frameless|150x150px]]
|[[File:Iron_freq_very_low_size_small.png|frameless|150x150px]]
|[[File:Iron_freq_very_low_size_medium.png|frameless|150x150px]]
|[[File:Iron_freq_very_low_size_big.png|frameless|150x150px]]
|[[File:Iron_freq_very_low_size_very_big.png|frameless|150x150px]]
 
|-
!Low
|[[File:Iron_freq_low_size_very_small.png|frameless|150x150px]]
|[[File:Iron_freq_low_size_small.png|frameless|150x150px]]
|[[File:Iron_freq_low_size_medium.png|frameless|150x150px]]
|[[File:Iron_freq_low_size_big.png|frameless|150x150px]]
|[[File:Iron_freq_low_size_very_big.png|frameless|150x150px]]
 
|-
!Normal
|[[File:Iron_freq_normal_size_very_small.png|frameless|150x150px]]
|[[File:Iron_freq_normal_size_small.png|frameless|150x150px]]
|[[File:Iron_freq_normal_size_medium.png|frameless|150x150px]]
|[[File:Iron_freq_normal_size_big.png|frameless|150x150px]]
|[[File:Iron_freq_normal_size_very_big.png|frameless|150x150px]]
 
|-
!High
|[[File:Iron_freq_high_size_very_small.png|frameless|150x150px]]
|[[File:Iron_freq_high_size_small.png|frameless|150x150px]]
|[[File:Iron_freq_high_size_medium.png|frameless|150x150px]]
|[[File:Iron_freq_high_size_big.png|frameless|150x150px]]
|[[File:Iron_freq_high_size_very_big.png|frameless|150x150px]]


That means, that the same shaped wave, could look completely different, if you shift this level up and down, but in the end you increase or decrease the average diameter of an ore-patch, of lakes.
|-
!Very high
|[[File:Iron_freq_very_high_size_very_small.png|frameless|150x150px]]
|[[File:Iron_freq_very_high_size_small.png|frameless|150x150px]]
|[[File:Iron_freq_very_high_size_medium.png|frameless|150x150px]]
|[[File:Iron_freq_very_high_size_big.png|frameless|150x150px]]
|[[File:Iron_freq_very_high_size_very_big.png|frameless|150x150px]]


With small size you get small ore-patches, with big size you get big ore patches. It is a bit dependent on the frequency, of course.
|}


====Richness====
====Richness====
This defines the average wave-height. A high wave means: Much resources per [[Tile]].


If you put this to high for Enemy bases, you get as result for killing a "rich" [[Enemies#Spawners]] much more [[Alien artifact]]s.
This defines the actual content of every ore patch and oil field. Resource field richness increases by distance.
 
{| class="wikitable"
|+Resources in ore patches on different richness settings
!Very poor
!Poor
!Regular
!Rich
!Very rich
 
|-
|[[File:Iron_richness_very_poor.jpg|150x150px|thumb|Resources to mine: 22k]]
|[[File:Iron_richness_poor.jpg|150x150px|thumb|Resources to mine: 32k]]
|[[File:Iron_richness_regular.jpg|150x150px|thumb|Resources to mine: 45k]]
|[[File:Iron_richness_good.jpg|150x150px|thumb|Resources to mine: 64k]]
|[[File:Iron_richness_very_good.jpg|150x150px|thumb|Resources to mine: 90k]]
 
|}


===The left column===
===The left column===
* Terrain segmentation: How often the terrain changes. There are some different types of terrain. This depends also the water.
 
* Water: How big the lakes get. They can be really big, can take you an hour or more to surround by car. This influences also the chance, to be fully surrounded by water!
* Water: How [[water]] is generated on each map.
* Copper, Stone, Coal, Crude oil: Needed resources. See above about Frequency, size and richness.
* Copper, Stone, Coal, Crude oil: Resources required to progress in the game. See above for more detailed explanations about each of these changes.
* Enemy bases: How many and how big could the starting enemy bases. Note, that the enemies develop and build new villages during the game.
* Enemy bases: How many and how large starting bases are. Note that new bases are created over time, making low enemy base counts somewhat less significant.


===Starting area===
===Starting area===
This is A special value. It defines a special starting area around the central coordinates. This area will have different ore frequency, etc. from the rest of the map. The settings of this area usually guarantee better starting-conditions, although it may very by your map seed.


Note: if you set "size" here very low or none, the map generator can generate maps that are impossible to survive. You might start on a very small island, or on a big island without resources, or even in the middle of a biter nest and many more issues.
This is a value defining a special area around the central coordinates of the map which will have different ore frequency, etc, from the rest of the map. Generally, this results in at least one confirmed ore source, always results in a water source, and always removes biter nests from spawning for an area around spawn. The settings of this area usually guarantee better starting conditions, although the player may choose to make this area small to increase the challenge of the game.


It is generally a good idea for you to explore a bit outside this area before you begin to build. It is not necessarily a bug if the map generator generates maps that are almost completely useless.
It is generally a good idea for the player to explore a bit outside this area before they begin to build. While this area will almost always appear very fertile, it's possible that map generation will have made a situation where it is impossible to beat the game, such as missing [[oil]], too many biters to defend, etc.
 
{| class="wikitable"
|+World generations on different starting area settings
!Very small
!Small
!Medium
!Big
!Very big
 
|-
|[[File:Starting_area_very_small.png|frameless|150x150px]]
|[[File:Starting_area_small.png|frameless|150x150px]]
|[[File:Starting_area_medium.png|frameless|150x150px]]
|[[File:Starting_area_big.png|frameless|150x150px]]
|[[File:Starting_area_very_big.png|frameless|150x150px]]
|}


===Peaceful mode===
===Peaceful mode===
The [[Enemies]] don't begin to fight, only if you hit them. This can be also switched on during the game, look into [[Console/Lua_commands#Useful_commands_.28cheats.29|Console commands]].
The [[Enemies]] don't begin fights, only responding if the player hits them. This can be also switched on during the game- look into [[Console|Console commands]].


===Map-width and -height===
===Map-width and -height===
If you limit the width and/or height you can generate maps with limited width and height. See below "Generating when exploring".
If the player limits the width and/or height they may generate maps with finite resources and area. This is recommended for multiplayer servers running on weaker machines or players seeking extra challenge. Another option is to make the world infinite in only one axis, this is commonly referred to as a ''ribbon world''.


===Map seed / Map Exchange String===
===Map seed / Map Exchange String===


; Map Seed
Definitions and terminology:
: Random number generator seed
 
; Map Exchange String
; Map Seed: Random number generator seed
: All settings for the map creation (Map Seed, settings for resources, settings for size, etc.)
; Map Exchange String: All settings for the map creation (Map Seed, settings for resources, settings for size, etc.)


====Map Seed====
====Map Seed====
This is the starting value for the random number generator, that Factorio uses for anything in the game. (Random number in Factorio and on computers in generally aren't really random, they are calculated with complicated algorithmns, that need a seed as startng value, see http://en.wikipedia.org/wiki/Random_seed).
This is the starting value for the random number generator that Factorio uses for generating the world. Know that 'random number' is really a misnomer in Factorio and on computers in general, as they aren't really random, instead being calculated with complicated algorithms that require a seed as starting value (For more detail, see http://en.wikipedia.org/wiki/Random_seed).


So even with the same map-exchange string, but different map seed the map could look quite differently. But it might also be quite similar.
So even with the same map-exchange string but a different seed maps can change dramatically, or appear very similar. It's up to chance. In order to get a true copy of a world, giving the map-exchange string and allowing the string to fill out the seed is important.


====Map Exchange String====
====Map Exchange String====
A string, that looks for example like so:  
A string generally looks like so:
 
  >>>AAALABAABgADAwYAAAAEAAAAY29hbAMDAgoAAABjb3BwZXItb3Jl
  >>>AAALABAABgADAwYAAAAEAAAAY29hbAMDAgoAAABjb3BwZXItb3Jl
  AwMCCQAAAGNydWRlLW9pbAMDAgoAAABlbmVteS1iYXNlAwMCCAAAAGl
  AwMCCQAAAGNydWRlLW9pbAMDAgoAAABlbmVteS1iYXNlAwMCCAAAAGl
Line 82: Line 288:
  ADAFR8w0Q=<<<
  ADAFR8w0Q=<<<


There is a thread for exchanging new strings: http://www.factorioforums.com/forum/viewtopic.php?f=36&t=5807
It is a string of good length that begins with >>> and ends with <<<. Many facilities exist within the community for sharing exchange strings. The map exchange string can be used in the map-generator: there is an extra field where the player can paste this string into. On windows computers, this may be done by selecting a string, right-clicking or pressing Control + C, then put it into the string field for the world generator with Control + V.


=====Where can I use this string?=====
If you wish to retrieve the map-exchange string from your world:
It can be used in the map-generator: there is an extra field where you can paste this string into. (Control-V under windows)


=====Where can I get this string from?=====
In the Load Game dialog select the game whose string you want, then click the Map Exchange String button in the lower left corner. When the string pops up, highlight it with your mouse and press Control-C to copy it. (Command-C on Mac.) You can now paste it in the map generator to create a copy of that world, or send it to a friend.
In the Load Game dialog, select the game whose string you want, then click the Map Exchange String button in the lower left corner. When the string pops up, highlight it with your mouse and press Control-C to copy it. (Command-C on Mac.) You can now paste it in the map generator or send it to a friend.
 
For a technical description of the map exchange string, see [[Map Exchange String Format]].


==Generation==
==Generation==
The map generator (world generator) is based on modificated [http://en.m.wikipedia.org/wiki/Perlin_noise Perlin noise algorithm].
A [[Types/AutoplaceSpecification#Noise|more detailed description]] is in the API docu.


From the [http://www.factorioforums.com/forum/viewtopic.php?f=18&t=8016&p=63691#p63561 article, which describes the generation]:
The map generator (world generator) is based on a modified [http://en.wikipedia.org/wiki/Perlin_noise Perlin noise algorithm].
A [http://lua-api.factorio.com/latest/Concepts.html#AutoplaceSpecification more detailed description] is in the API documentation.
 
From the [http://www.factorioforums.com/forum/viewtopic.php?f=18&t=8016&p=63691#p63561 article which describes the generation]:
: [[File:Factorio-Perlin-Noise.png]]
: [[File:Factorio-Perlin-Noise.png]]
Top: Normal settings, Middle: The same, but with higher '''frequency''' (note the same curve, but more condensed shape), Down: Same as top, but higher level = increased '''size'''.
Top: Normal settings, Middle: The same, but with higher '''frequency''' (note the same curve, but more condensed shape), Down: Same as top, but higher level = increased '''size'''.


The blue wavy line is an internal noise function, black line is a "level" that is used to determine resource placement, red lines are actual placed resources.
The blue wavy line is an internal noise function, black line is a "level" that is used to determine resource placement, red lines are actual placed resources. The high frequency refers mainly to the noise function. Increasing the frequency increases count of resource fields and decreases their size and distance between them. This mechanism is used all through the map generation in factorio, with some adjustments. The map generator works tile by tile, so the resources are placed on a tile x if f(x) > 0. The amount of resources on the tile is given by f(x) * richness.
The high frequency refers mainly to the noise function. Increasing the frequency increases count of resource fields and decreases their size and distance between them.
 
==Generating new Chunks==
 
A map is endless by default, though its size can be limited by height and width - see above. Because it is technically endless, the whole map isn't generated from the start. A new [[Chunk]] of map is generated only when needed, similar to other procedurally generated world games.
 
===Generating Invisible Chunks (Fog of War)===
 
Outside of the visible chunk area, an invisible area of about 3 chunks wide is generated, as a preloading mechanism, and for biters to be able to see the player. Invisible chunks are also generated if pollution is generated heavily; the game generates (invisible) chunks as it needs to spread the pollution into the area.
 
===Charting (Make Invisible Chunks Visible on Map)===
 
As long as a chunk is invisible, the part of the players map stays black. This changes when a chunk is '''[[Radar#Charting|charted]]''', which means when it is "touched" by radar. Either the players internal radar, which is always available and continually charts chunks around the player, or the '''[[Radar]]''' entity. When a visible chunk is generated there might be other chunks also invisibly generated.
 
An invisible chunk is eventually not made visible, even if you are so close, that you are able to see it in the character view (a black fog of war). This is, because of the above rule: a chunk is made visible, if it is touched by radar. Not character visibility. The players radar (or any radar) needs to be in range of that chunk to make it visible.
 
 
=== Exploring ===
 
If the player arrives at the current visible borders the needed chunks are generated. As the [[player]] explores, a radius of about 3 chunks are continually loaded around them. As this can take a while on lower end machines, it is possible to outrun the world generator and end up in 'limbo' with no entities around the player. Staying still for a while will allow the generator to catch up.
 
=== Maximum Map Size and used Memory===
 
The map size is limited to 2000 x 2000 kilometers (a quadrant with 2,000,000 tiles side-length, an area of 4,000,000,000,000 quadrant-tiles). This is between the size of India and Australia. It would take around 240 [[game-second|game-minutes]] (=4 hours) by train to reach that border from the center. This means that the world is essentially endless.


This mechanism is used all through the map generation in factorio, with some adjustments. The map generator works tile by tile, so the resources are placed on a tile x if f(x) > 0. The amount of resources on the tile is given by f(x) * richness.
Because only chunks are generated around the area that is revealed by radar, it is with current computers possible to reach that border. This is, because the needed memory size of the map is limited only by the generated number of chunks in the game. Which is not so much if you allocate just a small stripe of land.


==Generating when exploring==
The generated chunks are mapped and stored in the player's RAM, which is the limiting factor.
A map is normally endless (if not other defined with limits, see "Map-width and -height" above!).


Because of that, the whole map isn't generated from start. A new [[Chunk]] of map is generated only, when explored. This means you come to the current visible borders and then the needed chunks are generated. It makes no difference, if you discover that, or if it is discovered by [[Radar]] or the game (silently) discovers some (hidden) chunks for some biter village.
== History ==


For endless maps, the size is limited only by your computers memory. Which is quite big. If a tile is one square meter, and you have 8 GiB free memory you can discover an area about the size of the state of Lichtenstein. :) (quite raw estimation!)
{{history|0.15.0|
* The world generator now has select-able presets.
}}


But you can also generate maps with '''limited width and height.''' Note, that you can also limit only the width or only the height, so you can generate "stripes" of land. There are players, that love to play maps with a height of only 20 tiles (or less).
{{history|0.13.0|
* Map generator algorithm changed, further resource field now have greater richness.
}}


Note also, that everything around the map-limits (end of world) '''is just water'''. You can place a [[Pump]] at the edge of a map and it will suck water out of nothing.
== See also ==


==See also==
* [http://www.factorioforums.com/forum/viewtopic.php?f=6&t=7924&p=63517#p63517 Some technical info]
* [http://www.factorioforums.com/forum/viewtopic.php?f=5&t=7331 The Map Generator hates your guts, or dude where is my coal?]
* [http://www.factorioforums.com/forum/viewtopic.php?f=6&t=7924&p=63517#p63517 Some technically info]
* [http://www.factorioforums.com/forum/viewtopic.php?f=6&t=8624&p=69156#p69156 Temperature based biome-model] (how trees are placed)
* [http://www.factorioforums.com/forum/viewtopic.php?f=6&t=8624&p=69156#p69156 Temperature based biome-model] (how trees are placed)
* [http://www.factorioforums.com/forum/viewtopic.php?f=6&t=1593 Thread about definition of map map exchange string/seed]
* [http://www.factorioforums.com/forum/viewtopic.php?f=6&t=1593 Thread about definition of map map exchange string/seed]
* [http://www.factorioforums.com/forum/viewtopic.php?f=5&t=6447&p=50336#p50318 Definition of string and seed]
* [http://www.factorioforums.com/forum/viewtopic.php?f=5&t=6447&p=50336#p50318 Definition of string and seed]

Revision as of 20:32, 12 August 2017

World generation is, in short, a number of settings which define what the world will look like once generated. This can dramatically alter gameplay- a new player is advised to start with the default settings before deciding to change their world.

How it works

MapGeneratorOverview.png

A more technical explanation of world generation mechanics is that the map generator generates most parts of the world with an algorithm named "Perlin Noise". In short, it works a bit like the waves in the sea.


Everything above a defined level defines the existing (or non-existing) features of some type of terrain. The player should also know that the map is not generated at game start. Only the parts they see are generated, everything else is not. The map will be generated gradually as the player explores more terrain. See below for more technical details.

The following image shows an example how the world generator might create a new map.

World generation on default settings with map seed 123456789

Automatic presets

As of version 0.15, a preset may be chosen instead of manually configuring the generation. There are several options. Differences from the "default" preset are in bold parentheses.

Recipes/Tech Default Rich Resources Marathon Dangerous Death World Rail World
Recipe difficulty Normal Normal Expensive Normal Expensive Normal
Technology difficulty Normal Normal Expensive Normal Expensive Normal
Technology price multiplier 1 1 4(+3) 1 4(+3) 1
Enemy Expansion Default Rich Resources Marathon Dangerous Death World Rail World
Enabled Yes Yes Yes Yes Yes No(Yes)
Minimum chunks between new bases 3 3 3 3 3 3
Maximum expansion distance 7 7 7 7 7 7
Minimum group size 5 5 5 5 5 5
Maximum group size 20 20 20 20 20 20
Minimum cooldown (Minutes) 4 4 4 4 4 4
Maximum cooldown (Minutes) 60 60 60 60 60 60
Enemy Evolution Default Rich Resources Marathon Dangerous Death World Rail World
Destroy Factor 0.00200000 0.00200000 0.00200000 0.00200000 0.00200000 0.00200000
Enabled Yes Yes Yes Yes Yes Yes
Pollution Factor 0.00001500 0.00001500 0.00001500 0.00002000(+0.000005) 0.00002000(+0.000005) 0.00001500
Time Factor 0.00000400 0.00000400 0.00000400 0.00002000(+0.000016) 0.00002000(+0.000016) 0.00000200(-0.000002)


Pollution Default Rich Resources Marathon Dangerous Death World Rail World
Absorbed per damaged tree 500 500 500 500 500 500
Diffusion Ratio 2% 2% 2% 2% 2% 2%
Dissipation Rate 1 1 1 1 1 1
Enabled Yes Yes Yes Yes Yes Yes
Minimum Damage to trees 3500 3500 3500 3500 3500 3500


Resource Default Rich Resources Marathon Dangerous Death World Rail World
Coal Frequency Normal Normal Normal Normal Normal Very Low
Coal Richness Regular Very Good(Regular) Regular Regular Regular Regular
Coal Size Medium Medium Medium Medium Medium Big(Medium)
Copper Frequency Normal Normal Normal Normal Normal Very Low(Normal)
Copper Richness Regular Very Good(Regular) Regular Regular Regular Regular
Copper Size Medium Medium Medium Medium Medium Big(Medium)
Crude Frequency Normal Normal Normal Normal Normal Very Low(Normal)
Crude Richness Regular Very Good(Regular) Regular Regular Regular Regular
Crude Size Medium Medium Medium Medium Medium Big(Medium)
Enemy Bases Frequency Normal Normal Normal Very High(Normal) Very High(Normal) Very Low(Normal)
Enemy Bases Richness Regular Regular Regular Regular Regular Regular
Enemy Bases Size Medium Medium Medium Medium Medium Small(Medium)
Iron Frequency Normal Normal Normal Normal Normal Very Low(Normal)
Iron Richness Regular Very Good(Regular) Regular Regular Regular Regular
Iron Size Medium Medium Medium Medium Medium Big(Medium)
Starting Area Medium Medium Medium Medium Medium Medium
Stone Frequency Normal Normal Normal Normal Normal Very Low(Normal)
Stone Richness Regular Very Good(Regular) Regular Regular Regular Regular
Stone Size Medium Medium Medium Medium Medium Big(Medium)
Uranium Frequency Normal Normal Normal Normal Normal Very Low(Normal)
Uranium Richness Regular Very Good(Regular) Regular Regular Regular Regular
Uranium Size Medium Medium Medium Medium Medium Medium
Water Frequency Normal Normal Normal Normal Normal Very Low(Normal)
Water Size Medium Medium Medium Medium Medium Big(Medium)

Manual config

Settings on the top row

Frequency

This is not, how frequent ore, coal, oil etc. is, instead determining the number of individual deposits the player will encounter.

This defines the wavelength of the wave-generators used by the Perlin Noise algorithm above, but not the total size of all the waves. This means that frequency doesn't modify the amount of resources on a tile, instead modifying the area of each deposit and the number of deposits. Additionally, changing frequency doesn't affect the average amount of resources in a limited map, only their distribution.

If resource frequency is increased, each of the deposits is smaller and has less resources in total (because it covers less area) and deposits are very common. If resource frequency is decreased, the deposits are larger but more rare. This also causes enemy bases to appear more often using the same distribution rules as ores - however, this can lead to rapid enemy expansion due to the much higher number of nest clusters.

Size

This defines the size of generated ore patches and water through defining "levels." It increases the average diameter of ore patches and lakes, allowing one to adjust the size of both of these.

It's as simple as it seems- Small size would mean small ore patches and water masses, large means large ore patches and water masses. Note that this is effected by frequency, though it is presumably able to increase the total ore and water of the world where frequency simply re-balances it.

Finally, this causes enemy bases to spawn larger, though bases created through the "natural process" of expansion are going to adhere to different rules.

The following table shows how the frequency and size settings affects the generation of ore patches. For more detail, open the images in a new tab.

Generation of iron patches on different frequency and size settings
Frequency \ Size Very small Small Medium Big Very big
Very low Iron freq very low size very small.png Iron freq very low size small.png Iron freq very low size medium.png Iron freq very low size big.png Iron freq very low size very big.png
Low Iron freq low size very small.png Iron freq low size small.png Iron freq low size medium.png Iron freq low size big.png Iron freq low size very big.png
Normal Iron freq normal size very small.png Iron freq normal size small.png Iron freq normal size medium.png Iron freq normal size big.png Iron freq normal size very big.png
High Iron freq high size very small.png Iron freq high size small.png Iron freq high size medium.png Iron freq high size big.png Iron freq high size very big.png
Very high Iron freq very high size very small.png Iron freq very high size small.png Iron freq very high size medium.png Iron freq very high size big.png Iron freq very high size very big.png

Richness

This defines the actual content of every ore patch and oil field. Resource field richness increases by distance.

Resources in ore patches on different richness settings
Very poor Poor Regular Rich Very rich
Resources to mine: 22k
Resources to mine: 32k
Resources to mine: 45k
Resources to mine: 64k
Resources to mine: 90k

The left column

  • Water: How water is generated on each map.
  • Copper, Stone, Coal, Crude oil: Resources required to progress in the game. See above for more detailed explanations about each of these changes.
  • Enemy bases: How many and how large starting bases are. Note that new bases are created over time, making low enemy base counts somewhat less significant.

Starting area

This is a value defining a special area around the central coordinates of the map which will have different ore frequency, etc, from the rest of the map. Generally, this results in at least one confirmed ore source, always results in a water source, and always removes biter nests from spawning for an area around spawn. The settings of this area usually guarantee better starting conditions, although the player may choose to make this area small to increase the challenge of the game.

It is generally a good idea for the player to explore a bit outside this area before they begin to build. While this area will almost always appear very fertile, it's possible that map generation will have made a situation where it is impossible to beat the game, such as missing oil, too many biters to defend, etc.

World generations on different starting area settings
Very small Small Medium Big Very big
Starting area very small.png Starting area small.png Starting area medium.png Starting area big.png Starting area very big.png

Peaceful mode

The Enemies don't begin fights, only responding if the player hits them. This can be also switched on during the game- look into Console commands.

Map-width and -height

If the player limits the width and/or height they may generate maps with finite resources and area. This is recommended for multiplayer servers running on weaker machines or players seeking extra challenge. Another option is to make the world infinite in only one axis, this is commonly referred to as a ribbon world.

Map seed / Map Exchange String

Definitions and terminology:

Map Seed
Random number generator seed
Map Exchange String
All settings for the map creation (Map Seed, settings for resources, settings for size, etc.)

Map Seed

This is the starting value for the random number generator that Factorio uses for generating the world. Know that 'random number' is really a misnomer in Factorio and on computers in general, as they aren't really random, instead being calculated with complicated algorithms that require a seed as starting value (For more detail, see http://en.wikipedia.org/wiki/Random_seed).

So even with the same map-exchange string but a different seed maps can change dramatically, or appear very similar. It's up to chance. In order to get a true copy of a world, giving the map-exchange string and allowing the string to fill out the seed is important.

Map Exchange String

A string generally looks like so:

>>>AAALABAABgADAwYAAAAEAAAAY29hbAMDAgoAAABjb3BwZXItb3Jl
AwMCCQAAAGNydWRlLW9pbAMDAgoAAABlbmVteS1iYXNlAwMCCAAAAGl
yb24tb3JlAwMCBQAAAHN0b25lAwMCORcrDUQ7AACMCwAAAAAAAAAAAA
ADAFR8w0Q=<<<

It is a string of good length that begins with >>> and ends with <<<. Many facilities exist within the community for sharing exchange strings. The map exchange string can be used in the map-generator: there is an extra field where the player can paste this string into. On windows computers, this may be done by selecting a string, right-clicking or pressing Control + C, then put it into the string field for the world generator with Control + V.

If you wish to retrieve the map-exchange string from your world:

In the Load Game dialog select the game whose string you want, then click the Map Exchange String button in the lower left corner. When the string pops up, highlight it with your mouse and press Control-C to copy it. (Command-C on Mac.) You can now paste it in the map generator to create a copy of that world, or send it to a friend.

For a technical description of the map exchange string, see Map Exchange String Format.

Generation

The map generator (world generator) is based on a modified Perlin noise algorithm. A more detailed description is in the API documentation.

From the article which describes the generation:

Factorio-Perlin-Noise.png

Top: Normal settings, Middle: The same, but with higher frequency (note the same curve, but more condensed shape), Down: Same as top, but higher level = increased size.

The blue wavy line is an internal noise function, black line is a "level" that is used to determine resource placement, red lines are actual placed resources. The high frequency refers mainly to the noise function. Increasing the frequency increases count of resource fields and decreases their size and distance between them. This mechanism is used all through the map generation in factorio, with some adjustments. The map generator works tile by tile, so the resources are placed on a tile x if f(x) > 0. The amount of resources on the tile is given by f(x) * richness.

Generating new Chunks

A map is endless by default, though its size can be limited by height and width - see above. Because it is technically endless, the whole map isn't generated from the start. A new Chunk of map is generated only when needed, similar to other procedurally generated world games.

Generating Invisible Chunks (Fog of War)

Outside of the visible chunk area, an invisible area of about 3 chunks wide is generated, as a preloading mechanism, and for biters to be able to see the player. Invisible chunks are also generated if pollution is generated heavily; the game generates (invisible) chunks as it needs to spread the pollution into the area.

Charting (Make Invisible Chunks Visible on Map)

As long as a chunk is invisible, the part of the players map stays black. This changes when a chunk is charted, which means when it is "touched" by radar. Either the players internal radar, which is always available and continually charts chunks around the player, or the Radar entity. When a visible chunk is generated there might be other chunks also invisibly generated.

An invisible chunk is eventually not made visible, even if you are so close, that you are able to see it in the character view (a black fog of war). This is, because of the above rule: a chunk is made visible, if it is touched by radar. Not character visibility. The players radar (or any radar) needs to be in range of that chunk to make it visible.


Exploring

If the player arrives at the current visible borders the needed chunks are generated. As the player explores, a radius of about 3 chunks are continually loaded around them. As this can take a while on lower end machines, it is possible to outrun the world generator and end up in 'limbo' with no entities around the player. Staying still for a while will allow the generator to catch up.

Maximum Map Size and used Memory

The map size is limited to 2000 x 2000 kilometers (a quadrant with 2,000,000 tiles side-length, an area of 4,000,000,000,000 quadrant-tiles). This is between the size of India and Australia. It would take around 240 game-minutes (=4 hours) by train to reach that border from the center. This means that the world is essentially endless.

Because only chunks are generated around the area that is revealed by radar, it is with current computers possible to reach that border. This is, because the needed memory size of the map is limited only by the generated number of chunks in the game. Which is not so much if you allocate just a small stripe of land.

The generated chunks are mapped and stored in the player's RAM, which is the limiting factor.

History

  • 0.15.0:
    • The world generator now has select-able presets.
  • 0.13.0:
    • Map generator algorithm changed, further resource field now have greater richness.

See also