There is this certain functionality that I want in my game that I'm having trouble with.
In detail, here's what happens:
The user clicks an action
Then a time limit will commence
After the time limit, then a script will run and the changes will take place.
I've heard of cron jobs but these changes are not in a set time. It depends on when a player makes a move or something.
Here are the possible ways I can think of carrying this out:
You save the time when the user makes a move, and when the user checks back again, there will be a script that will check if the time the user made a move and compare it with the current time. The problem with this is that, I wan't the changes to take place even when the player is offline. With this method, the changes will only happen after the player checks back again.
A cron job will do the above action of checking the time the user made a move and compare it with the current time. Probably every 30 minutes or every hour. The problem with this is, won't this be too much for the server? And still, it will be every 30 minutes or so. Will this be possible too if done in seconds?
A combination of the two. A cron job will check every hour and it will also check every time a user logged back in.
Of course these are the solutions I can think of using only cron jobs. I don't know if there is any better technology out there. I do hope that there is a better way like actually running a script after a certain amount of time elapse after an action even when offline. If there is, tell me. I'm talking server-side here ok.
Yeah, anyone can help me out with this?