# Temperature and climate

{% hint style="warning" %}
`Please note that understanding properties might be a bit challenging, as it involves knowledge of noise algorithms, in this case: Perlin Noise and Voronoi diagrams.`
{% endhint %}

## Biomes temperature

### Thresholds

```yaml
biomes:
  temperature:
    coldest: 0.333
    cold: 0.666
    hot: 1.333
    scorching: 1.666
```

Imagine a linear temperature distribution, as depicted in the following image:

<img src="https://3586521393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVaTufFv4BbKVyQLim4tI%2Fuploads%2FK7FZUj2aWamZDKoezE7i%2Ffile.excalidraw.svg?alt=media&#x26;token=127d6e58-0b91-4c6b-ab49-b038041bfa2d" alt="" class="gitbook-drawing">

You can customize the spacing for each temperature zone.&#x20;

For example, if you want more snowy biomes, move 'COLDEST' and 'COLD' closer to 1 and farther from 0.

{% hint style="warning" %}
<mark style="color:yellow;">Make sure the values are within the following range!</mark>

`0 < COLDEST < COLD < 1 < HOT < SCORCHING < 2`
{% endhint %}

These values play a crucial role in achieving a natural biome generation by facilitating smooth transitions between the coldest and hottest biomes. Essentially, a procedural [Perlin noise](https://en.wikipedia.org/wiki/Perlin_noise) map (_with the value interval shifted by +1_) is generated, where the lowest values correspond to the _coldest temperature_, and the highest values represent _scorching temperatures_.

<img src="https://3586521393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVaTufFv4BbKVyQLim4tI%2Fuploads%2FYvj21UxvMpTNFBAp6fz3%2Ffile.excalidraw.svg?alt=media&#x26;token=9e2ec7e9-a8b5-4205-ac8a-9ab2e084830c" alt="A 3D representation of a 2D Perlin noise map.
Values close to 0 represent valleys, while values near 2 indicate hills." class="gitbook-drawing">

{% hint style="info" %}
This procedural map, along with the Voronoi diagram, enables the generation of the biome map distributed by temperature. This is done to prevent biomes like the desert from bordering biomes like the taiga.
{% endhint %}

### Frequency

```yaml
biomes.temperature.frequency: 0.001
```

This noise is utilized to generate the temperature variations for the biomes.

> **NOTE**: a frequency value closer to 0 results in larger features.

{% hint style="info" %}
Ensure that the frequency value falls within the range: 0 < value < 1.
{% endhint %}

### Gradient perturbation

```yaml
biomes.temperature.gradient-perturb: 100.0
```

Gradient perturbation introduces torque distortion to the temperature noise within biomes. This distortion leads to more natural and diverse temperature patterns.

{% hint style="info" %}
Ensure that the value must be > 0
{% endhint %}

## Biomes cellular (Voronoi diagrams)

> Voronoi diagrams are a mathematical concept that divides a space into regions based on their proximity to a set of points.

<figure><img src="https://3586521393-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVaTufFv4BbKVyQLim4tI%2Fuploads%2FG2RQZCzVf8nFpDNJjFmM%2Fimage.png?alt=media&#x26;token=63c0c713-c28b-4b5d-a930-cd68cfae3186" alt=""><figcaption><p>Voronoi diagram</p></figcaption></figure>

In biome generation, [Voronoi noise](https://mathworld.wolfram.com/VoronoiDiagram.html) helps create distinct and natural patterns for different biomes.

{% hint style="info" %}
This procedural map facilitates the generation of a biome map in which each cell represents a custom biome.
{% endhint %}

### Frequency

```yaml
biomes.cellular.frequency: 0.0075
```

This frequency value is utilized to create the pattern of biomes.

> **NOTE**: a frequency value closer to 0 results in larger features.

{% hint style="info" %}
Ensure that the value must be > 0
{% endhint %}

### Gradient perturbation

```yaml
biomes.cellular.gradient-perturb: 30.25
```

Gradient perturbation introduces a torque distortion effect to the Voronoi diagram.\
This modification results in more natural and realistic biome shapes.

{% hint style="info" %}
Ensure that the value must be > 0
{% endhint %}
