Hey, so i'm sure we've all seen the popular games like "Mobsters Vendetta" on facebook or "iMobsters" for iOS and Droid; but i had a question, how do these games automatically restore the users energy and stuff when the user is offline. I know it's a server side script, but for the life of me, i can't think of any rational way someone would do this.
Does anybody have any ideas?
What we know:
- Would be updated using a server side script on a timer.
- Updates to a database.
This post has been edited by LilGhost: 18 March 2013 - 08:51 AM
As Modi123_1 said, you could make it a part of the login process, which would eliminate having to calculate peoples energy levels over and over again, even for people who has chsoen to quit the game. Another solution could be to use a cron job (or pseudo cron job, like wordpress), and do the calculation from there. I think those are you options, for timing the operation. When it comes to the operation itself, do as modi said, figure out how much energy the user gets per a specific time period, and then see how many of these periods has occurred since last energy calculation.