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 / Trapping exit and saving state... I must be missing something simple

Author
Message
EarwigTC
11
Years of Service
User Offline
Joined: 3rd Sep 2012
Location:
Posted: 4th Sep 2012 05:59
I have been working with AppGameKit for a while, and have just hit the point where I need to accommodate saving my game's state on exit or loss of focus. I can't figure out how to do this.

How do I trap for the app losing focus or the app exiting, so that I can make the file calls that will save my game state?
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 4th Sep 2012 13:31
I have an app in development where I must know the last state if it crashes, or if the network fails. I have a regular update to a file of the current state, so that it is always recoverable to within a few seconds of the last action.

I have tried to normalise the data as much as possible. Where there are a set sequence of events, I save the events once, then save the index of the current event every time it moves forward through the sequence. Game config is saved at the start, and any extraordinary events are saved when they happen, or at specific intervals if they occur too often to practically save all changes.

EarwigTC
11
Years of Service
User Offline
Joined: 3rd Sep 2012
Location:
Posted: 4th Sep 2012 16:19
(Forgot to mention I'm developing Tier 1)

That's a little disheartening. The only option is to perpetually save? Can anyone confirm this?

Even other cross-platform options like Adobe AIR can execute code when switched to background or closed by a non-multitasking OS, like old iPhones.
EarwigTC
11
Years of Service
User Offline
Joined: 3rd Sep 2012
Location:
Posted: 4th Sep 2012 23:40
I found the GetResumed() command, by methodically searching through all the commands (wish these sorts of fundamentals of game management were summed up somewhere!), but I still have not found a method for writing files before a graceful termination by the OS.
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 17th Sep 2012 20:18
The GetResumed() command only works on Android devices.

I have a nice Tier 2 method set up for catching when an app comes back from the background, but it won't translate into Tier 1 apps.

Cheers,
Ancient Lady
AGK Community Tester

Login to post a reply

Server time is: 2024-05-01 00:02:59
Your offset time is: 2024-05-01 00:02:59