Resource based game

Talk about game designs and what goes behind designing games.
Klown
Posts: 89
Joined: Tue Feb 22, 2011 5:59 am

Re: Resource based game

Post by Klown »

upix wrote:i need help to create a code that will add constantly resources even the player is not online.
problem is that I can not install on my server, any program type Crono, I available only a scheduler function on a server that in can run a file at 1 hour interval.

Ex:

food= [food_current +(food_id * food_workers)] -(food eaten in the time interval)

thy for help
ive actually come across this sort of a problem in my game where i need to add stamina to a player even while offline. my solution:

save a timestamp in the resource table, then each time the player is active ie: logs in or performs an action on a page,

create a function that compares the current time and the saved timestamp in the resources table. then you can write some code that will say: divide the number of hours passed between the current time and the timestamp; then you can multiply the resource gain or loss by the number of hours passed.

in essence youre creating an "on view" version of a cron rather than rely on a cron itself.

hope this helps you.
if( $myGames != "Crap" ) {
  • please_donate( $money );
} else {
  • just_enjoy();
}
Post Reply

Return to “Game Design”