Autoplace specification is used to determine which entities are placed when generating map. Currently it is used for enemy bases, resources and other entities (trees, fishes, ...).
- 1 General structure
- 2 Properties
- 2.1 sharpness
- 2.2 max_probability
- 2.3 tile_restriction
- 2.4 richness_base
- 2.5 richness_multiplier
- 2.6 richness_multiplier_distance_bonus
- 2.7 control
- 2.8 force
- 2.9 order
- 2.10 size_control_multiplier
- 2.11 random_probability_penalty
- 2.12 peaks
- 2.13 coverage
- 2.14 starting_area_amount
- 2.15 starting_area_size
- 3 Autoplace Peaks
- 4 Dimensions
- 5 Influence Calculation
- 6 Probability_Calculation
- 7 Richness_Calculation
- 8 Noise
- 9 Controls
Autoplace specification consists of a set of peaks that describe conditions for placing the entity and several parameters.
Parameter of the sharpness filter for post-processing probability of entity placement. Value of 0 disables the filter, with value 1, the filter is a step function centered around 0.5. See Probability Calculation.
Multiplier for output of the sharpness filter. See #Probability_Calculation.
Type: list of specifications, see below
Default: empty list
Restricts surfaces or transition the entity can appear on.
Bonus to richness multiplier per tile of distance from starting point. See #Richness_Calculation.
ID of autoplace control that applies to this entity.
Force of the placed entity. One of "enemy", "player" or "neutral". Only matters for EntityWithForce or EntityWithOwner.
Order for placing the entity (has no effect when placing tiles). Entities whose order compares less are placed earlier (this influences placing multiple entities which collide with itself), from entities with equal order string only one with the highest probability is placed.
Default: Magic. Based on sum of influences of noises.
This value times the size control setting is added to influence right before sharpness filter. Very small has a multiplier of -1, very big has 1.5. This value is replaced by ```coverage``` parameter in 0.13.0.
A random value between 0 and this number is subtracted from a probability after sharpness filter. Only works for entities. See #Probability_Calculation.
Type: list of #Autoplace Peaks
If this property is missing, then the whole autoplace specification is interpreted as a single peak
Default: Calculated from existing peaks.
Sets a fraction of surface that should be covered by this item.
Internally this adds an additive influence modifier, so that expected fraction of tiles where total influence > 0.5 (the threshold for sharpness filter) equals the parameter.
Because of the autoplace system's complexity, this is only accurate on simple rules and does some simplification on the more complex ones:
- There is always just one combination of tile properties (see #Dimensions) for which the coverage is calculated. This combination is given by a first *_optimal value encountered of each type other than starting_area and tier_from_start. Starting_area value is fixed to 0 and tier_from_start to 4.
- min_influence and max_influence are completely ignored.
If this value is non zero, influence of this entity will be calculated differently in starting area: For each entity with this parameter a position in starting area is selected and a blob is placed centered on this position. The central tile of this blob will have approximately amount of resources selected by this value.
See #starting_area_amount. Controls approximate radius of the blob in tiles.
Influence multiplier. See #Influence_Calculation.
Default: min double
Minimal influence (after all calculations) of current peak. See #Influence Calculation.
Default: max double
Maximal influence (after all calculations) of current peak. See #Influence Calculation.
Bonus for influence multiplier when calculating richness. See #Influence Calculation.
Persistence of the noise. See #Noise.
Difference between number of octaves of the world and of the noise. See #Noise
Optimal value of a tile property. If the property is close to this value, peak influence is 1. See #Dimensions.
Distance from the optimal parameters that is still considered optimal. See #Dimensions.
Distance from the optimal parameters that get influence of -1. See #Dimensions.
Default: max double
Limit distance from the optimum on a single (positive) side. This is pure magic. See #Dimensions.
Peaks may reference a number of tile properties, specifying range of optimal values of the property and a range over which it is interpolated to no effect.
Currently the properties are:
- starting_area_weight -- Number from 1 (inside starting area) to 0 (not influenced by starting area).
- roughness -- a number between -1.5 and 1.5 which describe roughness of the terrain. In 0.7.2 roughness is visible only on the edges of lakes (smooth vs jagged).
- elevation -- elevation of the terrain, up to 5000. Values smaller than 0 mean under water (elevation < 0 doesn't imply water tile, though)
- water -- amount of available water on tile. Very simple dependence on elevation for now.
- temperature -- average temperature on tile. Depends on elevation and some noise.
- tier_from_start -- Distance from start in starting area sizes, rounded to integers.
You can see sheets on the generation of trees, doodads, biomes, water and tiles on this page: AutoplaceSheets
There are two possible modes in which influence is calculated. By default influence is calculated as a sum of influences of peaks (see next paragraph). When #starting_area_amount parameter is non zero a position in starting area is selected and a blob is placed centered on this position. Influence is then a maximum of the default calculated value and a value obtained from this blob.
Influence of a peak is obtained by calculating a distance from each of its dimensions and sum of these individual distances is used as a distance from optimal conditions. Based on this distance a peak gets influence between -1 and 1, which is then multiplied by the noise function, if it is specified, and by the influence constant (or by influence + richness_influence if calculating richness). Finally this value is clamped to a range between min_influence and max_influence.
Probability of placing an entity at a given position is calculated as a sum of influences plus a bonus for autoplace control, passed through a sharpening filter, multiplied by max_probability and finally a random value gets subtracted.
max_probability * sharpness_filter(sum of influences + size modifier from GUI) - random(0, random_probability_penalty)
If an entity is to be placed at a position and it a resource or a part of an enemy base, then richness is calculated in the next step. as sum of influences * (richness_multiplier + distance * richness_multiplier_distance_bonus) + richness_base.
Note, that when calculating richness, influences of individual peaks use richness_influence bonus.
A peak may have a noise multiplied with its influence. Noise used is a 2D multioctave perlin noise ( http://freespace.virgin.net/hugo.elias/models/m_perlin.htm ). Range of the noise is approximately from -1.5 to 1.5.
Factorio uses up to 256 different (non correlated) layers of perlin noise, a noise layer has to be defined as a prototype before use (see Prototype/NoiseLayer).
Intended use is to have noise layers separate for different types of objects that might appear (trees vs dry_trees vs enemy-bases). Also it has proven useful not to mix peaks containing noise with peaks referencing tile properties.
- Frequency -- If frequency is set to low, then it increases number of octaves for all noises in this specification
- Size -- Set to large adds a bonus to all the final influence, also very slightly increases number of octaves
- Richness -- Adds a simple multiplier to richness.
In case you are wondering why we can "very slightly increase number of octaves" and not just add whole octaves, it is because we sacrificed a goat to gods of computer graphics and to Ken Perlin in particular.