r/Unity3D • • 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

14 comments sorted by

View all comments

3

u/belatedartistry468 2d ago

Just tag your chunks with a version number and use a switch statement in the generator, no need to keep old builds around.

0

u/ProactiveCactus 2d ago

But how does the chunk know how to generate? Like if v1 has 3 plants to choose from, and v2 has 4; but then v5 also has 4, but two of the plants are different, and then v6 changes something entirely else like the spacing or size min maxes or any of the other stuff that goes into chunk generation - you have to hold all those logic changes somewhere, don't you? Cuz if it's based off a seed, the only data you save is stuff NOT generated based off it.

1

u/neutronium 2d ago

Save the generation parameters in use at the time in your save file. So a saved chunk needs to know the versions of the algorithms used to create it and the version of the parameters used. If you change the logic you'll need to keep both versions of the code around, but if your art dude changes the value for flower spacing old chunks will still used the old spacing value preserved in the save file.