• Advertisement
Sign in to follow this  

Level-Editor & Savegames: Best Save Practise?

This topic is 430 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello Forum :)!

I am developing an in-built level-editor and have a few issues.

Level-editor will be shipped to Android, iOS and Windows.

Where would you save the final level-product? Shall the user decide where? But that does not grant me any writing-permissions, in another thread I heard that Linux will in forbid to write in most folders in general.
So, what if the user gives me a folder and I still lack writing rights?
What is a good practice for this?
Is there no way to gain rights for my own folder?
My game usually scans for available levels within a certain folder and displays them for selection. So the user would have to drag and droo the file in there anyway.

On another note, when saving the same, what are you doing? Saving the file upon every change to the OS' own temp-folder?
What if the application crashes? How do you live with the guilt of poluting the temp-folder? Haha.
I heard some OS do not allow to change files once closed.

On Windows, do you use %appdata% or the document-folder for savegames?

Is there a library that abstracts all of this work for me on a cross-platform level?

Thanks a lot for your time :)!!

Share this post


Link to post
Share on other sites
Advertisement

Every OS has designated places where applications are able to write. There is often one place for application-specific data, one place for user data, and one place for application data specific to one user as well. :)

 

This is platform dependent unfortunately, so you either use what's built in to your engine, or just use the per-OS documentation.

e.g. https://developer.android.com/guide/topics/data/data-storage.html for Android, https://msdn.microsoft.com/en-us/library/dd378457(v=vs.85).aspx on Windows, etc.

 

On Windows there is sadly a ton of these 'known folders' and how best to use them is not standardised. Applications sometimes like to write their data into 'My Documents' which I find very annoying. But it's difficult to know where to draw the line; do I want program configuration data hidden within %APPDATA%, where the user generally can't even see it or explicitly choose to back it up? Maybe, maybe not.

 

For explicit "save/save as" operations, on mobile devices you usually just get given an app-specific directory and you just write in there with the filename they choose. On desktop platforms you usually open a file browser at the 'correct' location and then if they want to navigate somewhere else, that's their decision.

 

None of this would be using the temp folder. That's never suitable for saving data.

Share this post


Link to post
Share on other sites

None of this would be using the temp folder. That's never suitable for saving data.

 

Oh, I rather referred to "saving practises" at that point - preventing frustration when the computer or the application suddenly shuts down.

 

I thought about having a recovery-plan for such situations. I will also have to learn how a C++-app behaves on an android device.

Usually, people just close their game and continue it later, while that state is reached, anything can happen (update-restarts, no battery left, ...).

 

Thanks for your tips, though : )

Share this post


Link to post
Share on other sites

I don't understand why you feel you need the temp folder for handling crashes or shutdowns. If you need to do autosaves, handle that the same way as an explicit save.

 

Android has very specific requirements for how you need to handle application state, and on how to hook into the Activity lifecycle to ensure that it gets saved at the relevant times: https://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle

Share this post


Link to post
Share on other sites

I don't understand why you feel you need the temp folder for handling crashes or shutdowns. If you need to do autosaves, handle that the same way as an explicit save.

Ohhh, sorry, I just wanted to clarify why I even mentioned it.

 

Thanks for that link : )

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement