Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8023735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:38:56+00:00 2026-06-04T22:38:56+00:00

I am creating a browser-based MMO that has time-based events: I.E. the construction of

  • 0

I am creating a browser-based MMO that has time-based events: I.E. the construction of a building will take 23 hours.

I can log that in my MySQL database and then loop through an events table (or equivilent) using a cron script or watch (this question was immensely helpful).

There seems to be a general consensus that I can either:

(1) Run a cron job every second for a script that processes the events and their related triggers.

(2) Run a cron job every minute that loops every second for 59 iterations that processes the events and their related triggers.

(3) Use watch to run a php script every second.

Essentially, upon completion of an event, the script will process some triggers that range anywhere from changing states, updating databases, triggering other “events” that are queued after the recent event, and so on.

My biggest concerns come where there is the potential to have 10,000+ events and triggers to process every second. What are some strategies I could use to avoid performance concerns? Are these all of the solutions, or are there better alternatives?

Example events:

Construction of Building A - 00:43:21

Fast forward 2601 seconds and the following triggers are executed:

Place Building A on map at Location x,y
Update resource total given by building
Start timer on next building in the queue
Construction of Building B - 02:10:49

To better explain: In the early stages of the game these events will take anywhere from 5 minutes to an hour. In the later stages of the game these events will be spaced apart by hundreds of hours. I need these events to process in real time because they will impact other aspects of the game (Such as a resource structure improving the amount of resources given every hour). Thus, these events need to be processed by the server, regardless of whether or not the user is active. The theoretical script would check for expired events, and then based on the event, run several other methods related to the expiration of said event.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T22:38:57+00:00Added an answer on June 4, 2026 at 10:38 pm

    https://github.com/prggmr/prggmr

    Sounds like an event library might help you tremendously here,

    Instead of trying to have a “catch-all” that monitors all events to take place in the future you could write a simple interval in prggmr that will pick up events that need to happen in the future and register them into the event engine to signal at that time.

    Something like the following might work,

    prggmr\interval(function(){
        $query = mysql_query("SELECT event, when FROM events");
        while($event = mysql_fetch_assoc($query)) {
            prggmr\setTimeout(function() use ($event){
                prggmr\signal($event['event']);
            }, $event['when']);
        }
        // What this would do is look for any events that require signaling in the
        // in the future such as a building construction and signal it when the 
        // given amount of time in milliseconds has run
    }, 3600);
    // This simply tells the engine to run the function every minute
    

    And to run this code say it is stored in event_detect.php

    prggmr event_detect.php
    

    You would generally want to have the process managed by another app such as runit.

    With this approach you could build in all events that can happen into your application as registered “signal handlers” and have an actual gaming engine running in the background that waits for and monitors events as they happen in real-time without any user interaction.

    We are actually using this approach for a similar situation for a game we are currently developing … logically quite different but non-user interactive event processing all the same.

    Also for performance you can very easily handle 10,000 events in a second or less depending on your server.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a browser based QC/data entry app that will let people edit OCRed
I'm creating a browser-based game (MMO) with a server and client, all using PHP,
I'm creating a browser-based form verification script that checks if the input doesn't have
I am creating an internal web based application that will not be the target
I'm creating a text-based browser game and need some advice for django model structure.
I'm creating a Silverlight 4 Out Of Browser application. I have my MainPage that
I was just wondering, how would I go about creating a browser based 3D
I am creating an little hobby database driven browser based game and I stumbled
I find myself very often creating an object that has no public methods and
We are creating a browser based HTML5 application targeted for Android devices through the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.