Save all generated chunks instead of only chunks that were changed
This commit is contained in:
@@ -289,11 +289,11 @@ engine assets in `assets/`.
|
||||
### Rules That Keep Existing Worlds Working
|
||||
|
||||
1. **Ids don't change.** Saves store blocks and items by string id, including inventories and chest contents.
|
||||
2. **Terrain is identical, block for block.** A save only stores what players changed on top of generated terrain. If
|
||||
the generator's output changes at all, every existing world silently changes with it. `tests/worldgen_golden_test.ts`
|
||||
hashes 64 chunks for each of 3 seeds against `tests/fixtures/worldgen_golden.json`. A change meant to change
|
||||
generation records it again (`deno test -A tests/worldgen_golden_test.ts -- --update`), and the worldgen fingerprint
|
||||
(`ServerWorld.worldgen_fingerprint`) keeps chunks players saved as they were.
|
||||
2. **Terrain doesn't change by accident.** Every chunk generated is saved whole, like Minecraft, so a change to
|
||||
generation only shows in chunks not generated yet, with seams where they meet saved ones.
|
||||
`tests/worldgen_golden_test.ts` hashes 64 chunks for each of 3 seeds against `tests/fixtures/worldgen_golden.json`,
|
||||
so it's never a surprise. A change meant to change generation records it again
|
||||
(`deno test -A tests/worldgen_golden_test.ts -- --update`).
|
||||
3. **Old saves are upgraded when loading.** The save format can change, as long as older saves load into the new shape.
|
||||
`tests/fixtures/` keeps a save from each version.
|
||||
4. **The protocol can change, with `PROTOCOL_VERSION`.** Clients on another version are turned away before anything else
|
||||
@@ -387,5 +387,5 @@ and a world saved before any of this plays exactly the same.
|
||||
a goal for now.
|
||||
- **Generation's loose ends.** The packaged desktop build hasn't been tried with the worldgen worker, which the desktop
|
||||
task includes. In a world without land, the spawn search looks 32 chunks out on the game thread, which the server now
|
||||
does at startup. Loading a save whose generation changed compares its chunks with the new generation on the game
|
||||
thread.
|
||||
does at startup. Saved chunks are read on the game thread, which waits for the host (see `read_chunk` in
|
||||
`server/game/worker.ts`): much faster than generating them, but Minecraft reads them ahead instead.
|
||||
|
||||
Reference in New Issue
Block a user