Improved function for calculating City Population

Can you help improve your favourite game? Hardcore C mages, talented artists, and players with any level of experience are welcome!
Jacew
Posts: 16
Joined: Thu Apr 30, 2015 8:45 am

Improved function for calculating City Population

Postby Jacew » Tue Oct 06, 2015 4:19 pm

Representing citys populace could be significantly improved by weighting it against food in granary to produce more fluid and nicer population growth. My idea was to tweak the original function, but after a long trial and error with unsatisfactory results I gave up and made my own.

Original Freeciv function:
population = ((citySize*(citySize+1)*5)*1000

New version:
population = (100000*GranaryFillPercent*(citySize/10))+((citySize-1)*citySize*6000)+100

GranaryFillPercent = Food in Granary/Granary Size

Comparative population with both functions in different situations:

Poptable.PNG


Opinions?

EDIT: Fixed previously miscalculated table and added +100 into function to prevent population count 0 with City Size 1 and empty granary.