Answer the question
In order to leave comments, you need to log in
What is the best way to gradually increase the value?
Let's say we have regular php and mysql
. Population value is 100 people. The happiness parameter was 0, they built a monument to Lenin, it became 20
Question: how best to gradually increase the happiness of the population from 0 to 20?
The idea that came up right away is to bypass the crown every minute and look, for example
if(current happiness < maximum happiness) { increase the current one by 1 }
And so on until the current one becomes 20. But if there are a lot of users in the database and everyone has such a parameter or several, is this method rational?
PS There are other solutions when the parameter increases non-linearly, but there are no special ideas here, for example:
0-5 - 3 units. per hour
5-10 - 2 units. per hour
10-15 - 1 unit. per hour
15-20 -0.5 units at one o'clock
Answer the question
In order to leave comments, you need to log in
set the timestamp after building the monument.
when someone asks for a specific value, plus it depending on the timestamp,
respectively, this requires that the game object is not just a set of parameters, but also has the logic of work in the form of functions that "smartly" get and set values
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question