[MOD] (Alpha 3F) Map Generators - Fertile Plains & Snowy Worlds

Started by ItchyFlea, April 10, 2014, 10:34:46 PM

Previous topic - Next topic

Celthric Aysen

My DeviantART|E-Vehicles|Flebe's  Channel
"♫"Every people that i see i will never understand"♪"

ItchyFlea

All my mods are licensed under a Attribution-NonCommercial-ShareAlike 4.0 International
Ask for permission before using in ModPacks

Click here for a list of the mods I've created

ItchyFlea

Yet another generator has been added. This one is something I've wanted to make for a while. This generates two mountains, one to the North and one to the South, creating a valley. :D

Screenshots:
World 1: http://i.imgur.com/jLUmKBu.png
World 2: http://i.imgur.com/KLKatKe.png
World 3: http://i.imgur.com/z9iN8mo.png
All my mods are licensed under a Attribution-NonCommercial-ShareAlike 4.0 International
Ask for permission before using in ModPacks

Click here for a list of the mods I've created

Darkfirephoenix

Quote from: ItchyFlea on April 28, 2014, 09:07:28 AM
Yet another generator has been added. This one is something I've wanted to make for a while. This generates two mountains, one to the North and one to the South, creating a valley. :D
Nice! ... One question though: Could it happen that you are completly walled of? The last screenshot has only the west open, so do you have programmed in that at least either east or west are free for visitors?

ItchyFlea

Quote from: Darkfirephoenix on April 28, 2014, 09:13:32 AM
Nice! ... One question though: Could it happen that you are completly walled of? The last screenshot has only the west open, so do you have programmed in that at least either east or west are free for visitors?
I hadn't thought of that, but I guess it's possible to end up completely walled off. A solution to this will probably take a few days. In the mean-time a workaround solution would be to mine into the rock at one end of the world.
All my mods are licensed under a Attribution-NonCommercial-ShareAlike 4.0 International
Ask for permission before using in ModPacks

Click here for a list of the mods I've created

Cala13er

Quote from: ItchyFlea on April 28, 2014, 09:07:28 AM
Yet another generator has been added. This one is something I've wanted to make for a while. This generates two mountains, one to the North and one to the South, creating a valley. :D

Screenshots:
World 1: http://i.imgur.com/jLUmKBu.png
World 2: http://i.imgur.com/KLKatKe.png
World 3: http://i.imgur.com/z9iN8mo.png

Itchy! This is brilliant! Could I possibly use this for the water generation part of Industrial Rim. Appropriate credit will be given.

Thanks,
Calum.

ItchyFlea

Quote from: Cala13er on April 28, 2014, 09:31:34 AM
Itchy! This is brilliant! Could I possibly use this for the water generation part of Industrial Rim. Appropriate credit will be given.

Thanks,
Calum.
Sure. :)
I've re-uploaded the .7z file for Valley, so you should grab that if you grabbed the initial version. (I haven't changed the version number, as the change I made was very small.)
I've also added a brief note mentioning what I've added to the mountain genner, and what the value ranges are. Included in that note is blanket permission to anyone who wishes to use it in their own mod.

I'm also working on changing the terrain patch generator so that it can generate patches of rock instead of just terrain. That will be finished after I get some sleep. Something tells me coding at 2am is a bad thing. Especially since I don't know the C# language. :D
Although it seems to be working as intended: http://i.imgur.com/M8tYroM.png
All my mods are licensed under a Attribution-NonCommercial-ShareAlike 4.0 International
Ask for permission before using in ModPacks

Click here for a list of the mods I've created

Stankor

The valleys are amazing, it's the kind of map I always aim for!

daft73


Vas

Quote from: ItchyFlea on April 28, 2014, 09:07:28 AM
Yet another generator has been added. This one is something I've wanted to make for a while. This generates two mountains, one to the North and one to the South, creating a valley. :D

I love this one the most.  Can you make a generator that always has 3 sides as mountain and always leaves one side open?

One side does always need to be open or you do start getting script errors.  Kinda sucks.  Would be nice to have it totally walled off and stop most visitors and animals.  :P
Click to see my steam. I'm a lazy modder who takes long breaks and everyone seems to hate.

ItchyFlea

#55
Quote from: Vas on April 28, 2014, 05:28:18 PM
I love this one the most.  Can you make a generator that always has 3 sides as mountain and always leaves one side open?
Yes. Here's 4 generators, one for each specific open side, as well as screenshots of what they generate. (West is a special case, 9 times out of 10 it won't generate like that.)

Downloads:
Fertile Plains - OSO-North
Fertile Plains - OSO-East
Fertile Plains - OSO-South
Fertile Plains - OSO-West

Screenshots:
North Side: http://i.imgur.com/X0DlwPJ.png
East Side: http://i.imgur.com/y7g38WZ.png
South Side: http://i.imgur.com/CF66rVe.png
West Side: http://i.imgur.com/BAhkvbW.png


