Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Can i auto save when closing app

Author
Message
Battoad
AGK Developer
17
Years of Service
User Offline
Joined: 12th Feb 2007
Location: A Dark Place
Posted: 30th Sep 2015 11:01
Hi, my app currently reads values at start of a game, writes new values at the end of a game and then re-reads new values for the next level, however the levels are many and can be short and fast so it means quite a bit of reading and writing.

Although this works fine I would prefer only to have to write once, when the app closes, but without using an "exit" button, i.e. just using the phone/tablet back or home buttons I cannot think of a way to do this.

Although I am going to publish 1st to android, I understand "exits" are not allowed on some OS, so would prefer not to have to use one.

Does any one have an idea on how this can be achieved using tier 1 AGK2?
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 30th Sep 2015 12:06
its allowed to let the app running because the os can put it into a pause mode and if needed it can remove this task self.
if u use end at android its possible the app is still listed in app list for a quick restart.
i prefer ending all apps because the users do not want have apps in background.
maybe use a time based autosave with symbol / progress and or a save menĂ¼ button.

AGK (Steam) V2 Beta .. : Windows 10 Pro 64 Bit : AMD (15.7.1) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 30th Sep 2015 12:11
Writing is fast on mobile devices, because they use flash memory. Unless you are writing megabytes of data, it will not be noticeable.
Even on PCs with hard drives, writing is fast through caching and other technologies used.

It's also a good idea to write often, in case the program crashes or ends unexpectedly. Then the user loses less when they restart.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt
Battoad
AGK Developer
17
Years of Service
User Offline
Joined: 12th Feb 2007
Location: A Dark Place
Posted: 30th Sep 2015 13:05
Thank you Markus and BatVink.

@ Markus. I think the timer based auto-save is a possibility for me together with a manual save when players want to. Although not a perfect solution, its still good.

@ BatVink. I am more concerned about wearing someone's flash memory out rather than being concerned about speed. Data here is fairly small so is performed without noticing but I have read that flash memory can wear out after as little as 10,000 re-writes. My app could in theory write new data after a quick 1 minute level, although again it could take 10 minutes to complete depending on skill and luck. If I take the worst case scenario of writing 60 times an hour, playing 1 hour per day is less than 6 months flash usage even if we ignore any other apps writing. I hope my understanding is completely wrong because this doesn't sound very good for any similar app which needs to write to file, although personally I have never experienced flash memory failure.
Quote: "It's also a good idea to write often, in case the program crashes or ends unexpectedly. Then the user loses less when they restart."

Sound advice but its trying to get the best solution without consequences.

Both posts appreciated.
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 30th Sep 2015 15:35 Edited at: 30th Sep 2015 15:35
Flash/SSD technology has moved on a lot since the days when it was claimed it would wear out quickly (but have you ever seen it happen?)
How many emails, texts, images, web pages, FB messages, Instagram etc does the average person download a day? Probably many hundreds of times more than you will be saving.

I am a long time sufferer of making things efficient and starving my apps of resources. So I know how hard it is to breakaway from the mindset and being a little more carefree!

This is my SSD drive after 3 months, including 2 reloads of my 120GB OS drive, an upgrade to Windows 10 and multiple installs/reinstall of programs...

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt

Attachments

Login to view attachments
Battoad
AGK Developer
17
Years of Service
User Offline
Joined: 12th Feb 2007
Location: A Dark Place
Posted: 30th Sep 2015 16:02
Quote: "This is my SSD drive after 3 months"


Wow, still perfect.

Quote: "So I know how hard it is to breakaway from the mind set and being a little more carefree!"


I'm so glad that you followed my thread through as I was getting concerned about how many times my app may write, but you have put my mind to rest.

Its not only simpler for me not to change my program but as you said earlier;
Quote: "It's also a good idea to write often, in case the program crashes or ends unexpectedly. Then the user loses less when they restart."
.

I think I will leave it as is so thank you for your advice.

Cheers
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 1st Oct 2015 11:36
My opinions (and they are only opinions, I'm happy for opposing ideas to be thrown into the debate ) come from my more unusual experiences in the IT industry. They have left me scarred for life, always wanting more efficiency . I have never get as low as 60FPS in a game, so my efforts are generally wasted.

In the 90s I was trained by a guy who wrote some of the original interpreters on IBM midrange machines (the ones that number crunch at phenomenal speeds and make M$ SQL server look like a toy).
He taught us weird things like...always fill a fixed size array from end to start, and never deliberately write an SQL statement that returns no rows.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Quidquid latine dictum sit, altum sonatur
TutCity is being rebuilt

Login to post a reply

Server time is: 2024-11-25 17:31:12
Your offset time is: 2024-11-25 17:31:12