Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 janzdott · Feb 04, 2013 at 11:25 PM · savesavingdatacustomminecraft

Advice about saving complex data (Minecraft-like game)

Hey everybody. Lately, I've been writing a voxel engine for Unity, very similar to Minecraft. It's coming along very well, and I'm writing the engine separately from my game, so I will release the engine on the asset store when I feel it's ready.

I've been thinking about how I will be saving data. The world is generated pseudorandomly, meaning that the same seed will generate the same world every time. Because of this, only the blocks that are changed by the player must be saved. The world is broken up into smaller "chunks" of terrain. Like Minecraft, the world is infinite, and chunks are generated as the player explores.

Minecraft saves chunks in "regions", which are just large groups of chunks. I'm thinking that would be a good approach. Each block is stored as a byte and can be accessed via a 3 dimensional byte array. So I need to save which blocks have been changed in each chunk. But I've never had to save any custom data. I've always used playerPrefs, but I don't think that's an option here. I know you can use xml files to save some things, but I don't know much about that. I was just wondering if anyone had some good ideas? Any help would be greatfully appreciated.

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 DaveA · Feb 04, 2013 at 11:33 PM 0
Share

A fan of voxels, wondering how your's will be different/better than those on the Asset Store now? Although this may be a discussion for another forum perhaps.

avatar image janzdott · Feb 05, 2013 at 04:16 AM 0
Share

I'm making the engine VERY easy to use. Everything to get the game running will come by default. (Import the package and click "create new world". Then you can click play, and it will work). And engine settings and world data are all be changeable in the editor, without touching code. Just a few mouse clicks to add new types of blocks, and to assign textures to blocks. Custom blocks (not cube shaped) can be added just by specifying a mesh. VERY easy terrain generation, where you can create and change parameters right in the editor. There will also be the option to write your own terrain generator if the default one doesnt provide enough functionality. It will most likely be compiled into a dll, so C# or unityscript can be used. I will also include full documentation. I'm making this for a mobile game, so its optimized but no fancy graphics, sorry :/ I will release free versions as I make more progress. But the finished product may or may not be free.

avatar image Fattie · Feb 05, 2013 at 06:45 AM 0
Share

you need UNity Serializer, which everyone uses. amazingly it is free. google Whydoidoit Unity Serializer

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by DaveA · Feb 04, 2013 at 11:33 PM

The format doesn't matter. If this is not web-based, you can use .NET file and stream classes to read/write whatever data you like (binary I would think).

Comment
Add comment · Show 1 · 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
avatar image janzdott · Feb 05, 2013 at 03:54 AM 0
Share

Well, for each chunk that has been modified, I need an array of the changed blocks. The array will have to hold the blocks' positions and a byte for what kind of block it is. And I need very fast access to individual chunks that have been saved. It also has to be able to check if save data exists for that chunk or not. If I were to write a binary data file, how would this work?

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

11 People are following this question.

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

Related Questions

Saving player stats for each level, static class or not ? 1 Answer

Efficient data saving? PlayerPrefs vs. XMLSerialization 1 Answer

How to structure my project so that I can save/load information? 0 Answers

How do I quickly save a large number of variables? 5 Answers

Saving and loading game with PlayerPrefs 1 Answer


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