Move world generation outside the engine and into mods and data files
This commit is contained in:
+11
-10
@@ -12,8 +12,8 @@ What world generation has today (see [World Generation](docs/modding/worldgen/in
|
||||
|
||||
- **The server generates every chunk** (`server/game/world.ts`, `common/generation.ts`). Players only get finished
|
||||
chunks, so generation code and data never have to reach clients.
|
||||
- **Three passes per chunk:** terrain (the engine's overworld, with its trees grown inside the terrain pass), then ores
|
||||
(`worldgen/ores.json`), then features (`register_feature` in a worldgen script).
|
||||
- **Three passes per chunk:** terrain (data, see [GENERATION.md](GENERATION.md)), then ores (`worldgen/ores.json`), then
|
||||
features, code or data, by step. The base game's trees are a code feature in `vegetal_decoration`.
|
||||
- **Chunks generate alone.** A feature may write up to one chunk away. Those writes are "spills" that only fill air in
|
||||
the neighbor, so the result doesn't depend on which chunk generates first.
|
||||
- **Determinism is the rule everything rests on.** A save only keeps player changes. Untouched terrain is generated
|
||||
@@ -24,7 +24,7 @@ What world generation has today (see [World Generation](docs/modding/worldgen/in
|
||||
surface.
|
||||
- **Blocks:** numeric states (up to 16 bits), `variants`, `parts`, shapes, tile data, containers, components and shared
|
||||
rules. Tags exist for blocks, items and entities. Biomes are a registry of data (`worldgen/biomes/` in a mod), but
|
||||
which one a column gets is still engine code (`pick_biome`).
|
||||
which one a column gets is data too, a biome source's rules (see [GENERATION.md](GENERATION.md)).
|
||||
- **Loot:** a block's `drops` is one item id. There are no loot tables.
|
||||
|
||||
What's missing for structures:
|
||||
@@ -46,7 +46,7 @@ The order a chunk generates in becomes:
|
||||
|
||||
```
|
||||
1. structure starts which structures overlap this chunk, assembled into pieces (cached, never saved)
|
||||
2. terrain the overworld, shaped around pieces that adapt the terrain; no trees inside pieces
|
||||
2. terrain the overworld, shaped around pieces that adapt the terrain
|
||||
3. ores as now
|
||||
4. structures each overlapping piece writes the blocks inside this chunk, by step
|
||||
5. features data features and script features, by step
|
||||
@@ -397,8 +397,9 @@ That's Trek's `monster_room/upper/default`, its configured and placed feature jo
|
||||
`rarity_filter`, `in_square`, `height_range`, `heightmap`, `biome`, `surface_relative_threshold_filter`,
|
||||
`block_predicate_filter`.
|
||||
- First feature types, from what Trek uses: `fossil` (a template, which covers Trek's monster rooms), `simple_block`,
|
||||
`block_column`, `disk` and `spring_feature`. Then the base game's own: `ore`, `tree` and `random_patch`, as the
|
||||
terrain moves out of the engine (Phase 6 of the [modding plan](docs/modding_plan.md)).
|
||||
`block_column`, `disk` and `spring_feature`, and `ore` and `random_patch` for the base game. Its trees stay code. The
|
||||
format, `simple_block`, `block_column`, the first placement modifiers and `register_feature_type` are built already,
|
||||
see [Data Features](docs/modding/worldgen/index.md#data-features).
|
||||
- Worldgen scripts register more types with `register_feature_type(id, (chunk, config, origin) => ...)`, so a data
|
||||
feature can use a type a mod wrote in code. `register_feature` stays for features that are only code.
|
||||
- **Features that reach into other chunks are evaluated from each chunk they touch.** Where a feature starts is decided
|
||||
@@ -492,8 +493,8 @@ so it's the same idea. The terrain pass gets the boxes of every piece in or near
|
||||
box. Above its floor, inside its box, clear what the terrain put there.
|
||||
- **`beard_box`:** the same, without fading at the edges.
|
||||
- **`bury` and `encapsulate`:** fill around the piece instead. Trek doesn't use them, so they can come later.
|
||||
- **Trees:** the terrain pass doesn't grow trees whose trunk is inside a piece's box (grown out a few blocks), so
|
||||
villages don't get trees through their roofs. Trees still grow around them.
|
||||
- **Trees:** the base game's trees feature doesn't grow trees whose trunk is inside a piece's box (grown out a few
|
||||
blocks), using `chunk.structures`, so villages don't get trees through their roofs. Trees still grow around them.
|
||||
|
||||
Like Minecraft, `terrain_matching` pieces (paths) don't adapt the terrain: they follow it.
|
||||
|
||||
@@ -624,8 +625,8 @@ Check: a village chest has loot the first time it's opened and not the second.
|
||||
Check: Trek's monster rooms generate underground.
|
||||
|
||||
**Phase 7: the rest, as it's needed.** `concentric_rings`, `bury` and `encapsulate`, `spawn_overrides`, mirroring,
|
||||
structure types from scripts, and the base game's ores and trees as data features. Meanwhile blocks keep being added,
|
||||
and each one lets more of Trek's templates generate whole.
|
||||
structure types from scripts, and the base game's ores as data features. Meanwhile blocks keep being added, and each one
|
||||
lets more of Trek's templates generate whole.
|
||||
|
||||
## Open Questions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user