- Home /
Building game and voxels: How to save them
I'd like to create a building game but there's one part missing: Saving the creation permanently. I've been trying to find how popular games do It but I only found how Minecraft does it: It's simple because the size of the world chunks never change. Each chunk have a size of 16x256x16 and building on blank chunk create a file for the chunk... As simple as that. But in my game, the size of a chunk can change, just like Scrap Mechanic and Besiege. How to handle that? Also, each voxel chunk can have parenting (a hierarchy). And what about games that uses wall building like fornite?
If you want to save and load thing like hierarchies that have been changed during runtime, you have to implement some kind of id system in order to find the right objects again. I suggest Guid for this. Each object would have a variable with it's unique Guid and that of it's parent, if any. Saving and loading any data depends on how your data is structured and how you build your world in the first place. Basically, you re-implement these world-building steps by not using the data present in the scene when you hit the play button, but rather the data that was restored from file or memory. Think about which kind of information needs to be saved so you can use it when loading the world.
Your answer
Follow this Question
Related Questions
Why can't I build Web Player in Unity while I have no problems with building standalone versions? 2 Answers
Multiplayer and Raycasts,Multiplayer character spawning breaking build script 0 Answers
Does Unity decompress Truecolor RGBA format textures when loading? 0 Answers
How can I create and destroy objects in a Voxel game which are not square 0 Answers
Heightmap Voxel Terrain - HELP! 0 Answers