fix(worldgen): shuffle which biomes a multi-biome world uses, not just how many - #697
Merged
Conversation
…t how many (#696) ResolveBiomes rolled only the biome COUNT (2..pool) and then always took the first N pool entries, so the tail entries of a type's biome pool in data/planets.json were missing from every world that rolled a smaller count, and the first entry appeared on every world of the type. A per-world Fisher-Yates shuffle (seeded from PlanetSeed, so server and client preview agree) now also picks WHICH entries make the cut. ResolveBiomes/BiomeResolved became internal (+InternalsVisibleTo for the test project); two new tests cover membership variety across seeds and determinism. Only newly generated chunks are affected. closes #696 Co-Authored-By: Claude Fable 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ResolveBiomesrandomised only the biome count (2..pool, seed-derived) and then always took the first N entries of the planet type''s biome pool indata/planets.jsonorder. The doc comment promised "so each multi-biome world differs", but worlds only differed in pool depth, never in selection: a 2-biomevariedworld was always sand+grass, and a tail entry could never appear without all the entries before it.This PR adds a per-world Fisher-Yates shuffle over the pool (seeded from
PlanetSeed, so it stays deterministic and server + client preview agree) before the firstcountentries are taken — which biomes a world gets now varies as well as how many.ResolveBiomesandBiomeResolvedbecameinternal, withInternalsVisibleTofor the test project, so the selection logic is testable without generating chunks.Compatibility
Only newly generated chunks are affected. On existing worlds, terrain generated after this change may use a different biome set than neighbouring already-persisted chunks — same class of change as the beaches/landforms releases.
Test plan
dotnet test -c Release --filter Category!=Slow— 1377 server + 147 client green locallycloses #696
🤖 Generated with Claude Code