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

  • Home
  • SEARCH
  • 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 1025573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:56:55+00:00 2026-05-16T11:56:55+00:00

Im making a web game. It runs relatively in real time. Buildings produce a

  • 0

Im making a web game. It runs relatively in real time. Buildings produce a certain amount of money each hour. The amount of money varies from player to player based on what they own.

I need to make a php script that calculates how much money to add and then insert it into the DB every hour, this would have to be ran for every player.

Whats the best way to do this?

Thanks!

  • 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-05-16T11:56:55+00:00Added an answer on May 16, 2026 at 11:56 am

    The problem with using a cron job for something like this, is that it starts taking longer to calculate everyone’s money once there’s enough players to make the game interesting. The key is to find ways to break the calculation up.

    One thing you can do is add a “last_calculation” timestamp to each user, and only do the calculation when something happens where you need to know an individuals money. When a player loads a page that displays how much money they have, or when someone gives them money, are two examples of actions where you would want to do the calculation.

    Once you determine what these actions are in your case, you can have these actions check that timestamp, perform the calculation, and update that timestamp before doing whatever they were going to do in the first place.

    Doing something like this, rather than using a cron job will let your application scale better. Rather than having a massive load spike every hour when this stuff needs to be calculated, every player might simply have a fraction of a second added to their request every once in awhile.

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

Sidebar

Related Questions

I am trying to use AJAX for a web app game that im making.
I'm making a little web based game and need to determine where to put
I'm making a sort elements web game using jQuery, HTML & CSS. While everything
I am making a game in an HTML web page. How would I add
I'm making a web based game to teach users some basic Welsh using the
I'm making a web browser based multiplayer game. I've determined that websockets are the
I'm making a web game for fun with lots of forms that post data
I'm creating a humble web browser-game in PHP. I'm making a robbery section... I
I'm making a game that will function as a web app, and I have
i've been making web app's and working with various server side language like php,

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.