[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.

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 on other sites
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.

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 on other sites
That's a quite a bit of algoritm to create...

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

1. 1
Rutin
44
2. 2
3. 3
4. 4
5. 5

• 13
• 10
• 12
• 10
• 13
• Forum Statistics

• Total Topics
632997
• Total Posts
3009791
• Who's Online (See full list)

There are no registered users currently online

×