Save all generated chunks instead of only chunks that were changed
This commit is contained in:
@@ -5,16 +5,17 @@ with ores (data) and features (a worldgen script).
|
||||
|
||||
## Determinism
|
||||
|
||||
A save only keeps what players changed on top of the generated terrain. Everything else is generated again whenever a
|
||||
chunk loads, so a chunk has to come out **exactly the same every time**. If it doesn't, blocks players broke reappear
|
||||
and their builds end up half buried.
|
||||
Every chunk is saved whole once it's generated, like Minecraft, so a saved chunk never changes when generation does.
|
||||
Generation still has to come out **exactly the same every time**: a chunk is generated more than once, since what a
|
||||
feature writes into a neighbor is generated again when that neighbor is (even years later, next to a saved chunk). If it
|
||||
isn't the same, trees are cut off at chunk borders.
|
||||
|
||||
- **Never use `Math.random`, `Date`, `performance.now` or anything else that changes between runs.** Use the chunk's
|
||||
`rng` and noise helpers, which are seeded from the world's seed.
|
||||
- Don't keep state between chunks. Chunks generate in any order, and in several worldgen workers at once, each with its
|
||||
own copy of the worldgen scripts (and the game generates a few itself).
|
||||
- Adding or removing a mod's features is safe for chunks that haven't been generated yet, but changes existing worlds'
|
||||
untouched terrain the next time it loads.
|
||||
- Adding or removing a mod's features only changes chunks that haven't been generated yet, with seams where they meet
|
||||
saved ones.
|
||||
|
||||
## The Passes
|
||||
|
||||
|
||||
@@ -247,8 +247,8 @@ filler down to its `filler_depth`. Everything else is stone.
|
||||
## 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
|
||||
changes the terrain changes untouched land in existing worlds, the same as adding a [feature](index.md#features). The
|
||||
worldgen fingerprint keeps chunks players changed as they were.
|
||||
changes the terrain changes land not generated yet in existing worlds, the same as adding a
|
||||
[feature](index.md#features). Every chunk generated is saved, so what's been generated stays as it was.
|
||||
|
||||
[Engine access](../misc/engine.md) mods can hook `engine.common.OverworldTerrain`, whose `density` and `cave` are called
|
||||
for every cell corner.
|
||||
|
||||
Reference in New Issue
Block a user