Elevation/Noise Help

Place to post guides, observations, things related to modding that are not mods themselves.
Aronson
Manual Inserter
Manual Inserter
Posts: 4
Joined: Fri Nov 22, 2024 3:05 am
Contact:

Elevation/Noise Help

Post by Aronson »

I'm trying to have a mod setup "seablock"-style map gen for every planet - a single tile of land surrounded by whatever that planet's "ocean" is - lava on Vulcanus, oil on Fulgora, etc. So far I've got this, which works great for Nauvis and does exactly what I want:

Code: Select all

data:extend({{
    type = "noise-expression",
    name = "seablock-water-world",
    expression = "if(x_from_start^2 + y_from_start^2 < 2, 1, -1000)"}
})

local nauvisData = data.raw.planet.nauvis
nauvisData.map_gen_settings.property_expression_names.elevation = "seablock-water-world"
nauvisData.map_gen_settings.autoplace_controls = {
    trees = {size = 0},
    ["enemy-base"] = {size = 0},
    ["iron-ore"] = {size = 0},
    ["copper-ore"] = {size = 0},
    stone = {size = 0},
    coal = {size = 0},
    ["uranium-ore"] = {size = 0},
    ["crude-oil"] = {size = 0}
}

local fulgoraData = data.raw.planet.fulgora
fulgoraData.map_gen_settings.property_expression_names.elevation = "seablock-water-world"
fulgoraData.map_gen_settings.autoplace_controls = {
    scrap = {size = 0},
    fulgora_islands = {size = 0},
    fulgora_cliff = {size = 0}
}

local vulcanusData = data.raw.planet.vulcanus
vulcanusData.map_gen_settings.property_expression_names.elevation = "seablock-water-world"
vulcanusData.map_gen_settings.autoplace_controls = {
    calcite = {size = 0},
    sulfuric_acid_geyser = {size = 0},
    tungsten_ore = {size = 0},
    vulcanus_coal = {size = 0},
    vulcanus_volcanism = {size = 0}
}

local glebaData = data.raw.planet.gleba
glebaData.map_gen_settings.property_expression_names.elevation = "seablock-water-world"
glebaData.map_gen_settings.autoplace_controls = {
    gleba_cliff = {size = 0},
    gleba_enemy_base = {size = 0},
    gleba_plants = {size = 0},
    gleba_stone = {size = 0},
    gleba_water = {size = 0}
}

local aquiloData = data.raw.planet.aquilo
aquiloData.map_gen_settings.property_expression_names.elevation = "seablock-water-world"
aquiloData.map_gen_settings.autoplace_controls = {
    aquilo_crude_oil = {size = 0},
    fluorine_vent = {size = 0},
    lithium_brine = {size = 0}
}
However, for the other planets it doesn't seem to be working at all. It turns off resource generation and cliffs, but otherwise the non-Nauvis planets seem to be using their default map gen. The Aquilo starting island maybe looks a little bit different, but there's still plenty of ice "land" around the start.

I've also tried "x"/"y" instead of "x_from_start"/"y_from_start" in the noise expressions and it seems to have the exact same effect.

Can anyone please help me figure out what I'm missing?
Natha
Filter Inserter
Filter Inserter
Posts: 288
Joined: Sun Mar 15, 2015 1:48 pm
Contact:

Re: Elevation/Noise Help

Post by Natha »

I figured out that the tiles of the other planets do not use the elevation variable inside map_gen_settings. If you check planet-fulgora-map-gen.lua and tiles-fulgora.lua (other planets accordingly), you see that the usey a funny mix of everything.

Even modifying the "fulgora_elevation" property to the same as your seablock elevation did not work.

There are two ways from here:
- You have to modify every tile to use custom noise expressions
- Dig into planet-fulgora-map-gen.lua, understand most of them and modify them to only generate one island in the middle of the map
Aronson
Manual Inserter
Manual Inserter
Posts: 4
Joined: Fri Nov 22, 2024 3:05 am
Contact:

Re: Elevation/Noise Help

Post by Aronson »

I had been digging around the map gen and noise expressions, but your mention of tiles led me down a good path. The elevation and code I had posted before is relevant, but it's only part of the puzzle.

In addition to the elevation piece posted earlier, I also turned off all tiles on Fulgora except oil ocean (shallow and deep) and fulgoran dunes. Then I modified the "fulgora_dunes" noise expression, which is the noise expression used in the autoplace settings for both the fulgoran-dunes and fulgoran-sand tiles (found in tiles-fulgora.lua), to use the same noise expression as I had been using for elevation, which gave me my single land tile surrounded by oil ocean. Now onto the other planets.

Here's the code in case anyone else finds this:

Code: Select all

local fulgoraData = data.raw.planet.fulgora
fulgoraData.map_gen_settings.property_expression_names.elevation = "seablock-water-world"
fulgoraData.map_gen_settings.autoplace_controls = {scrap = {size = 0}, fulgora_islands = {size = 0}, fulgora_cliff = {size = 0}}
fulgoraData.map_gen_settings.autoplace_settings = {tile = {settings = {["oil-ocean-shallow"] = {}, ["oil-ocean-deep"] = {}, ["fulgoran-dunes"] = {}}}, decorative = {}, entity = {}}
local fulgoraDunes = data.raw["noise-expression"].fulgora_dunes
fulgoraDunes.expression = "if(x_from_start^2 + y_from_start^2 < 2, 1, -1000)"
Aronson
Manual Inserter
Manual Inserter
Posts: 4
Joined: Fri Nov 22, 2024 3:05 am
Contact:

Re: Elevation/Noise Help

Post by Aronson »

Or even better, skip the middle man and set the probability expression on the tile directly

data.raw.tile["fulgoran-dunes"].autoplace.probability_expression = "if(x_from_start^2 + y_from_start^2 < 2, 1, -1000)"
Post Reply

Return to “Modding discussion”