Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Jacho_Mendt · Dec 29, 2016 at 05:35 PM · save dataprocedural generationloading file

How do I save and load big procedural generated terrains?

Hello, After some calculations, I discovered that a save from my game could potentially be as big as 160-200MB. That's because I'm saving the heightmaps and the other maps from a procedural generated terrain that allows editing from the player and altough the terrain is limited in size, it is still quite big.

I have already read how to use the Serializable tag to correctly save the informations I need, but accessing such a big file every time I load a game seems like a waste of resources, especially since the player would only need, say, few MBs out of it to load its position.

My question is, is there any way I can access the file at specific indexes or partition it so that I don't have to load the whole file every start of the game?

I read something about how Minecraft handles this, but it is not perfectly clear to me. Is there any C# library that allows such manipulation of files? Keep in mind that i cannot save just the seed, because the player would lose the edits he's done, and that I already have reduced all the maps and data to a bare minimum (the terrain is, as I said, pretty big, about 16kms^2)

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Guppie1337 · Dec 30, 2016 at 03:10 AM 0
Share

$$anonymous$$aybe not the best solution, but I hope this can help. I believe it's intended for 2D tilemaps, but it may work for your case as well. Store tilemap data

avatar image RobAnthem · Dec 30, 2016 at 05:36 AM 0
Share

If you are using a chunk-loading system you can do what $$anonymous$$ecraft did and write chunks on unload. You could also make a heightmap image of the terrain and/or some info about any game objects put into the terrain via an image-map or whatever. Plenty of ways without saving the actual terrain, if you are saving it of course chunk loading seems optimal because there is no way a 200mb terrain file can all be viewed at once or it is by default already too large for necessity.

avatar image PizzaPie · Dec 31, 2016 at 12:58 PM 0
Share

Save the behind the scene info,whatever you use to generate the terrain. When you load, you feed the algorithm that creates the terrain with that info and should produce the same results. For loading chucks of the whole thing you can feed it only the coordinates you want so it won't have to reproduce all the terrain. Saving the whole thing while you have a way to reproduce it is a waste of space because you ll have to save the terrain and the info behind it, that way you keep only the info which should be extremly smaller but of course it will take a toll on the cpu while it creates the terrain.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Andros_Spica · Jun 24, 2017 at 10:53 AM

Hi @Jacho_Mendt, There is a possible solution in this tutorial by AlexStv. It allows you to save memory by serializing only the edits while rebuilding the terrain from seed I've followed the whole tutorial a year ago, so you probably won't have major problems with the current Unity version. Cheers!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

8 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Share creations with friends 0 Answers

My app generates a binary file but either fails to save data or load it || Unity for Android 1 Answer

android data doesn't save on 2nd launch 1 Answer

How to save a 2D-grid of instantiated GameObjects in C#? 1 Answer

Save/Load System not working 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges