Time Management Games, or "Tap and Wait"

I’ve an interesting concept for a twist on the current tap and wait style game (Simpsons Tapped Out, Farmville, Hay Day, Family Guy Quest for Stuff etc.) but am having trouble knowing where to start within Unity.

I have already created an Android game with Unity so please don’t read this as “how do I start game dev” post. My issue lies with having the ability to set a timer and have it count down despite the game being closed (or even the phone off). I will want notifications that the timer has finished eventually, but that can wait for now.

If anybody can point me in the right direction on this, it would be greatly appreciated.

Thanks

Hi Ibzy, I’m curious if you ever found the solution you were looking for?

One way to do this is to save the time the game was closed, calculate when it would finish and schedule a local notification for that time. When the player goes back into the game, cancel the notification if it has not already expired and update the progress on the timed action, based on the time that has elapsed since they exited.

Hi Avaran, I figured that the best way (for me at least) was to set the start time and run time of the action and store it somewhere (player prefs, your own database etc). I would then calculate the difference between start and “now” and see if it was >= the run time. This would allow for people to set their clocks forward to bypass the timer, but i think most approaches have a back door like this.

As for notificaitons - still no clue :slight_smile:

Good luck!

Using the same approach you are writing about, I used Neatplug’s Native Notification Plugin for Android and Unity’s Local Notifications on iOS. You just schedule the notification OnApplicationFocus or something to the end time you already calculated.

1 Like