Remove plans
This commit is contained in:
+32
-5
@@ -290,7 +290,10 @@ engine assets in `assets/`.
|
||||
|
||||
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.
|
||||
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.
|
||||
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
|
||||
@@ -315,6 +318,15 @@ How the server sends the world, like Minecraft Java since 1.20.2. The code is in
|
||||
answers `chunk_batch_received { chunks_per_tick }`: as many chunks as fit in 7 ms a tick. Until the first answer
|
||||
there's one batch of 9 in flight, after it up to 10. The server stops building chunks for a tick after 20 ms.
|
||||
- **Changes.** `set_block` only goes to players that have the chunk.
|
||||
- **Generation.** Chunks are generated in worldgen workers (`server/game/worldgen_worker.ts`), a few by default and
|
||||
`WORLDGEN_WORKERS` on the dedicated server, 0 for none. Each tick the game asks them for what the nearest chunks each
|
||||
player is waiting for are built from, nearest first, and only sends a chunk once they've made it; entities and players
|
||||
in a chunk they haven't made yet wait for it, like Minecraft's in chunks that aren't loaded. Each worker gets the
|
||||
worldgen bundle (`common/worldgen_bundle.ts`: the mods' data generation reads and their worldgen scripts), so it makes
|
||||
the same chunks as the game. The host starts them, since the game has no permissions to (see
|
||||
`server/worldgen_workers.ts`), and they talk to the game through ports. Whatever needs a chunk right away, like a mod
|
||||
script reading a block somewhere far, still generates it on the game thread: `/tps` shows how many chunks that was in
|
||||
the last minute. `tools/chunk_loading_bench.ts` measures a player arriving somewhere new.
|
||||
|
||||
## Phases
|
||||
|
||||
@@ -341,10 +353,11 @@ and dropped, containers clicked, players moving between chunks, entities.
|
||||
rules become something `mods/bworld` sets, with the engine asking it on both sides so clients still predict breaking.
|
||||
Check: all tests pass unchanged, and old saves still load.
|
||||
|
||||
**Phase 6: world generation.** Moved to data instead of a worldgen script, see [GENERATION.md](../GENERATION.md). The
|
||||
golden fixture, the ore table, and the terrain, biomes, surface and water as data are done: the server refuses to start
|
||||
without the `bworld:overworld` generator, and the fixture matches exactly. Trees are a code feature in bworld's worldgen
|
||||
script.
|
||||
**Phase 6: world generation.** Done, as data instead of a worldgen script with `register_terrain`: noises, density
|
||||
functions, noise settings and biome sources in `mods/bworld/worldgen/` (see [Terrain](modding/worldgen/terrain.md)),
|
||||
features that are code or data (bworld's trees and cacti are code, in its worldgen script), and generation in worldgen
|
||||
workers (see [Chunk Streaming](#chunk-streaming)). The golden fixture checked every step made the same world block for
|
||||
block, and the server refuses to start without the `bworld:overworld` generator.
|
||||
|
||||
**Done when** searching `client/`, `common/` and `server/` for `"bworld:` finds only `bworld:air`, removing
|
||||
`mods/bworld` gives an engine that starts and says it needs a terrain generator, the base game uses no engine access,
|
||||
@@ -362,3 +375,17 @@ and a world saved before any of this plays exactly the same.
|
||||
- **Entities.** Mods can define simple animals, but there's no API for entity types with their own behavior, animations,
|
||||
or natural spawning.
|
||||
- **Hot reload.** Restarting the server and rejoining is the answer for now.
|
||||
- **Biome rules or multi-noise?** Biome sources are ordered rules, which kept the old biomes exactly, but mods inserting
|
||||
rules can step on each other in ways that are hard to see. Minecraft's multi-noise is easier to merge but would move
|
||||
every biome border. A `minecraft:multi_noise` source could exist next to the rules, for mods and imported datapacks
|
||||
that want it.
|
||||
- **Should `register_terrain` stay?** It's still in the worldgen API, and only throws. Data covers bworld's terrain, but
|
||||
a mod might want a generator that isn't density functions at all, like a flat or skyblock world. Keeping it means the
|
||||
worldgen bundle also carries a terrain script, which workers can load the same way as features. Otherwise it goes.
|
||||
- **Importing Minecraft's terrain.** Datapacks' noise settings assume a world from -64 to 320 and Minecraft's noises.
|
||||
The formats are close enough that an importer could translate them, but the result wouldn't look like Minecraft's. Not
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user