Modding:WorldGen Configuration: Difference between revisions

From Vintage Story Wiki
No edit summary
No edit summary
(12 intermediate revisions by 2 users not shown)
Line 3: Line 3:
Landforms define the shape of the terrain. Let's take a look at an existing landform.
Landforms define the shape of the terrain. Let's take a look at an existing landform.


<pre>
<syntaxhighlight lang="json">
{
{
code: "landforms",
code: "landforms",
Line 21: Line 21:
]
]
}
}
</pre>
</syntaxhighlight >




Line 35: Line 35:
'''Octave Thresholds'''
'''Octave Thresholds'''


These act as substractor to the octaves. This allows you for example to generate a flat terrain with a few rare bumps by it, by setting something like this:
These act as substractor to the octaves. This allows you for example to generate a flat terrain with a few rare bumps, by setting something like this:


<code>
<code>
Line 43: Line 43:


This causes the 7th octave to be only active 30% of the time, as most of it is substracted away.
This causes the 7th octave to be only active 30% of the time, as most of it is substracted away.
Note: The amount of octaves is always fixed at 10. You can't configure less or more than 10.


=== Y-Thresholds ===
=== Y-Thresholds ===


Image you had a side view of a mountain and you could make it wider and thinner at any given elevation. This is approximately how the y-threshold system works. terrainYKeyPositions are the relative (0=bottom, 1=top of the world) coordinates and terrainYKeyThresholds define how much Percent of terrain should be solid blocks (0 = always air, 1 = always solid), or in other words it's density. We could also make a graph of this:
Imagine you had a side view of a mountain and you could make it wider and thinner at any given elevation. This is approximately how the y-threshold system works. terrainYKeyPositions are the relative (0=bottom, 1=top of the world) coordinates and terrainYKeyThresholds define how much Percent of terrain should be solid blocks (0 = always solid, 1 = always air), or in other words it's density. We could also make a graph of this:


[[File:Densitygraph.png]]
[[File:Densitygraph.png]]
Line 52: Line 54:
In this example at maximum world height the density is 0, so there will always be air blocks. In the middle we have a jump where the y-position changes, but not the density, so this will create cliffs in the mountain. On the lower end the opposite happens. The Y-Position changes very little but it's density increases a lot. If that position happens to be at the sealevel we would get flat beaches. The default sealevel y-position is 0.43  
In this example at maximum world height the density is 0, so there will always be air blocks. In the middle we have a jump where the y-position changes, but not the density, so this will create cliffs in the mountain. On the lower end the opposite happens. The Y-Position changes very little but it's density increases a lot. If that position happens to be at the sealevel we would get flat beaches. The default sealevel y-position is 0.43  
And below a certain y-position the density is always 1. If we would set that to a lower value, we would get very deep lakes.
And below a certain y-position the density is always 1. If we would set that to a lower value, we would get very deep lakes.
The amount of configurable Y-Thresholds is arbitrary you may use any quantity, just make sure both lists have the same amount of elements. However, it wouldn't make sense to configure more than 256 thresholds for a world height of 256 blocks.
=== Testing Landforms ===
You can trial&error landforms very quickly without the need to restart the game every time you made changes to the landforms.json
<ol>
<li><code>/wgen autogen 0</code> - disables automatic generation of chunks</li>
<li><code>/wgen del 10</code> - delete all chunks with a radius 10 chunks (Warning: Cannot be undone!)</li>
<li><code>/wgen regen 5</code> - Reloads the landforms.json then deletes and regenerates all chunks with a radius of 5 chunks</li>
{{Navbox/modding|Vintage Story}}

Revision as of 12:13, 14 January 2019

Landforms

Landforms define the shape of the terrain. Let's take a look at an existing landform.

{
	code: "landforms",
	"variants": 
	[
		{
			"code":  "humongous mountain",
			"comment": "humongous mountains with caverns in them",
			"hexcolor": "#5BC184",
			"weight": 2,
			"useClimateMap": false,
			"terrainOctaves":          [0, 0, 0, 0, 1,   1, 1, 1, 0.6, 0.2],
			"terrainOctaveThresholds": [0, 0, 0, 0, 0.5, 0, 0,   0,   0, 0],
			"terrainYKeyPositions":    [0, 0.33, 0.37, 0.42, 0.43, 0.5, 0.6, 0.7, 0.9, 0.97, 1],
			"terrainYKeyThresholds":   [1,    1, 0.87, 0.84, 0.7, 0.94, 1, 1, 0.1, 0.05, 0]
		},
	]
}


There are 2 system at work that let you control the shape of the terrain - the octaves and the Y-Thresholds.

Octaves

If you know perlin noise, you will know what this is, but shortly explained low octaves will give you very smooth terrain whereas high octave give you rugged/chaotic terrain. You can mix an match freely between those. Examples:

  • terrainOctaves: [1, 0, 0, 0, 0, 0, 0, 0, 0, 0] would give you veeeery gradually changing terrain
  • terrainOctaves: [0, 0, 0, 0, 0, 0, 0, 0, 1, 1] would give you veeeery rugged and chaotic terrain

Octave Thresholds

These act as substractor to the octaves. This allows you for example to generate a flat terrain with a few rare bumps, by setting something like this:

terrainOctaves: [1, 1, 1, 0, 0, 0, 1, 0, 0, 0],
terrainOctaveThresholds: [0, 0, 0, 0, 0, 0, 0.7, 0, 0, 0],

This causes the 7th octave to be only active 30% of the time, as most of it is substracted away.

Note: The amount of octaves is always fixed at 10. You can't configure less or more than 10.

Y-Thresholds

Imagine you had a side view of a mountain and you could make it wider and thinner at any given elevation. This is approximately how the y-threshold system works. terrainYKeyPositions are the relative (0=bottom, 1=top of the world) coordinates and terrainYKeyThresholds define how much Percent of terrain should be solid blocks (0 = always solid, 1 = always air), or in other words it's density. We could also make a graph of this:

Densitygraph.png

In this example at maximum world height the density is 0, so there will always be air blocks. In the middle we have a jump where the y-position changes, but not the density, so this will create cliffs in the mountain. On the lower end the opposite happens. The Y-Position changes very little but it's density increases a lot. If that position happens to be at the sealevel we would get flat beaches. The default sealevel y-position is 0.43 And below a certain y-position the density is always 1. If we would set that to a lower value, we would get very deep lakes.

The amount of configurable Y-Thresholds is arbitrary you may use any quantity, just make sure both lists have the same amount of elements. However, it wouldn't make sense to configure more than 256 thresholds for a world height of 256 blocks.

Testing Landforms

You can trial&error landforms very quickly without the need to restart the game every time you made changes to the landforms.json

  1. /wgen autogen 0 - disables automatic generation of chunks
  2. /wgen del 10 - delete all chunks with a radius 10 chunks (Warning: Cannot be undone!)
  3. /wgen regen 5 - Reloads the landforms.json then deletes and regenerates all chunks with a radius of 5 chunks
  4. Icon Sign.png

    Wondering where some links have gone?
    The modding navbox is going through some changes! Check out Navigation Box Updates for more info and help finding specific pages.