Jump to content

Biomes in random gen and custom biomes


Hoarst

Recommended Posts

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:

 

<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:

small0040.jpg.9560586f94aa3fc709e2a98c18ad1ffc.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):

 

<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

 

<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:

 

<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.035e89827b9e3e9e39e35dcffa2df9ba.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:

 

<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:

 

<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:

 

<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:

 

<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.

small0012.jpg.dd7bc8da1b7352a1ea43849ca19a50b6.jpg

small0024.jpg.cc9daca7dd72e8d3d39e6a33c485d20f.jpg

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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)

 

		<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)

    <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

Link to comment
Share on other sites

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

 

		<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"/> ?

 

 

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.

Link to comment
Share on other sites

  • 2 months later...

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?

 

<!-- 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"/>

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

... ( 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/showthread.php?40556-CLASSIC-Style-HARDCORE&p=446198&viewfull=1#post446198

https://7daystodie.com/forums/showthread.php?40556-CLASSIC-Style-HARDCORE&p=749407&viewfull=1#post749407

https://7daystodie.com/forums/showthread.php?40556-CLASSIC-Style-HARDCORE&p=569546&viewfull=1#post569546

 

 

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)

 

..... 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."

....*%&@

Link to comment
Share on other sites

  • 7 months later...

With A18 out, the rwgmixer has changed quite a bit and it also looks like editing the RAW stamps have no effect how the final biome map looks. It's always the same, just rotates or flips.

SKGCSbQ.png

 

I've been tweaking with the biome generator numbers and things, but even then the only thing I can change is the order of the stamp pieces, or what "color" they are.

UtNLN7l.png

 

Another issue is, when I have already generated a map and then edit the biome.png - best to explain as an example - if I paint a desert where previously was forest, I get green trees still growing in the desert when I load a new game for this map.

 

Anyone got hints or links?

SKGCSbQ.jpg.7f63cf638df7d8a7ca89b39d333453c0.jpg

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...