kaosjon Posted February 21, 2012 Share Posted February 21, 2012 Hi, i am thinking of creating a text based game mmorpg using php/mysql etc... I know that a lot of these types of games use a tick based system, but i want it to be realtime, the only game i cna find that uses this is Torn, does anyone know how they make it realtime? I know that ticks can be controlled by cronjobs, but how about realtime? The problem is that the game might involve the player building a house, in a tick based system it could be easy to manage by saying the house will take 3 ticks to complete, but i want the house to be like in 10 minutes of 32 minutes, how can i do this. Someone said to check whenever the player next logs in to check if the house has finished and then say it has been built, but seeing as it is an mmorpg it could affect everyones gameplay, not just the person building it, so this will not work. Thanks and sorry if this is a bit confusing. Quote Link to comment Share on other sites More sharing options...
Psycho Posted February 21, 2012 Share Posted February 21, 2012 Well, using your example as a starting point, all you would need is a timestamp field in the DB for the "completed_ts". So, when a user selects to build a house you would set the timestamp to 10 minutes in the future. Now, whenever someone is doing something that requires you to provide a list of completed houses you would simply add a condition to the query to only show the ones where the "completed_ts" is >= NOW() So, to restate this another way. Instead of trying to UPDATE records as they change status after a certain time, simply save values for the records that will determine when they change state. You can then SELECT the records based upon those that make sense based upon context. For example, other users may not be able to see houses that are in the process of being built. but, users can see those that they are building. Quote Link to comment Share on other sites More sharing options...
Brero-San Posted April 24, 2012 Share Posted April 24, 2012 by tick based do you mean like this game? http://tinyurl.com/DuneWars I use a tick based system in my (COMING SOON) website,for realtime all you would need to do is set a cron to run every few seconds. in your MySql databas, the houses table add a colomn called timeLeft set and remove time each time it crons, when timeLeft = 0 the house is done sorry for the rushed post, dont have much time 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.