How "farm" game works?

Hello all, i am new here =) been trying to search for this for sometime.

I want to know how does real time games work, sorry i don’t know the term for it. Games like:

  • Tiny Tower
  • Farmville
  • We Rule
  • etc…

How do they calculate the time left even after the game is closed?
I also noticed Tiny Tower can alert the player when a restock is done without a need to connect to the internet. Is there any tutorial for these?

Sorry for bad english! Thanks in advance!

[import]uid: 74723 topic_id: 12284 reply_id: 312284[/import]

Games like that have a server component which logs whatever events happen. In Farmville, if you plant something, the even will be recorded in a database and they probably have a database agent or something running that updates any time based properties. This can obviously happen without the players being connected.

In other words, games like that work in much the same way as a database driven web site. [import]uid: 73935 topic_id: 12284 reply_id: 44728[/import]

Thanks for the quick reply!
I know that iphone doesn’t allow application to run in background. Does this apply to the database agent or something you mentioned? [import]uid: 74723 topic_id: 12284 reply_id: 44729[/import]

Yes, it’s the database agent (or however they decided to do it) that runs on the server. It isn’t really feasible to run that sort of logic on the phone/client because then it’s very easy to hack it to gain some sort of advantage. Any sort of multiplayer or “social” game should be as dumb as possible and have all the critical work done on the server.

Just bear in mind that the server costs for a game like Farmville (with that number of players) runs into the millions of dollars per month… [import]uid: 73935 topic_id: 12284 reply_id: 44732[/import]

EDIT: Found out my answer. For those who want to know, Tiny tower uses local notification (google it, apple supports this officially) which i have no idea how to call it in corona. [import]uid: 74723 topic_id: 12284 reply_id: 44733[/import]