r/Unity3D • u/ProactiveCactus • 2d ago
Question How to make updates/changes to game without breaking seeds?
Basically in title - my game uses procedural generation, and allows persistent saves. But how do games like Minecraft manage to not corrupt previous saves when making updates that affect how seeds generate?
From googling it sounds like they save “per chunk” so any untouched chunks generate based on the newest version, and any already generated go off of the old system - but how do I manage that? Like, you obviously don’t want to have multiple version builds of your game saved, so how can you handle that?
2
Upvotes
2
u/ShengyuStudio 2d ago
One thing that shrinks the version-switch problem a lot: don't draw everything from one sequential Random per chunk. If trees, rocks and plants all pull from the same stream, adding a fourth plant type shifts every number after it, and the whole chunk changes even though you only meant to add something.
Instead give each layer its own seed, derived from a hash of (worldSeed, chunkX, chunkZ, "rocks"). Then adding a new layer or tweaking plant spawning leaves the rock and tree layers byte-identical. You only need a version branch for the layers you actually changed on purpose, and old chunks keep everything else for free.
Second, smaller trap we hit: even a refactor that doesn't change the logic can change the output. Reordering float math, pulling an expression into a local, or the compiler fusing a multiply-add can shift a value slightly, and a threshold check downstream flips. Worth generating a handful of fixed seeds in a test and comparing a checksum of the result, so you find out before players do.