Results 1 to 14 of 14

Thread: Biomes in random gen and custom biomes

  1. #1
    Refugee
    Join Date
    Mar 2014
    Posts
    1
    Rep Power
    0

    Biomes in random gen and custom biomes

    During the weekend i got to mess with biomes and random gen a bit. I thought maybe some of you could use the info i found out. It is possible that all of that is already common knowledge, in that case just ignore this post.

    Basically i wanted to do two things:
    1. Make random generated biomes smaller
    2. Define my own biomes and make the random generator use them

    I will explain both of those in this post. How to change biomes manually is already shown in here and here.

    The XML-files used are located in "...\7 Days To Die\Data\Config" and as always make a backup before messing with stuff.

    1. Change the way the random generator builds biomes
    All changes are done to "rwgmixer.xml". Currently the generator used for all map sizes is "vanillaSmall" so this is what we want to change. It's near the bottom of the file, line 921 and should look like this:

    Code:
    <biome_generators>
    	<biome_generator name="vanillaSmall">
    		<module name="voronoi" type="Voronoi">
    			<property name="frequency" value="0.0012"/> 
    			<property name="displacement" value="0.5"/>
    		</module>
    		...
    This generator uses a Voronoi-Diagram (wikipedia) to build the biomes which basically builds patches from a list of points.
    Here are two values to play around with. The first (frequency) represents the distance between the control points. A higher frequency results in a smaller distance between those points and thus in smaller biomes.

    Here are some "biomes.png" for a 4096x4096 map (resized for smaller files) with a frequency of 0.0012, 0.0024 and 0.0040:
    small0012.jpgsmall0024.jpgsmall0040.jpg
    (Don't mind the turquoise biomes for now, i will get to that later)

    The second value (displacement) influences the type of biome created around those points. The following informations are more or less guesses and assumptions but they seem to fit. To understand how a biome gets chosen we have to look a few lines below (line 951):

    Code:
    <module name="biomeOutput" type="BiomeIDMapper">
    	<property name="sourceModule" value="clampOutput"/>
    	<property name="biomemap0.Name" value="pine_forest"/>
    	<property name="biomemap0.Range" value="0.2,0.5"/>
    	<property name="biomemap1.Name" value="snow"/>
    	<property name="biomemap1.Range" value="0,0.2"/>
    	<property name="biomemap2.Name" value="wasteland"/>
    	<property name="biomemap2.Range" value="0.5,0.7"/>
    	<property name="biomemap3.Name" value="burnt_forest"/>
    	<property name="biomemap3.Range" value="0.7,0.8"/>
    	<property name="biomemap4.Name" value="desert"/>
    	<property name="biomemap4.Range" value="0.8,1.1"/>
    </module>
    Basically every generated biome gets the initial value of 0.5. After the initialization a random value in the range +/- "displacement" gets added to that. For a "displacement" of 0.5 that means, each biomes now has a random value between 0 and 1. The "BiomeIDMapper" is now used to set the right biome for this value. If the value for a biome is 0.6 for example, it will be wasteland.
    One can alter the values in the "BiomeIDMapper" to get another distribution of biomes. The two numbers in the "Range"-field are the upper and lower limit for that biome. So

    Code:
    <property name="biomemap2.Name" value="wasteland"/>
    	<property name="biomemap2.Range" value="0.5,0.7"/>
    means, that a biome with a value between 0.5 and 0.7 is now wasteland.

    Lets say we want a 50% chance for pine forest, 20% for snow and 10% for wasteland, burnt forest and desert. The Mapper could then look like this:

    Code:
    <module name="biomeOutput" type="BiomeIDMapper">
    	<property name="sourceModule" value="clampOutput"/>
    	<property name="biomemap0.Name" value="pine_forest"/>
    	<property name="biomemap0.Range" value="0.0,0.5"/>
    	<property name="biomemap1.Name" value="snow"/>
    	<property name="biomemap1.Range" value="0.5,0.7"/>
    	<property name="biomemap2.Name" value="wasteland"/>
    	<property name="biomemap2.Range" value="0.7,0.8"/>
    	<property name="biomemap3.Name" value="burnt_forest"/>
    	<property name="biomemap3.Range" value="0.8,0.9"/>
    	<property name="biomemap4.Name" value="desert"/>
    	<property name="biomemap4.Range" value="0.9,1.1"/>
    </module>
    A resulting "biomes.png" with a "frequency" of 0.0040:
    small0040-c.jpg

    Q&A:
    Why is the upper bound of those ranges at "1.1" instead of "1.0"?
    -No idea, but i won't touch that because it works.

    What if those ranges overlap?
    -I'm not quite sure but it seems that the generations fails (without errors, maybe some infinite loop?). Anyway just make sure they don't overlap.

    What if there is a gap/undefined values?
    -See "What if those ranges overlap?"

    So, what does "displacement" now actually do?
    -If i'm right with my assumptions, the "displacement" defines the range of possible values. If it's set to 2 one could get values between -1.5 and 2.5. It now seems that negative values are just not processed, but all the positive values are. That means the actually usable range for a "displacement" of 2 should be 0.0 to 2.5 but i'm really not sure about this. I just stick with 0.5 and ranges between 0.0 and 1.1.


    2. Create your own Biomes (and make the random generation use them)
    Here we change the "biomes.xml" in which are the definitions for all the biomes. Every definition starts with something like:

    Code:
    <biome name="snow" biomemapcolor="#FFFFFF">
    Both values are important. The "name" is used to reference the biome in the random biome generation and the "biomemapcolor" is used for the biomes.png and thus for the actual world generation. One can now add and alter biomes. Let's say you want a plains(-ish) biome. You could then copy the pine_forest and just remove the trees. Trees and rocks and other stuff are added to biomes via "decoration" like:

    Code:
    <decoration type="block" blockname="treeMountainPine19m" prob="0.0015" rotatemax="7"/>
    Just remove what you don't want and/or add what you want. Of course you can get creative and change weather, ores and define subbiomes etc.
    Finally rename your biome and give it an UNUSED color, for example:

    Code:
    <biome name="testbiome1" biomemapcolor="#00FFFF">
    	...
    </biome>
    You can now already paint a biome in that color into your "biomes.png" and on world creation it will be in there. Actually that are the turquoise biomes in the first three images. To make the random generator use your biome you just have to adjust the "BiomeIDMapper" in the rwgmixer.xml, for example:

    Code:
    <module name="biomeOutput" type="BiomeIDMapper">
    	<property name="sourceModule" value="clampOutput"/>
    	<property name="biomemap0.Name" value="testbiome1"/>
    	<property name="biomemap0.Range" value="0.0,0.3"/>	
    	<property name="biomemap1.Name" value="snow"/>
    	<property name="biomemap1.Range" value="0.7,0.8"/>
    	<property name="biomemap2.Name" value="wasteland"/>
    	<property name="biomemap2.Range" value="0.8,0.9"/>
    	<property name="biomemap3.Name" value="burnt_forest"/>
    	<property name="biomemap3.Range" value="0.6,0.7"/>
    	<property name="biomemap4.Name" value="desert"/>
    	<property name="biomemap4.Range" value="0.9,1.1"/>	
    	<property name="biomemap5.Name" value="pine_forest"/>
    	<property name="biomemap5.Range" value="0.3,0.6"/>	
    </module>
    Now, if you generate a new random map, your biome gets used.


    I hope someone finds that information useful.
    Cheers.

  2. #2
    Community Moderator Red Eagle LXIX's Avatar
    Join Date
    Jan 2014
    Location
    NJ,USA,North America,Earth,Sol System
    Posts
    3,280
    Rep Power
    1
    Nice explanation of the biome mapper and how to create customized biomes for the overall mix.

  3. #3
    Colony Founder DUST2DEATH's Avatar
    Join Date
    Jun 2014
    Location
    AU - HDHQ Overhaul
    Posts
    1,803
    Rep Power
    1
    Great job! This will be most useful.

  4. #4
    Scavenger
    Join Date
    Jul 2017
    Posts
    53
    Rep Power
    0
    if i wanted to make the Wasteland generate along the border of the map, in the radiated area, how would i do that?

    i'm assuming that i would do something similar to this:

    <distance_from_center range="xxx,xxx"/>

    but not sure where to put that line or what the xxx values should be for the 8k by 8k map.

  5. #5
    Inventor Alphado-Jaki's Avatar
    Join Date
    Feb 2016
    Location
    Japan
    Posts
    846
    Rep Power
    1
    Quote Originally Posted by EpicSpire View Post
    if i wanted to make the Wasteland generate along the border of the map, in the radiated area, how would i do that?

    i'm assuming that i would do something similar to this:

    <distance_from_center range="xxx,xxx"/>

    but not sure where to put that line or what the xxx values should be for the 8k by 8k map.
    There are no built in distance_from_xxxx.
    So we need to make on ourselves.

    I'll snip how this is made, but following code returns distance from center. (dist_center)

    Code:
    		<module name="val_0" type="Constant"/>
    		<module name="val_p1" type="Constant"><property name="constant" value="1"/></module>
    		<module name="val_m1" type="Constant"><property name="constant" value="-1"/></module>
     
    		<module name="val_worldSize" type="Constant">
    			<property name="constant" value="4096"/>
    		</module>
     
    		<module name="val_worldSafeSize" type="BiasOutput"><property name="sourceModule" value="val_worldSize"/><property name="bias" value="-640"/></module>
    		<module name="val_worldSafeSizeHalf" type="ScaleOutput"><property name="sourceModule" value="val_worldSafeSize"/><property name="scale" value="0.5"/></module>
     
    		<module name="dist_southWestBase" type="Cylinders"><property name="frequency" value="1e-20"/></module>
    		<module name="dist_southWest" type="ScaleBiasOutput"><property name="sourceModule" value="dist_southWestBase"/><property name="scale" value="-5e+19"/><property name="bias" value="5e+19"/></module>
    
    		<module name="dist_center" type="DisplaceInput"><property name="sourceModule" value="dist_southWest"/><property name="xDisplaceModule" value="val_worldSizeHalf"/><property name="yDisplaceModule" value="val_0"/><property name="zDisplaceModule" value="val_worldSizeHalf"/></module>
    To use this, (I assume current output is clampOutput and wasteland is 0.8-0.9)
    Code:
        <module name="val_wasteland" type="Constant">
            <property name="constant" value="0.85"/>
        </module>
        <module name="wastelandOuterBiome" type="Select">
            <property name="sourceModule1" value="clampOutput"/>
            <property name="sourceModule2" value="val_wasteland"/>
            <property name="controlModule" value="dist_center"/>
            <property name="bounds" value="4800, 10000"/>
        </module>
    After this, need to biome map as same as vanilla

  6. #6
    Scavenger
    Join Date
    Jul 2017
    Posts
    53
    Rep Power
    0
    Quote Originally Posted by Alphado-Jaki View Post
    I'll snip how this is made, but following code returns distance from center. (dist_center)

    Code:
    		<module name="val_0" type="Constant"/>
    		<module name="val_p1" type="Constant"><property name="constant" value="1"/></module>
    		<module name="val_m1" type="Constant"><property name="constant" value="-1"/></module>
     
    		<module name="val_worldSize" type="Constant">
    			<property name="constant" value="4096"/>
    		</module>
     
    		<module name="val_worldSafeSize" type="BiasOutput"><property name="sourceModule" value="val_worldSize"/><property name="bias" value="-640"/></module>
    		<module name="val_worldSafeSizeHalf" type="ScaleOutput"><property name="sourceModule" value="val_worldSafeSize"/><property name="scale" value="0.5"/></module>
     
    		<module name="dist_southWestBase" type="Cylinders"><property name="frequency" value="1e-20"/></module>
    		<module name="dist_southWest" type="ScaleBiasOutput"><property name="sourceModule" value="dist_southWestBase"/><property name="scale" value="-5e+19"/><property name="bias" value="5e+19"/></module>
    
    		<module name="dist_center" type="DisplaceInput"><property name="sourceModule" value="dist_southWest"/><property name="xDisplaceModule" value="val_worldSizeHalf"/><property name="yDisplaceModule" value="val_0"/><property name="zDisplaceModule" value="val_worldSizeHalf"/></module>
    Thanks!
    where do i add these codes?
    do i need to change: <property name="constant" value="4096"/> to <property name="constant" value="8192"/> ?


    Quote Originally Posted by Alphado-Jaki View Post
    To use this, (I assume current output is clampOutput and wasteland is 0.8-0.9)
    i have no idea what you mean by this, i havent changed any Clampout or output configs.

  7. #7
    Colony Founder AtomicUs5000's Avatar
    Join Date
    Nov 2018
    Location
    US
    Posts
    1,100
    Rep Power
    1
    Can added biomes have added subbiomes?

  8. #8
    Colony Founder SlicksGirl's Avatar
    Join Date
    Apr 2016
    Location
    Texas, pre-apoloclypse
    Posts
    1,308
    Rep Power
    1
    wow.. can you figure out how to re-add the plains biome? (i mean the origional terrain color as i've got the rest, thanks) i want this back in the game. I can find the terrain,grass, and trees and can figure out most of it, but adding it into the generator is a little tough for my first go at it...

    as far as the clamp out issue, i think he is referring to medium or large biome maps and changing the border values.

    and what about this? wouldnt we need to add the plains biome to the biome mapping id list?

    Code:
    <!-- Mapping from biome name to id number as it is saved in the world chunks -->
    	<biomemap id="01" name="snow"/>
    	<biomemap id="03" name="pine_forest"/>
    	<biomemap id="05" name="desert"/>
    	<biomemap id="06" name="water"/>
    	<biomemap id="07" name="radiated"/>
    	<biomemap id="08" name="wasteland"/>
    	<biomemap id="09" name="burnt_forest"/>
    	<biomemap id="10" name="city"/>
    	<biomemap id="11" name="city_wasteland"/>
    	<biomemap id="12" name="wasteland_hub"/>
    	<biomemap id="13" name="caveFloor"/>
    	<biomemap id="14" name="caveCeiling"/>
    	<biomemap id="18" name="onlyWater"/>
    	<biomemap id="19" name="underwater"/>
    Last edited by SlicksGirl; 03-16-2019 at 12:48 PM.

  9. #9
    Colony Founder n2n1's Avatar
    Join Date
    Oct 2015
    Location
    MotherRussia
    Posts
    1,982
    Rep Power
    1
    What is now lacking in vanilla to bring back the plains biome :
    1- terrain-textures
    2 - plains grass
    3 - entryes for biomes.xml (biomemap and biome)
    4 - entry for rwgmixer.xml
    (and all sorts of little things, like spawnig, rules for prefabs - which are simple)

    perhaps still something is missing, further than this i have not tested...
    Last edited by n2n1; 03-16-2019 at 01:37 PM.

  10. #10
    Colony Founder SlicksGirl's Avatar
    Join Date
    Apr 2016
    Location
    Texas, pre-apoloclypse
    Posts
    1,308
    Rep Power
    1
    Quote Originally Posted by n2n1 View Post
    What is now lacking in vanilla to bring back the plains biome :
    1- terrain-textures
    2 - plains grass
    3 - entryes for biomes.xml (biomemap and biome)
    4 - entry for rwgmixer.xml
    (and all sorts of little things, like spawnig, rules for prefabs - which are simple)

    perhaps still something is missing, further than this i have not tested...
    the plains grass is still in the blocks and the texture is still in the game BUt could be replaced with the texture for hay as a quick hack.

    I'm trying to figure this out today as I really want plains back and have never touched biomes or rwg xmls before.

    I grew up in deep golden valleys of plains nestled between massive snow capped mountains with random oak and maple trees. and for me, at least when it was introduced in early alphas, these features drew me in, immersed me. I miss when this game had tall snowy mountains and deep wandering golden plains. ( i kinda miss the swamps too, but eh).

    i feel like i could figure this out if i found a walkthrough for editing these, but i just keep finding terrain mapping videos instead. they are cool and all and sure i'll probably edit the map, but first, i need my plains.

  11. #11
    Colony Founder n2n1's Avatar
    Join Date
    Oct 2015
    Location
    MotherRussia
    Posts
    1,982
    Rep Power
    1
    Plains is my favorite biome in 7dtd. In my mod (Classic Style Hardcore), i pay a lot of attention to the appearance of biomes. I've always wondered what these landscapes are in reality. Especially - as look there lonely trees. If not more difficult - you can specify some typical photos that convey the picturesqueness of these places?
    Quote Originally Posted by SlicksGirl View Post
    ... ( i kinda miss the swamps too, but eh)....
    Swamps in vanilla? It was only in my mod .... am i wrong?
    Ahh.... shores of water biome....
    check out:
    https://7daystodie.com/forums/showth...l=1#post446198
    https://7daystodie.com/forums/showth...l=1#post749407
    https://7daystodie.com/forums/showth...l=1#post569546


    Quote Originally Posted by SlicksGirl View Post
    the plains grass is still in the blocks.....
    maybe, but it seemed to me (visually) that it is not among the textures. (it is difficult to recognize this in the resource itself)

    Quote Originally Posted by SlicksGirl View Post
    ..... BUt could be replaced with the texture for hay as a quick hack.
    The terrain-texture is definitely missing and it can not be replaced by another from the blocks.

    Step-by-step guide is too much to cover. But if you start, then i can help in certain(particular) tasks.
    Usie UABE, in a simple way, to replace some unnecessary texture (there are many such) from a standard asset.

    Hmmm....did you ask me before, a long time ago, about the distribution of ore in the layers?


    PS:
    and, most likely, you will need to adjust the color of textures and, perhaps, the spectrum of the biome (if it is still there) because shaders and render have changed and the old one may not fit anymore.
    And i, frankly, simply await the A18....

    PPS:
    I remember, what MM said, they removed plains, because "anyway, they nobody likes."
    ....*%&@
    Last edited by n2n1; 03-16-2019 at 05:41 PM.

  12. #12
    Colony Founder SlicksGirl's Avatar
    Join Date
    Apr 2016
    Location
    Texas, pre-apoloclypse
    Posts
    1,308
    Rep Power
    1
    i see clay is still there. wonder if we could use clay blocks (they are commented out) as the top terrain for the plains and then have it give claydirt up pickup (dig/mine) like the forrest terrain.

  13. #13
    Colony Founder n2n1's Avatar
    Join Date
    Oct 2015
    Location
    MotherRussia
    Posts
    1,982
    Rep Power
    1
    Yes Сlay is still present among textures.
    Alternatively, it is possible to temporarily do with it and then, if it all works out and replace it with the original.
    Last edited by n2n1; 03-16-2019 at 09:41 PM.

  14. #14
    Colony Founder SlicksGirl's Avatar
    Join Date
    Apr 2016
    Location
    Texas, pre-apoloclypse
    Posts
    1,308
    Rep Power
    1
    i see someone did editing of biomes in krita... biome map generation. is there a tutorial in how to find and edit this?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •