-
Notifications
You must be signed in to change notification settings - Fork 80
Redmew Surface
redmew_surface
(hereafter RS) consists of two parts:
redmew_surface
contains all the functions and logic while map_gen_settings
, map_settings
, and difficulty_settings
contain settings presets to help customize maps.
As long as a map hasn't explicitly selected to control an aspect of world generation, a user's choices are respected. Further, a user can also disable RS entirely or the individual aspects of worldgen via the config file.
RS changes the surface that maps are generated on from nauvis
to a new surface: redmew
. It offers a way to acquire the surface name pre-init through get_surface_name
and allows us to get the surface itself from get_surface
after init.
Example:
local RS = require 'map_gen.shared.redmew_surface'
local surface = RS.get_surface()
These methods are intended for modules that act on a surface without being able to determine which surface to act on (ie. modules not being triggered by events that provide a surface).
The strength of RS is its ability to control world generation for maps. We no longer have to do things like scan for and remove ores and trees or water via LUA. We can now simply disable their auto-placement. However RS doesn't force a map to specify more than it wants/needs. If a map only wants to remove all copper ore generation while leaving all other settings to the user: it can do that.
RS splits worldgen into the 3 components that factorio itself splits them into: map_gen_settings, map_settings, and difficulty_settings.
For each of the 3 components, RS has an associated public function: set_map_gen_settings
, set_map_settings
, and set_difficulty_settings
RS works essentially by overwriting. The base is the user's settings and values provided through the set
functions overwrite existing values. For example if a user selects rich resources and a map is set to remove all copper ore: the map will spawn no copper but all others will be at rich settings.
To make things easier on map makers, there are many preset world gen options available to select from. These presets/components are available in 3 resource files named for each of the world gen components: map_gen_settings.lua
, map_settings.lua
, and difficulty_settings.lua
. Each file contains in it tables of varying size/scope and settings. For example waterworld
in map_gen_settings.lua
contains a table that ensures nothing but water will spawn. This can be nice for a map that wants to fully create its terrain, ores, and entities.
To create a map with no ores, no enemies, no pollution, no enemy evolution, 3x tech costs, and sand set to high we would use the following:
-- We require redmew_surface to access the public functions and assign the table Public to the RS variable to access them easily.
local RS = require 'map_gen.shared.redmew_surface'
-- We require the resources tables so that we don't have to write settings components by hand.
local MGSP = require 'resources.map_gen_settings' -- map gen settings presets
local DSP = require 'resources.difficulty_settings' -- difficulty settings presets
local MSP = require 'resources.map_settings' -- map settings presets
-- We create a custom table for the niche settings of wanting more sand
local extra_sand = {
autoplace_controls = {
sand = {frequency = 'high', size = 'high'}
}
}
RS.set_map_gen_settings({MGSP.enemy_none, MGSP.ore_none, MGSP.oil_none, extra_sand})
RS.set_difficulty_settings({DSP.tech_x3})
RS.set_map_settings({MSP.enemy_evolution_off, MSP.pollution_off})
A water world:
local RS = require 'map_gen.shared.redmew_surface'
local MGSP = require 'resources.map_gen_settings' -- map gen settings presets
RS.set_map_gen_settings({MGSP.waterworld})
A map that wants very high enemies and cliffs, but also wants very specific iron and copper generation. The ore generation is too specific to add to the resource file so we create a table for it:
local RS = require 'map_gen.shared.redmew_surface'
local MGSP = require 'resources.map_gen_settings' -- map gen settings presets
local ore_gen =
{
autoplace_controls = {
['iron-ore'] = {
frequency = 'high',
richness = 'very-low',
size = 'very-high'
},
['copper-ore'] = {
frequency = 'low',
richness = 'very-high',
size = 'very-low'
}
}
}
RS.set_map_gen_settings({MGSP.enemy_very_high, MGSP.cliff_very_high, ore_gen})
Having issues? Reach out on discord
Got a bug report, feature request or map idea? Open an issue
Looking to download maps? See releases or the public save directory
Interested in Localization? Check out the progress at Crowdin