Skip to content

fix(worldgen): shuffle which biomes a multi-biome world uses, not just how many - #697

Merged
marceld23 merged 1 commit into
mainfrom
fix/biome-subset-shuffle
Aug 3, 2026
Merged

fix(worldgen): shuffle which biomes a multi-biome world uses, not just how many#697
marceld23 merged 1 commit into
mainfrom
fix/biome-subset-shuffle

Conversation

@marceld23

Copy link
Copy Markdown
Owner

Summary

ResolveBiomes randomised only the biome count (2..pool, seed-derived) and then always took the first N entries of the planet type''s biome pool in data/planets.json order. The doc comment promised "so each multi-biome world differs", but worlds only differed in pool depth, never in selection: a 2-biome varied world 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 first count entries are taken — which biomes a world gets now varies as well as how many.

  • ResolveBiomes and BiomeResolved became internal, with InternalsVisibleTo for the test project, so the selection logic is testable without generating chunks.
  • 2 new tests: membership varies across seeds (some world skips the first pool entry, every pool entry appears on some world, no duplicates, count stays 2..pool) and same-seed determinism.
  • TODO.md updated.

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 locally
  • Solution builds with 0 warnings in Release

closes #696

🤖 Generated with Claude Code

…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]>
@marceld23
marceld23 merged commit f560f6b into main Aug 3, 2026
12 checks passed
@marceld23
marceld23 deleted the fix/biome-subset-shuffle branch August 3, 2026 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Worldgen: multi-biome worlds always use the first N biomes of their pool - subset is never shuffled

1 participant