Biome as data

This commit is contained in:
2026-10-08 13:34:32 -03:00
parent 9f0b049148
commit 7e7ac8f6f4
49 changed files with 913 additions and 224 deletions
+1
View File
@@ -21,6 +21,7 @@ mods/
tags/<registry>/<namespace>/*.json # tags, see resources/tags.md
loot_tables/**/*.json # loot tables, see resources/loot_tables.md
worldgen/ores.json
worldgen/biomes/*.json # one biome per file, see worldgen/biomes.md
worldgen/spawns.json # monsters that spawn on their own, see entities/index.md
textures/*.png
textures/*.json # animations, see resources/textures.md
+72
View File
@@ -0,0 +1,72 @@
# Biomes
A biome says what the ground looks like where it's picked: the blocks on top, the colors grass, leaves and water are
tinted, which trees grow, and its season. Biomes are data, one file each in a mod's `worldgen/biomes/` folder. The base
game's are in `mods/bworld/worldgen/biomes/`.
> [!NOTE]
> Which biome a column gets is still decided by the engine (`pick_biome` in `common/worldgen/overworld.ts`), from the
> column's climate and height. It only picks the base game's biomes, so a biome a mod adds doesn't generate anywhere
> yet. Mods can still list it in their spawns.
## A Biome
`worldgen/biomes/dark_forest.json`:
```json
{
"format_version": 1,
"biome": {
"id": "bworld:dark_forest",
"surface": {
"top": "bworld:grass",
"filler": "bworld:dirt",
"filler_depth": 3,
"bare_cliffs": true
},
"colors": {
"grass": "#507a32",
"foliage": "#59ae30",
"water": "#3f76e4"
},
"trees": {
"chance": 1,
"kinds": ["big_oak", "big_oak", "oak"],
"wood": { "big_oak": "dark_oak" }
}
}
}
```
| Field | What it does | When not set |
| --------------------------- | ---------------------------------------------------------------------------------------- | ------------ |
| `id` | in your mod's namespace | required |
| `season` | `spring`, `summer`, `autumn` or `winter`. Nothing uses it yet | `spring` |
| `surface.top` | the block on top of the ground | required |
| `surface.filler` | the blocks under it | required |
| `surface.filler_depth` | how many blocks of filler, 0 to 32. Stone is below | required |
| `surface.underwater_top` | the top block where the ground is under water | `filler` |
| `surface.underwater_filler` | the filler under water | `filler` |
| `surface.bare_cliffs` | steep ground shows stone instead of `top` | `false` |
| `colors.grass` | what blocks with `"tint": { "color": "grass" }` are drawn in, as `#rrggbb` | plains' |
| `colors.foliage` | the same for `"foliage"`, like leaves | plains' |
| `colors.water` | the same for `"water"` | plains' |
| `trees.chance` | how likely each tree spot is to get a tree, 0 to 1. Spots are at least 4 blocks apart | no trees |
| `trees.kinds` | which trees grow, picked evenly: list one twice to make it twice as likely | |
| `trees.wood` | the logs and leaves a kind grows here when it isn't its own, like dark oak for `big_oak` | |
Tree kinds are `oak`, `big_oak`, `birch`, `spruce`, `jungle`, `acacia` and `cherry`. Woods are `oak`, `spruce`, `birch`,
`jungle`, `acacia`, `dark_oak` and `cherry`. Trees only grow on grass, dirt or snow with air above.
Above the snow line, around y 176, the top block is snow whatever the biome says.
## Biome Ids
Biome ids are what features' `biome_at` gives and what spawns list. The base game has `bworld:deep_ocean`,
`bworld:deep_frozen_ocean`, `bworld:deep_lukewarm_ocean`, `bworld:ocean`, `bworld:frozen_ocean`, `bworld:warm_ocean`,
`bworld:river`, `bworld:frozen_river`, `bworld:beach`, `bworld:snowy_beach`, `bworld:stony_shore`, `bworld:plains`,
`bworld:meadow`, `bworld:forest`, `bworld:dark_forest`, `bworld:swamp`, `bworld:taiga`, `bworld:snowy_plains`,
`bworld:snowy_taiga`, `bworld:savanna`, `bworld:jungle`, `bworld:desert`, `bworld:snowy_slopes`, `bworld:stony_peaks`,
`bworld:jagged_peaks` and `bworld:frozen_peaks`.
`/locatebiome <id>` finds the nearest one.
+1 -1
View File
@@ -101,7 +101,7 @@ sea. Mountain ranges rise where erosion is low, and rivers run along the valleys
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.
Biome ids are the keys of `BIOMES` in `common/worldgen/overworld.ts`, like `bworld:plains` or `bworld:jagged_peaks`.
Which biome each column gets is part of the terrain, but what a biome looks like is data: see [Biomes](biomes.md).
`deno run -A tools/worldgen_preview.ts [seed] [out dir] [x z]` renders it to PNG files, around chunk `x z`.