Run a countdown as in some online games
I would like to find a way to run a countdown like in some online games.
Let me explain:
The player launches action X, he has the choice (30 min, 1 hour, 2 hours, 10 hours) ...
For example he chose 2 hours, the meter displays: you still have 2 hours to develop the competence Y.
From there things get complicated, I:
- Can make a statement to the second: 1h 59min 59sec ... 1h 59min 58sec ... 1h 59min 57sec ... etc., until the end of time remaining
- Can resume the count if the player changes the page and then returns to the page counter
- At the end of the meter run a SQL query that will update the jurisdiction (even if the user is not logged): not an action the player to start the query ...
Can you enlighten me on the technique used?
Re: Run a countdown as in some online games
What kind of program? Traditional program where there is a file ".Exe" on a machine (and if so with what OS and programming language), or a program client server type where there is a part of the program on a server, and another part at the user (and in that case with using a web browser or another solution)?
The more complicated is the case of client server, because the clock must be enabled on the client side. For an Internet application, it can be done with a timer that makes regular or submit with Ajax.
Re: Run a countdown as in some online games
Its client server (php/mysql) and a web browser.
For me the counter is not complicated (experienced during the base end date + javascript function that count, it must be able to do), the most complicated being launched at the end of time the query that will come to update the skills (even if the user is not logged) and then I see nothing.
Re: Run a countdown as in some online games
The meter is handled server side, not client side (risk of hack). When you generate your php page, you initialize counters with JavaScript. For the management of the end of the application, I would rather the reverse. Since we launched the jurisdiction, we add a base line saying that the comp will be active from 12:43 ET 27s