Can anyone tell me what the exact formula for growth is?
Announcement
Collapse
No announcement yet.
Formula for growth
Collapse
X
-
try citydata.cpp or governor.cpp for a start then somethingin the code will make you use the search and you find the files associated to it. something like growth I think will take several files...
Comment
-
Originally posted by E
try citydata.cpp or governor.cpp for a start then somethingin the code will make you use the search and you find the files associated to it. something like growth I think will take several files...
Well we start to collect all the ressources from terrain:
Food value of tiles from the inner rings are added directly to gross food. A fraction of the outer ring tiles is added based on utilisation ratio.
Then the boni of buildings are added. Take frood from terrain and multiply it with building food coefficent and add the result to the original food from terrain.
Do the same for wonders.
Add the food from farmers.
Then apply the government food coeficient. Multiply it with the amount of food we have now.
Then deduct the food lost due crime, crime is dependent on happiness. And that is a fraction of the food we had before.
Now we have the food produced in the according turn.
Then we have to eat the food. So we need to get the required food of course that is dependent on the total population without slaves, so we need to multiply this amount by the rations given each persion in the according turn.
Consumed food is deducted from gross food. This food delta let us now meassure whether the city should grow or starve.
Of course if the delta is positive the city grows and if it is negative it starves.
The amount of the food delta is capped by the max surpluss food for a city that is true for negative values as well.
Now it is the turn to calculate the growth rate the the fraction of 10000 that is added the according turn. It depends on the amount of available food and of the overcrowding coeficient. This fraction is also capped.
First the overcrowding pop size has to be calculated to determine whether overcrowding takes effect.
The overcrowding size is taken from the base overcrowding in the citysize.txt and then all the building overcrowding increasements are added. If the overcrowding size is smaller then the pop size, overcrowding comes into play and the overcrowding coefficient has to be calculated.
The pop ratio of the pops that are over the overcrowding of the total possible pops over overcrowding is calculated.
The square of this is deducted from one. This is multiplyed by the max growth rate from the city size entry.
Now this is multiplied by the food delta per pop and we have the number of fractional pop that is added per turn.
Of course if the city reached the maximum size or riots the growth rate is set to zero.
-MartinCiv2 military advisor: "No complaints, Sir!"
Comment
-
utilisation ratio for incomplete rings
Food value of tiles from the inner rings are added directly to gross food. A fraction of the outer ring tiles is added based on utilisation ratio.
I've looked at all the major threads and posts on food calculations (FAQs, linked threads, etc.) and they all assume that the rings being worked are complete - usually the first of 8 tiles or the secnd of 12 tiles. I understand that for a complete second ring of 12 tiles, the first worker will get 1/12th of the total resources from ALL 12 tiles; 6 workers gets you 6/12 or half of the resources. When you get to 12 workers on the second ring (18 total city size) then your city radius expands to a third ring.
But what about an incomplete second ring, where two of the 12 tiles are being worked by a pre-existing city. I assume that this means the second ring only has 10 available tiles - otherwise you'd end up double counting the overlapped tiles, and the nice white borders would be irrelevant.
Does each additional worker provide 1/12th of the total value of the incomplete ring - so that you would need 12 workers to get 100% out of the 10 tiles? That would make each worker in the ring substantially less productive - perhaps not even worth working at all! If your city expanded again but only had half of a third ring, you might never develop or use that outer terrain because specialists would be so much more productive in the city.
Or does the ring only require a number of workers = to the number of tiles? So that you'd need only 10 workers to work the second ring? That seems wrong, because that means that instead of reaching 100% efficiency at 18 workers, you'd hit it at 16 workers, with the next two workers forced to become specialists - I don't recall seeing cities expanding early just because their inner rings are overlapped. After expansion, those workers I suppose might then start working whatever third ring tiles are available - but do they have to wait until the city reaches the usual expansion limits?
Comment
-
Re: utilisation ratio for incomplete rings
Hey wheatin, long time no see! It's always good to see the old veterans return, they're a rare breed these days...
Originally posted by wheathin
Does each additional worker provide 1/12th of the total value of the incomplete ring - so that you would need 12 workers to get 100% out of the 10 tiles?
That would make each worker in the ring substantially less productive - perhaps not even worth working at all!
If your city expanded again but only had half of a third ring, you might never develop or use that outer terrain because specialists would be so much more productive in the city.
Comment
-
To make the anwer short:
Incomplete rings are treated as full rings. So you need indeed 12 workers for 100% utilization of a 12 size ring with two tiles occupied by another city.
BUt this means as well that you need for the first ring of eight tiles in the standart game only 6 workers to get full utilization.
-MartinCiv2 military advisor: "No complaints, Sir!"
Comment
-
Hey wheatin, long time no see! It's always good to see the old veterans return, they're a rare breed these days.
I especially like the added transparency to the game stats. For me, one of the drawbacks is that CTP is difficult to understand - while Civ is simplistic, at least most of the numbers are there on the screen. I think the work you guys are doing to the interface to make it clearer is great.
In fact, the more "Details" you can provide in the Empire Manager "details" screen, the better! That's something that will help everyone a LOT. (heck - maybe something similar should go onto every Manager: National, Build, City, etc...)
But that's the player's own fault then for settling his/her cities so close together
Worse, your city radius expands even if you don't want it to, because you can't go back and reassign tiles between cities to maximize outer-ring utilisation.
That's got a few problems:
1. It means a very nice game-play feature (one that is quite distinct from Civ) is basically broken: unless you get an outer ring of at least 50-75% completion, all outer-ring tiles for that city are wasted.
2. It increases micromanagement: you have to adjust food production very closely to ensure your cities are growing at the right rates and thus expand in the correct order (UGH).
Is there a way to change the city expansion/ tile utilisation routine so that however many tiles are available in the outer-ring, only that number of workers are required in order to reach 100% utilization? Perhaps this could be only for third & fourth ring expansions.
I think this would add a LOT to the game, (especially if combined with an ability to re-allocate tiles between city radii*), if only by reducing frustration:- you can use all your land
- you can use all your coastline and oceans
- you don't have to be so nit-picky over city-spacing
- you can back-fill cities when you discover new gov'ts with higher city limits
- you don't have to micromanage city food, specialists, or growth rates to prevent "unwanted" expansions
Also, it wouldn't hurt the AI in placing improvements because the effect could be incorporated into the "utilisation" value of the tile.
* however, I suspect that human-player re-allocation would be unbalancing, unless it was totally automatic, perhaps at each change in government? That would reduce the need for difficult new AI routines:
"Congratulations! Your empire has emerged from Anarchy! However, the transitional government took the liberty of re-drawing our provincial boundaries according to our most recent census."
Comment
-
Related Cradle Bug:
Has anyone noticed that that city size radii in Cradle are screwed up?
The radii for citysize 1 and 2 were fixed, but 3-5 are messed up (the "1 + ..." is for the center city tile).
Code:Citysize Workers Total tiles Add'l wkrs Add'l tiles TpW* city - 1 1 1 - size 1 1 - 8 1 + 8 8 8 1.0 size 2 9 - 20 1 + 20 12 12 1.0 size 3 21 - 32 1 + 44 12 24 2.0 !! size 4 33 - 46 1 + 56 14 12 .86 ?! size 5 47 - 60 1 + 68 14 12 .86 ?! size 6 61 - 76 -- citysize is capped at 59 -- *TpW = Tiles per Worker in the outer ring
Workers 21-32 are doubly productive! I checked this in the editor by setting a uniform terrain type and tracking the food produced for each additional worker. The rate doubles (or reduces, above size 47)! It holds for commerce and production too - sort of a wierd 'sweet spot' for city expansion.
As I said, I am totally confused. I'd think its a bug, except that modmakers made a point of fixing citysize 1 so that 8 tiles require 8 workers and adjusting citysize 2, from 18 to 20 - did they overlook the higher sizes, or did they make mistakes when adjusting the other values upward?
I suppose it could be on purpose, to reward bigger cities, or to offset the problems of outer-ring overlap - but then why the drop off for the last rings?
Comment
-
Another thing to note is that the values displayed in game for food and production are gross values and not net values. Therefore you can't exactly tell how much a specialist relly help. I corrected this when I was improving the AI's specialists assignment.
-MartinCiv2 military advisor: "No complaints, Sir!"
Comment
-
I checked the unmodded original citysize.txt - and it has the same values: the third ring of expansion is worth double resources.
In your modded code, when the AI evaluates whether to use specialists, does it look at the actual gain from an additional worker, (i.e. the double-value workers at size 21+) or just an abstract "ideal" worker?
The best tiles to work are those in the third ring of a city. In a mature empire core, an empire with third-ring cities is 50% more productive than one with only second-ring cities.* The AI (and players, of course) should be settling cities in the early game far enough apart to take advantage of that.
*20 workers on 20 tiles at 100% + 12 workers on 24 tiles at 200%. Average worker efficiency is over 150%, compared to second ring cities at 100%.
Comment
-
It doesnt matter though, those workers of the 24 tiles on the 3rd ring still have to work each tile at a percentage as the city grows.
Using Cradle, if the city size is say 26, the 1st & 2nd rings worked fully, 8/8 + 12/12 + 1/1 city tile always collecting 100%.
Then the 3rd ring, pop 26, workers 21-26 working on 24 tiles, 6/12, or 1/2 resources collected on each of the 24 tiles.Call to Power 2: Apolyton Edition - download the latest version (12th June 2011)
CtP2 AE Wiki & Modding Reference
One way to compile the CtP2 Source Code.
Comment
-
It doesnt matter though, those workers of the 24 tiles on the 3rd ring still have to work each tile at a percentage as the city grows.
...
Then the 3rd ring, pop 26, workers 21-26 working on 24 tiles, 6/12, or 1/2 resources collected on each of the 24 tiles.
Let's do some hard numbers. The good land terrains (plns, grs, for, mtn, hill) all have a base of 25 resources.
Code:Ring Tiles Res Wkrs Res per Wkr 1 8 200 8 25 2 12 300 12 25 3 24 600 12 50 4 12 300 14 21.4
Comment
-
Im not sure I get you, what do you mean by "total output per worker"? I thought every single tile on each ring was worked by a percetage of current workers available to total workers available on a ring, regardless of number of tiles.Call to Power 2: Apolyton Edition - download the latest version (12th June 2011)
CtP2 AE Wiki & Modding Reference
One way to compile the CtP2 Source Code.
Comment
Comment