[mysql] Time que for game.
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: [mysql] Time que for game.

Hybrid View

  1. #1
    Join Date
    May 2010
    Posts
    14

    Question [mysql] Time que for game.

    Hi,

    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.

    Tx!

  2. #2
    Join Date
    May 2010
    Posts
    14

    Re: [mysql] Time que for game.

    I think i found a solution witht the help of another forum. I should not do a query every second but only when needed. For example when the page loads make a timer that activates the update/insert query when the time is finished or already passed.

    But i still like to hear it if you would take a different approach.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center