Can anyone explain what the number behind the city population is? and how its calculated?
/* four parts contribute to town growth:
* p****enger transport 40%, mail 20%, goods (30%), and electricity (10%)
*/
sint32 pas = (city_history_month[0][HIST_PAS_TRANSPORTED] * (40<<6)) / (city_history_month[0][HIST_PAS_GENERATED] + 1);
sint32 mail = (city_history_month[0][HIST_MAIL_TRANSPORTED] * (20<<6)) / (city_history_month[0][HIST_MAIL_GENERATED] + 1);
sint32 electricity = 0;
sint32 goods = city_history_month[0][HIST_GOODS_NEEDED]==0 ? 0 : (city_history_month[0][HIST_GOODS_RECIEVED] * (20<<6)) / (city_history_month[0][HIST_GOODS_NEEDED]);
// smaller towns should growth slower to have villages for a longer time
sint32 weight_factor = 100;
if(bev<1000) {
weight_factor = 400;
}
else if(bev<10000) {
weight_factor = 200;
}
// now give the growth for this step
wachstum += (pas+mail+electricity+goods) / weight_factor;
Was that what you were after? ;-)
Growth of this month: 93
Growth of last month: -2
Growth of month before last: 56
(93*5+(-2)*4+56)/10=51.3
Hmm.. strange... why count this month times 5 which is not finished
and then the 2nd last 4 times.
while the last only once?
where is the logic of this?
To have a more smooth display and avoid meaningless jumps just after the beginning of a new month.
Why not take last five months and divide on 5?
why is the second last so important?
Because with four month the lag would be too much. THis is just an empirical value that gives smooth enough display but still reflects the current situation.