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 deathripper · Sep 22, 2020 at 09:57 AM · save data

Save / Load multiple stages

Hey guys,

I have a small question...

Consider the following mobile game: - Players can purchase multiple books - Each book contains up to 30 pages - Each page contains a type of minigame with a unique progress as well as a score which gets calculated upon completion.

If I want to create a save / load funtionality now what is the beste approach, having a single save game data that save all the data or having individual save games for each book or even every single page ?

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Bunny83 · Sep 22, 2020 at 01:15 PM

That's entirely up to you. Each approach has some advantages and disadvantages. The most robust solution is of course using seperate files for each "stage" / minigame, especially if the data is quite unique to each minigame. I haven't really worked with iOS but on android you can also create subfolders in the private space dedicated for your app. So you can make a savegame folder with a sub folder for each book and have a single file for each stage / minigame.


By more robust I mean when you have everything in one file, if anything goes wrong when saving, the file might get corrupted and all is lost. Also having everything in one file increases the number of data that has to be written / rewritten to disc whenever you want to update the save state. So you would probably even do the flash memory of your users a favor.


Of course having multiple seperate files makes it a bit more difficult if you need to work on all data at once. Though it's also possible to seperate plain highscores from the actual saved gamestate. Since you calculate the score only once on completion it probably would make sense to store it in a single file.


Note that there is almost never a one-size-fits-it-all solution. The choice which approach you want to use depends on many factors. Specifically:

  • how much data does each minigame has that need to be saved?

  • how often do you wish to save the state? (once a second?, once every minute?, once every session?)

  • How much of that data is later used at once? So is the gamestate only relevant for each minigame besdes the final score?

I would most likely use json as save format for several reasons. It can essentially store any kind of data structure, so it's relatively easy to adapt for each minigame. It also makes debugging much easier as you can read and test modify the saved data easily. Of course I would probably use my SimpleJSON framework as it would allow me to easily switch between a single save game file or seperate files.


Keep in mind if you are worried about players cheating by modifying the save files, you can never prevent that, only make it a bit harder. With json as save format you can add a simple encryption / scrambling once you're done testing to give script kiddies a hard time :)

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 Bunny83 · Sep 22, 2020 at 03:42 PM 0
Share

ps: One way to scramble any data is putting it through my Huffman encoder. It might even end up being slightly smaller ^^. The great thing is that once huffman encoded it has no trace of the original text. A custom implementation like this makes it a bit harder to "unscramble". Just using base64 or zipping the data are common approaches which many recognise and can reverse.

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

135 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

I want to save my level progress in my quiz game 1 Answer

Life System need help please!!! 1 Answer

PlayerPrefs file wrong stored location 0 Answers

Where to save player progress for playstore app? 1 Answer

How to Save Object (Button) information on game restarting? please check code. 2 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