[attachment deleted by admin: too old]
All my mods are licensed under a Attribution-NonCommercial-ShareAlike 4.0 International
Ask for permission before using in ModPacks

Click here for a list of the mods I've created

Vas

Quote from: ItchyFlea on April 28, 2014, 07:31:56 PM
Quote from: Vas on April 28, 2014, 05:28:18 PM
I love this one the most.  Can you make a generator that always has 3 sides as mountain and always leaves one side open?
Yes. Here's 4 generators, one for each specific open side, as well as screenshots of what they generate. (West is a special case, 9 times out of 10 it won't generate like that.)

Would be even better if it could just randomly select one side to leave open and the other 3 closed off.  :P  But anyway.  I'll try out the west one for a bit.  Since I'm on a wide screen (like pretty much everyone else in the world) it makes sense that you'd want east or west open.
Click to see my steam. I'm a lazy modder who takes long breaks and everyone seems to hate.

ItchyFlea

What I've learned about the map generator over the past couple of weeks. This isn't meant to be a tutorial on how to add specific things, but rather just a collection of things explaining what I think various parts of the generator do.

First off, Tynan has noted throughout the map generator .xml file what various parts do. I'm going to try and explain what each tag inside those classes does.
I'll be quoting various parts of code from the map generator .xml file, and I'll try to do it in order from top to bottom.

<li Class="Genner_FloatGridFadedCircle">
<gridName>Sanctity</gridName>
<radiusInner>12</radiusInner>
<radiusOuter>35</radiusOuter>
</li>

I'm fairly certain this part basically tells the game to ensure that the colonists have an open space to land in, rather than landing in a hill.

<li Class="Genner_RandomSelector">
This line is followed by 3 sections, which have various 'weights' attached to them, indicating how likely it is that the game will choose that generator for the main layout of where hills, sand, soil, etc are located on the map.

Specifically:
            <genner Class="Genner_FloatGridPerlin">
              <gridName>TerrainIntensity</gridName>
              <perlinConfig>
                <ampLow>0.4</ampLow>
                <ampMid>0.3</ampMid>
                <ampHigh>0.3</ampHigh>
              </perlinConfig>
            </genner>

This is what determines that. The three tags, ampLow, ampMid and ampHigh ultimately determine the main layout of the map. I don't know what each of those do, but they have something to do where the generator places rock.

      <li Class="Genner_FloatGridGrossFade">
        <gridName>TerrainIntensity</gridName>
        <skipChance>0.2</skipChance>
        <possibleFadeSpans>
          <li>0.43</li>
          <li>0.43</li>
          <li>0.43</li>
          <li>0.1</li>
        </possibleFadeSpans>
      </li>

This is the edge mountain generator. There's a 20% chance a map will not contain one at all (<skipChance>), and a 25% chance that it'll be a thin one that can barely be dug into, the 4 items listed under <possibleFadeSpans>. It randomly chooses what side of the map it'll be placed on.

      <li Class="Genner_ThingsFromGrid">
<gridName>TerrainIntensity</gridName>
<thresholds>
<li>
<thingDef>Rock</thingDef>
<maxGridVal>0.45</maxGridVal>
</li>
</thresholds>
</li>

This is how much of the map should be composed of mineable rock. The value ranges between 0 and 1. At this point I'm going to point out this tag: <gridName>TerrainIntensity</gridName>
From what I understand, while the game generates the world, it is normally composed of two layers, the first is named Sanctity, the second TerrainIntensity. Santity is the area where your colonists land, and as such is always void of rock, regardless of whether or not the rest of the world is made of it.
You can create your own separate layers, giving them different names. I suggest reading this thread for a bit more insight into how you make a new layer: http://ludeon.com/forums/index.php?topic=3184.0

Making a new layer allows you to place different types of rock on the map. I initially used this for creating the Impenetrable Mountain generator, and have since done so for the others.

<li Class="Genner_RoofsFromGrid">
<gridName>TerrainIntensity</gridName>
<thresholds>
<li>
<roofDef>RoofRockThick</roofDef>
            <maxGridVal>0.40</maxGridVal>
</li>
<li>
<roofDef>RoofRockThin</roofDef>
            <maxGridVal>0.43</maxGridVal>
          </li>
</thresholds>
</li>

I think this section is fairly self-explanatory. If you want to get rid of thick roofs, change the <maxGridVal> to 0. If you want to get rid of all types of roof, change both <maxGridVal> to 0.

<li Class="Genner_TerrainFromGrid">
<gridName>TerrainIntensity</gridName>
<thresholds>
<li>
<terrainDef>RoughStone</terrainDef>
            <maxGridVal>0.46</maxGridVal>
          </li>
<li>
<terrainDef>Gravel</terrainDef>
<maxGridVal>0.47</maxGridVal>
</li>
<li>
<terrainDef>Soil</terrainDef>
            <maxGridVal>0.51</maxGridVal>
          </li>
          <li>
            <terrainDef>Sand</terrainDef>
            <maxGridVal>100</maxGridVal>
</li>
</thresholds>
</li>

