Jump to content
  • Advertisement
Sign in to follow this  
Hernanduer

A Turn-Timer

This topic is 4065 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

ok, heres the deal. I'm creating an online strategy that is based around turns. Turns are processed every 30-sec but I cant figure out how to get PHP to update ALL of the profiles at once. Can someone help me with a way to get the script to update all the profiles at once and not just one?

Share this post


Link to post
Share on other sites
Advertisement
Well, I don't know PHP, but whenever I need something to process everything, I just make sure they're all in a data structure of some type (linked list, for example), and have it go through them. A linked list would probably work for this, it should give you enough power to manipulate each player sufficiently, and gives you an easy way to run through every one. Since there won't ( I assume) be many players, the inefficiency of searching through it should be insugnificant. Not sure if this is what you need/if it will work for what you're doing, just my way of doing things.

Share this post


Link to post
Share on other sites

$result = mysql_query("SELECT * FROM profiles");
while ($row = mysql_fetch_assoc($result)){
// your data is in an array in $row
mysql_query("UPDATE profiles SET junk = 'data', morejunk = 'more data' WHERE id = '" . $row['id'] . "'");
}


Assuming you're using mysql and your game is setup the way I think it is. You're not giving me much to go on.

Share this post


Link to post
Share on other sites
You might have to use a cron job or run a central server script with a thread that ticks through, locks the database, and updates the timer data.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!