Page 1 of 1

How to make Counter Timers

Posted: Tue Jul 29, 2008 9:43 pm
by AmareshinO
Hi, im from brazil and my english is not so good.


So, Im creating an MMORPG with some friends.. all the ideas of the game are doned.

Maps, Tables (mySQL), and all the systens (Battle, Market, and others)

I need to know how can i use timers...

Expemple:

If i click in the link to upgrade my Factory to level 2, it uses some resources (Iron, Gas and Uranian) and need to the upgrade delays 1 hour to br completed. in this hour the player can calcel the upgrade.

and if the player is not connected when this hour ends, the site needs to make the function to upgrade the factory to level 2.


that's the better way that i found to explain my question.


any quesntion. ask me please...

Re: How to make Counter Timers

Posted: Thu Jul 31, 2008 1:05 pm
by ghurtado
Because during that hour PHP will not be running constantly, what you need to do is store the timestamp of when the upgrade gets started, then check it against the current timestamp everytime the user refreshes the page. If the difference is less than one hour, then the building / upgrade is finished. This is how most web based RPGs work, AFAIK.