This determines how much of the world is covered by differing types of terrain. All 4 list items must always be present in this generator, otherwise the game will crash. If you want to, for example, get rid of sand, you can either change it's value to 0, or if you want the game to place a different type of terrain where it otherwise would have placed sand, change the <terrainDef> tag to what you want. For Fertile Plains, I changed it to Soil.

<li Class="Genner_TerrainPatches">
<terrainDef>SoilRich</terrainDef>
<patchSizeRange>
<min>7</min>
<max>11</max>
</patchSizeRange>
<patchesPer10kSquaresRange>
<min>0.7</min>
<max>2</max>
</patchesPer10kSquaresRange>
</li>

This I think is also self-explanatory. This is the part that tells the game where to put those patches of rich soil. You can use this to have other types of terrain placed randomly around the map.

<li Class="Genner_ScatterMinerals">
<thingDefs>
<li>Mineral</li>
</thingDefs>
<chunkSize>29</chunkSize>
<minSpacing>5</minSpacing>
<countPer10kSquaresRange>
<min>10</min>
<max>10</max>
</countPer10kSquaresRange>
<forcedPlaceOffsets>
<li>(-5,0,-11)</li>
</forcedPlaceOffsets>
</li>

This is the part that determines how big each patch of metal is, as well as how many of those patches will be generated in the world.
<forcedPlaceOffsets> tells the game to make that metal patch that's always present next to your colonists when you start a new colony. If you want to add new ores to the game (lets say a patch of coal) you'd change this    <thingDefs><li>Mineral</li></thingDefs> to the name of your new coal resource, and you'd want to get rid of the <forcedPlaceOffsets> tag, or at least change the values, so the game doesn't overlap the patches.

<li Class="Genner_ScatterThingGroups">
<thingDefs>
<li>RawPotatoes</li>
<li>RawBerries</li>
<li>Metal</li>
<li>Metal</li>
<li>Silver</li>
</thingDefs>
<minSpacing>15</minSpacing>
<countPer10kSquaresRange>
<min>1.7</min>
<max>1.7</max>
</countPer10kSquaresRange>
<spotMustBeStandable>true</spotMustBeStandable>
<groupSizeRange>
<min>3</min>
<max>6</max>
</groupSizeRange>
<stackCountRange>
<min>40</min>
<max>60</max>
</stackCountRange>
</li>

This is how the game decides where to put all those various piles of potatoes, berries, etc, when you start a new colony.
If you add a new resources to the game, and want it to be present when you start a new world, you'd either add it to this, by adding a new list item (<li>ResourceName</li>) or by copying and pasting this entire section, and changing the various values to what you need.

And that about covers it.

For a bit more info that discusses how I went about creating new layers, which allowed me to create the Impenetrable Mountain, Coastline, Valley mods, see this thread: http://ludeon.com/forums/index.php?topic=3184.0

I also suggest having a look at the .xml files for the various generators to see exactly what I've done to accomplish different things.




When the game just doesn't have enough flexibility, you can write your own genner, or modify and existing one to give yourself that flexibility.
Feel free to use the .dll below in your own mod. Just mention my name in the mod credits.
In the case of the Valley map generator, I needed to be able to control where the game placed the edge mountain, rather than letting it randomly choose where to put it.
As such, I created this .dll: MountainGenner.dll

What I essentially did was add another tag that I could use to indicate which side of the map I wanted the mountain to be placed on.
That tag is named: <gridSide>
The values that can be placed in there range from 0 to 3. Each indicates a different side of the map. 0= East, 1= North,  2= West, 3= South

This is the code I used to have a mountain generated on either side of the map, creating the Valley generator:
<li Class="SideGenner.OptionalSide, MountainGenner">
<gridName>SideGrid</gridName>
<gridSide>1</gridSide>
<possibleFadeSpans>
<li>0.33</li>
</possibleFadeSpans>
</li>

<li Class="SideGenner.OptionalSide, MountainGenner">
<gridName>SideGrid</gridName>
<gridSide>3</gridSide>
<possibleFadeSpans>
<li>0.33</li>
</possibleFadeSpans>
</li>


[attachment deleted by admin: too old]
All my mods are licensed under a Attribution-NonCommercial-ShareAlike 4.0 International
Ask for permission before using in ModPacks

Click here for a list of the mods I've created

ItchyFlea

I don't understand what you're asking.  :-\
If you want the edge mountain to generate on a random side, just use the normal edge mountain generator: <li Class="Genner_FloatGridGrossFade">
All my mods are licensed under a Attribution-NonCommercial-ShareAlike 4.0 International
Ask for permission before using in ModPacks

Click here for a list of the mods I've created

Cala13er

Quote from: ItchyFlea on April 29, 2014, 04:10:21 AM
I don't understand what you're asking.  :-\
If you want the edge mountain to generate on a random side, just use the normal edge mountain generator: <li Class="Genner_FloatGridGrossFade">

Sorry, it didn't make much sense did it :P. Doesn't matter :)