I am developing a simple oldschool browser game where there are cities and their productions.
Lets say that for level 1 city stone production is 1 per minute.
For level 5 city stone production is 60 per minute.
The problem is currently i have a setInterval function in server with 0 interval which is looping through db checking cities and their productions and incremeting(?) them.
So how do i increment correctly ? Since all cities has different productions per minute what is the correct aproach ? Do i need to store last increment time of each city in db then check if enough time is passed and then increment ?
Also since i am real time updating data from db to client,i would like to see incrementing 1 by 1 not +60 after 1 minute pass.