Jump to content
  • Advertisement
Sign in to follow this  
Deele

[web] Background processing of data

This topic is 3162 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a question regarding web browser games. You have seen many games, that has some income stuff, that enables you to make some resource income, you build something, you have steady income, for example, 5 points of gold, and at the same time, we have a possibility, to look at other people accounts and see their current gold. That means, we need some bacground process, that is doing, like every second, run through all database, and adding those 5 points to some data field. What happens when we have 1000 users, maybe 10 000. That makes a big load for server. What happens, when we want to add 10 different values to 10 different data fields, that are calculated from 30 different other fields in database, and we want to do that for each user of game? I don't understand, how they manage to get all of this working, in all of those broswer games around. Maybe there is some special way to do that and that is not time consuming? maybe some algoritm, that calculates those values only then, when another user is asking for it? Please, share your knowlage about this process.

Share this post


Link to post
Share on other sites
Advertisement
An approach I've seen suggested before is to just timestamp the data in the database. You only perform global updates when someone loads a page.

So on page load:
find timestamps that are old
update the values by the total delta time that has passed since last update

The alternative is a chron job script that does this for you. What you are talking about is very trivial addition/subtraction/whatever. As far as CPU load is concerned the total update could probably be done millions of times a second.

-me

Share this post


Link to post
Share on other sites
You're talking about an MMO. There is no "easy" way. Use the DB to do the hard stuff, if you can:


update userdata, userproduction set
userdata.resource = userdata.resouce + userproduction.production

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!