How does the engine of a webgame works? I'm thinking of games like tribalwars, grepolis and forge of empires.

How does that keeping alive work. I mean, a user is building an building, and quit the browser... The building is built even when the session of the user is expired. But the points of the user are updated when the building is finished... So how does that works.

What do you guys think? Do they have some kind of cronjob that is fired every second, and that walks throug the database, and search for finished buildings, and updates the stuff? Or do you guys think that they do it differently?

I hope that I was clear. -NOTE- I don't need any code, I'm just intrested in the progress behind the game...

  • 3
    \$\begingroup\$ -1 This question shows very little research effort and is too broad. Learn about the Client-Server model. The things you're talking about happen on the server. The server doesn't care if the client is connected or not for doing things like building a structure. I would be very surprised if a cronjob was used. Google for MMO architecture. \$\endgroup\$
    – House
    Sep 24, 2012 at 19:57

1 Answer 1


If I developed a game like that, I would store all info in database and pass deltatime (time since last update) for each user profile to update their status to current time. When the user is logged in, the server will often update or else, it will update next time when the user logs in.

  • \$\begingroup\$ alright, i understand it... it's not something small... \$\endgroup\$
    – Mathlight
    Sep 25, 2012 at 10:45

Not the answer you're looking for? Browse other questions tagged .