June 8th, 2010, 01:42 AM
[mysql] Time que for game.
I was wondering how to approach a building que of a weapon, building or something similar. What i want is to have the option for the player to craft items and later on buildings. The crafting would take time to complete.
What i can do is for each type that can be crafted is create a new table for it that links the userID, itemID/buildingID, and the time on finish. Then do a ajax que every 1 or 2 seconds and add the building if the time condition is met.
Problem is, this AJAX request will find 99,99999% of the time that there are no items/buildings in the que and so it's a waste of resources to do a DB query every second for each player.
Also i would like to update the DB even if the user is logged out. The building should be completed at a certain time because a building can have influence on other players. For my approach, this would mean i have to make an even heavier query for each player every second.
All this is very common in browser games but i can't seem to find any info about this. Any tips on this subject or a redirection on some good info for it is really appreciated.
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.