apw Posted August 25, 2009 Share Posted August 25, 2009 Hello im working on a script for a web-based game that uses real-time for player building, production, etc. My question is this possible with php or would i need a 3rd party script such as java to do these real-time actions. The times would be hard-coded and not in the datbase Quote Link to comment Share on other sites More sharing options...
kickstart Posted August 25, 2009 Share Posted August 25, 2009 Hi Probably depends on how close to real time you want it to be. Using regular CRON jobs you could come up with something close to it, along with careful design so that when anything is affected it updates its fields. However I don't believe php supports firing off threads. All the best Keith Quote Link to comment Share on other sites More sharing options...
geudrik Posted August 25, 2009 Share Posted August 25, 2009 apw, Out of curiosity, why would you not store the dates in a DB and then use php to alter them? If you keep datetimes in a DB, you'd be able to have countdown timers for when something completes Keep in mind that you're going to need a whole host of different variables based on the user. With many users, comes an exponential growth in variables. Keeping them in a database I think would benefit you, and then you could simply use JS as a timer, grabbing the starting and end times from the DB. Hope this helps. Quote Link to comment Share on other sites More sharing options...
apw Posted August 25, 2009 Author Share Posted August 25, 2009 The real-time for the game would actually be a countdown timer at differemt times based on the level the player has gained on certin buildings such as level 1 would be 40 seconds then the next would be 1minute-30 and so on .. Quote Link to comment Share on other sites More sharing options...
kickstart Posted August 25, 2009 Share Posted August 25, 2009 Hi For things like that just use Javascript to count down (it is merely there for display to the user). If you want you can reload the page using Javascript when the timer reaches 0 (and then do required table updates from the php script you call to do the update). All the best Keith Quote Link to comment Share on other sites More sharing options...
apw Posted August 25, 2009 Author Share Posted August 25, 2009 Geudrik, i wasnt aware that i was able to store simple times such as 40 seconds or 1minute-30 in a database but i do se what your saying about stamping the time then adding an end-time of x-min/sec to this which would work also im just not sure about the js countdown being fed the times through my database yet Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.