Want to save only Updated Chunk data only

0
Raja_Nukala posted this 05 July 2019

Hi Gareth, I wanted to thank you for the script you sent for adding/deleting blocks...it was a big help! I had another problem which I'm hoping you can help with...

I managed to generate terrain and add/delete blocks with Picavoxel. I want the user to be able to save and load the changes he has made in the Picavoxel terrain. Here is the code I'm using:

For Adding Blocks:

https://pastebin.com/MDE471zH

For Deleting Blocks:

https://pastebin.com/VYTREVMs

For saving Terrain Data :

https://pastebin.com/NxLW6h6c

For Reloading Saved Data:

https://pastebin.com/y75NZeP4

Here attaching a link to video to get know about how we are doing

https://drive.google.com/open?id=1fzOtK9w5EwO7NNOysCTy5plF6-VX9YsG

I want to save only that modified chunk data(check above video).

The problem is that I want to save and reload the changes. With the current system, it's taking too much time to save the updated mesh data and to load it in. Is there any way to save only the updated chunks with the modified data and only load in the modified data?

I'm enclosing a video for illustrating the problem, and also

4 Comments
Order By: Standard | Newest | Votes
0
GarethIW posted this 05 July 2019

I don't have permission to view the video, you need to share it publicly.

How big is the terrain? Although PicaVoxel uses a chunk system, it's really only for making updates to the meshes faster - it's not going to help with disk-streamed terrain as chunks don't have their own individual data. PicaVoxel could be modified to work this way I guess, but that's outside of the scope of what I can support.

Rather than thinking of PicaVoxel chunks in the same way you think of Minecraft chunks, you need to look at having individual Volumes as terrain chunks. That way if each volume is say 16*256*16 (Minecraft chunk size), then UpdateAllChunks() will have far less work to do, although I'm not sure you're ever going to be able to make it hitch-free on mobile if you're generating colliders.

Last edited 05 July 2019

0
Raja_Nukala posted this 05 July 2019

Here it is a link for the video:

https://www.youtube.com/watch?v=GtwZAnPcJHU

My terrain size is 128/8/800. Its working fine with good fps on faster devices.

But its taking time to save and load because the following code goes through all the chunks data.

volumes.GetCurrentFrame().ToCompressedByteArray();

but I need to save the only chunks that are modified by adding/deleting blocks. Is there any way to do that??.

Last edited 05 July 2019

0
Raja_Nukala posted this 08 July 2019

Hey GarethIW, Can you give your insights on chunk saving using

volumes.GetCurrentFrame().ToCompressedByteArray();

I'm trying to save using the above data and it's working fine but it's taking time to save and load because it needs goes through all the chunks in the terrain but I need to only save modified chunks(Add/Delete). Is there any fast way to do that. I hope you will give the best solution.

0
GarethIW posted this 09 July 2019

As I said above, you need to look into using separate volumes for terrain "chunks" if you want to save/load chunks individually. I am at a conference this week, but I am working on a new sample package to demonstrate how you might go about doing this (see screenshot). Please bear in mind that PicaVoxel was not designed for disk-streamed terrain generation, and I do mention this in the FAQ.

enter image description here

https://i.imgur.com/WaE1wmj.jpg

Last edited 09 July 2019


Our 137 members have posted 527 times in 128 discussions