How to calculate production when player is offline
Posted
by
Kaizer
on Game Development
See other posts from Game Development
or by Kaizer
Published on 2014-05-28T13:24:44Z
Indexed on
2014/05/28
16:01 UTC
Read the original article
Hit count: 194
game-design
|game-mechanics
What is the best way to do for example food growth based on how many food buildings you have?
Lets say I have a webbased game where you can build a farm wich generates 60 food units per hour. A player has 1 farm in his possession.
What is the best way to keep on producing these units even when the player is offline? Should I do the math when the player get's back online again? If so..how can I do this without having to save his last online time every 5 seconds so I can do some maths with it when he logs back in (datetime.now - lastonlinetime)?
Next thing is when the player is online, should I refresh his resource count every 5 seconds or so by going to the database and back? This would seem weird to do for every logged on player.
I hope you understand my question.
kind regards
© Game Development or respective owner