Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Time Dependent Events in Browser Games

Time Dependent Events in Browser Games

Scheduled Pinned Locked Moved Web Development
questiondatabasegame-devtutorialannouncement
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    il_manti
    wrote on last edited by
    #1

    I've been designing a browser game and things will take some (Real) time to complete in-game. I've checked out Travian and that's how it works too so I've been thinking of a viable way to do this. I came up with the following solution... maybe you can give me some tips (whether its viable or not, and if there's any other way to do this). Have a windows service running all the time. Whenever the user does something which will need time to complete, it is inserted into a table with the action and the time of completion. Every second (I was thinking of having 15 second increments in event completion time so I don't need to hit the database every second) the service checks the table and accomplishes any events which are past their completion time. Additionally, on the user's end there will be an AJAX timer that updates the page whenever needed. I dunno, I'm seeing some problems with this (like for example, how can I update the user's page when the event completes if its completion is not actually being done by the page?). Cheers.

    In life truth does not matter. What really matters is what others believe to be the truth. (The Up and Comer - Book)

    P 1 Reply Last reply
    0
    • I il_manti

      I've been designing a browser game and things will take some (Real) time to complete in-game. I've checked out Travian and that's how it works too so I've been thinking of a viable way to do this. I came up with the following solution... maybe you can give me some tips (whether its viable or not, and if there's any other way to do this). Have a windows service running all the time. Whenever the user does something which will need time to complete, it is inserted into a table with the action and the time of completion. Every second (I was thinking of having 15 second increments in event completion time so I don't need to hit the database every second) the service checks the table and accomplishes any events which are past their completion time. Additionally, on the user's end there will be an AJAX timer that updates the page whenever needed. I dunno, I'm seeing some problems with this (like for example, how can I update the user's page when the event completes if its completion is not actually being done by the page?). Cheers.

      In life truth does not matter. What really matters is what others believe to be the truth. (The Up and Comer - Book)

      P Offline
      P Offline
      Paddy Boyd
      wrote on last edited by
      #2

      You would need to have the web page poll every so often as well, to check if the event is complete (using the AJAX timer, which you already mentioned)?

      I 1 Reply Last reply
      0
      • P Paddy Boyd

        You would need to have the web page poll every so often as well, to check if the event is complete (using the AJAX timer, which you already mentioned)?

        I Offline
        I Offline
        il_manti
        wrote on last edited by
        #3

        Or I could have a javascript timer to display a countdown and then once that is over the page would refresh?

        In life truth does not matter. What really matters is what others believe to be the truth. (The Up and Comer - Book)

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups