Dimension api

This commit is contained in:
2026-11-05 23:34:43 -03:00
parent 34f001285d
commit 4766c9a808
14 changed files with 251 additions and 27 deletions
+7 -7
View File
@@ -203,13 +203,13 @@ feature.
## Terrain
The terrain is data: noises, density functions, a generator and biome rules, see [Terrain](terrain.md). The base game's
works like Minecraft 1.18+, shaped after the [Tectonic](https://github.com/Apollounknowndev/tectonic) mod: continents,
erosion and ridges noises set every column's height and roughness, and a 3D density is carved into caves. Oceans wind
between large continents, with islands out at sea. Mountain ranges rise where erosion is low, and rivers run along the
valleys between ridges, going underground where they reach mountains. The flatter land is split into regions with their
own shapes: valleys and plateaus (with badlands ridges where it's hot), tiered mesas, rolling hills and jungle pillars,
and wetlands and desert dunes.
The terrain is data: noises, density functions, a generator, biome rules and the dimension that picks the generator, see
[Terrain](terrain.md). The base game's works like Minecraft 1.18+, shaped after the
[Tectonic](https://github.com/Apollounknowndev/tectonic) mod: continents, erosion and ridges noises set every column's
height and roughness, and a 3D density is carved into caves. Oceans wind between large continents, with islands out at
sea. Mountain ranges rise where erosion is low, and rivers run along the valleys between ridges, going underground where
they reach mountains. The flatter land is split into regions with their own shapes: valleys and plateaus (with badlands
ridges where it's hot), tiered mesas, rolling hills and jungle pillars, and wetlands and desert dunes.
Which biome each column gets is the generator's biome rules, see [Biome Sources](terrain.md#biome-sources), and what a
biome looks like is its own file, see [Biomes](biomes.md).
+36 -4
View File
@@ -5,9 +5,9 @@ mod's `worldgen/` folders. The engine only knows how to evaluate them. The base
`mods/bworld/worldgen/`, and a mod can add biomes to it with rules of its own.
It works like Minecraft's: noises feed **density functions**, a **noise settings** file puts them together into a
generator, and a **biome source** picks biomes. The names and fields follow Minecraft's where the idea is the same, so
the [Minecraft Wiki](https://minecraft.wiki/w/Density_function) explains most of them. Where bworld differs, it says so
below.
generator, a **biome source** picks biomes, and a **dimension** says which generator the world uses. The names and
fields follow Minecraft's where the idea is the same, so the [Minecraft Wiki](https://minecraft.wiki/w/Density_function)
explains most of them. Where bworld differs, it says so below.
These files are server only: they're left out of the copy of a `.cubi` players download.
@@ -17,6 +17,7 @@ my_mod/
worldgen/density_function/<path>.json # named density functions
worldgen/noise_settings/<path>.json # generators
worldgen/biome_source/<path>.json # biome rules, or rules added to another mod's
worldgen/dimension/<path>.json # which generator the world uses
```
Ids can have folders, like `bworld:overworld/erosion` in `worldgen/density_function/overworld/erosion.json`.
@@ -156,7 +157,7 @@ A generator. The base game's is `worldgen/noise_settings/overworld.json`:
| `fluids` | What empty space becomes, the first that applies: below `below`, where there's `open_sky` (nothing but air above) or where a density function is in a range. |
| `surface_rule` | What solid blocks become. |
The world uses `bworld:overworld`. The server doesn't start without it.
The world uses the generator its [dimension](#dimensions) names, the base game's is `bworld:overworld`.
## Biome Sources
@@ -244,6 +245,37 @@ The base game's: within 20 blocks of the ground, the top block is the biome's un
stone on cliffs) above the snow line, stone on bare cliffs, and the biome's `top` otherwise. Below it, the biome's
filler down to its `filler_depth`. Everything else is stone.
## Dimensions
A dimension is a world to play and the generator that makes it, like NeoForge's `dimension/` files (a level stem). The
base game's is `worldgen/dimension/overworld.json`:
```json
{
"format_version": 1,
"dimension": {
"id": "bworld:overworld",
"generator": "bworld:overworld",
"default": true
}
}
```
| Field | Meaning |
| ----------- | --------------------------------------------------------- |
| `generator` | The [noise settings](#noise-settings) that generate it. |
| `default` | `true` for the dimension the world plays. False if unset. |
The world plays the dimension with `"default": true`. Exactly one dimension in the loaded mods can be the default: with
none, or more than one, the server doesn't start, and the error names them. A mod can have dimensions that aren't the
default, but nothing plays them yet. Since a mod can't change another mod's files yet, a mod with a default dimension of
its own, like a flat world, can't be loaded with the base game's for now.
There's one dimension per world for now, there's no travelling between them yet.
New players spawn in the middle of the world, on the first column, in rings of chunks around 0, 0, whose top block has
collision. Water has none, so they never spawn in the sea, and neither do plants without collision.
## Changing the Base Game's Terrain
A mod can add biomes to it, but can't replace its files yet: an id defined by two mods is an error. Anything that