Jump to content

How to use real time instead of a tick based system


kaosjon

Recommended Posts

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 2 months later...

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 :D

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.