• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Android Mobile passive timers?

N

Neodare

Guest
Hi all,

I am looking for some help conceptually with passive timers in mobile games. For example I am looking at creating a simple game similar to Fallout Shelter where you can harvest/gain resources every X minutes, regardless if you are actively playing or if the app is closed. I am struggling to know what this type of timer this would be and how to do this offline?

I was thinking that you would save the date/time when the resource is started and then compare the current date time and if the date diff is greater than the resource duration you would then award the resource? Am I going down the right path or is there a better way to do this? Also what GM2 functions would be helpful for this?

Thanks!
 

NightFrost

Member
Yes. If the timer needs to persist between play sessions, you have to save the start time to a file, and when the game is lauched again you load the data and compare it to current time to get amount of progress.
 
N

Neodare

Guest
Yes. If the timer needs to persist between play sessions, you have to save the start time to a file, and when the game is lauched again you load the data and compare it to current time to get amount of progress.
Thanks for the reply and validating my thought process.
 
Top