Saving everything vs saving changes in infinite world
Okay, first of all, let's say that I do not care how big my world save file will be.
So what is faster? Having same seed and generate chunks only once then save them (16x16x16 size 3D arrays) OR save only changed blocks in those chunks, and if nothing was changed just leave it without saving, once you visit it again it will regenerate it on run and if it happens to be edited then it still generates new chunk but applies changes from save file? (save files are .bin files for every chunk named after chunk coordinates)
This is voxel based prototype and I would like to implement multiplayer soon, so which one is better to use? Or is there better way which I don't know?
I'm not sure how you plan to save every block in an infinite world, by definition it is impossible, I'm pretty sure you will care about file size when it is also infinite!
Answer by Winterblood · May 02, 2016 at 12:12 AM
Well, you're going to have to have a mix of both anyway. You can't pre-generate an infinite world, so you'll have to procedurally create new areas that the player explores on the fly. But if the player can modify the world at all, you'll need to save all the modified chunks.
Store a flag on each chunk to note whether it has been modified by the user, and save only those - this will keep your save file and network sync data as small as possible. Unmodified chunks can be regenerated as if it's your first visit. I wouldn't bother trying to save the changes within a chunk - either save the whole thing or don't. Keep it simple.
Your answer
![](https://koobas.hobune.stream/wayback/20220612075949im_/https://answers.unity.com/themes/thub/images/avi.jpg)