I am working on this game, and it is a kind of browser-based RTS. There is a building cache where you put buildings in to upgrade them. Most upgrades will take at the bare minimum a few minutes. What i want to do is show in that building cache when the building will be complete and how much time is left on a count-down timer. I am trying to figure out the best way to do this.
Does this sound logical:
They click the upgrade button and the building goes to the game-wide building cache database, which is ordered ascending of which building will be completed first. When they click on the button to see the buildings in the cache, it will send a request to the database requesting the completion times of all their buildings. The count down timer will show how long until the building is done and it will be accurate within 2 seconds. When the timer hits zero, a query will be sent to the database that removes all the completed buildings, and the page is refreshed by the Javascript timer.
Does this sound efficient to you?
It will work in clearing out the database becuase every time the building cache page is loaded, it sends the command out to remove all completed buildings before it even calls on the persons unfinished buildings. So if no one at all is logged on for 5 days, buildings that finish anytime in that five days won't be removed until one person checks on their own building cache, then all completed ones will be gone.
Thanks,
-Nick

Does this sound logical:
They click the upgrade button and the building goes to the game-wide building cache database, which is ordered ascending of which building will be completed first. When they click on the button to see the buildings in the cache, it will send a request to the database requesting the completion times of all their buildings. The count down timer will show how long until the building is done and it will be accurate within 2 seconds. When the timer hits zero, a query will be sent to the database that removes all the completed buildings, and the page is refreshed by the Javascript timer.
Does this sound efficient to you?
It will work in clearing out the database becuase every time the building cache page is loaded, it sends the command out to remove all completed buildings before it even calls on the persons unfinished buildings. So if no one at all is logged on for 5 days, buildings that finish anytime in that five days won't be removed until one person checks on their own building cache, then all completed ones will be gone.
Thanks,
-Nick
