The Inner Mechanics of Food, Growth, Granary and Whipping

MestreLion

Warlord
Joined
May 24, 2006
Messages
178
Location
Rio de Janeiro, Brazil
The Inner Mechanics of Food, Growth, Granary and Whipping
By MestreLion​

Forewords

This article tries to explain how food and growth really works, and how granary and whipping affects it. Ive seen many explanations before, but all fail to cover some of the obscure questions ive always had, and some teories fail in contrast to what really happens. So, i decided to create a custom game and test it myself. Ive come to conclusions that really surprised myself, and maybe will surpise some more experienced players than me.

Questions I want to answer:
  • How the "inner storage" of granary really works?
  • How food from the granary is moved to food bar when growth happens?
  • How (or if) whip affects population, food bar and the "inner storage" of granary?

This guide is not intented to:
  • Optmize whipping, or discuss whipping strategies
  • Optmize faster growth

For that, there are several articles already, some of them really awesome, specially on whipping.

Those not interested on the test methodoly can jump right to my conclusions, at the end of the post.

Methodology:

Here is the "Test City" i created for the testing:



All grasslands, +2 surplus food until culture expands, then +6 thanks to the corn. A small forest just to have some basic hammers. Im playing as Isabella (Spain), Spiritual+Expansive. This will accelerate the construction of the granary, and prevent the Anarchy when I change to Slavery. No techs beyond Bronze Working are needed for this testing, so ill just research what takes longer. All ill ever build will be the granary itself, and an Obelisk and Stonehenge for the whipping tests.

From now on, im only interested on current food stored on food bar, food stored on granary and food required to grow a pop. I will use this notation:

<Turn>: <Current Food> (<food on granary>) / <Food required to grow> (<current pop>)

The testing:

So, here we goes. Starting with a +2 food surplus:

01: 00 (00) / 22 (1)
02: 02 (00) / 22 (1)
03: 04 (00) / 22 (1)
04: 06 (00) / 22 (1)
05: 08 (00) / 22 (1)
06: 10 (00) / 22 (1)

Now, city borders have expanded, i get access to the (convenintely farmed, irrigated and routed) corn. From now on ill have a +6 surplus food each turn:



07: 16 (00) / 22 (1)

City is ready to grow a pop, food would be 22/22, so no overflow food. Food bar will be reset, as we have no granary yet. Meanwhile, Brownze Working was researched, and i adopted Slavery. Thanks to Spiritual trait, no anarchy to interphere with the testing.



Moving on...

08: 00 (00) / 24 (2)
09: 06 (00) / 24 (2)
10: 12 (00) / 24 (2)
11: 18 (00) / 24 (2)

Ready to grow a new pop. Food would be 24/24, so, again, no overflow.



12: 06 (00) / 26 (3)
13: 12 (00) / 26 (3)
14: 18 (00) / 26 (3)
15: 24 (00) / 26 (3)

Ready for new pop. This time, 30/26, so we will have a 4 food overflow. Ive also switched production to Obelisk, to delay the granary a lil bit and test whipping with no granary involved.



16: 04 (00) / 28 (4)

Now, lets see how whipping affects the food bar when there is no granary.

Before: After:

16: 04 (00) / 26 (3)

Notice that nothing changes on the food bar. It remains 4/28. So, out first conclusin is: whipping does not affect food bar, even when no granary is present. The only effect is, now that pop is reduced to 3, food needed to next growth is 26. This is probably no news to most experienced players. Moving on...

17: 10 (00) / 26 (3)
18: 16 (00) / 26 (3)

Now the granary is ready, and it will start to store food surplus. Ill assume it will store all food surplus, not 50%, as later on this test it proved to be correct. So, each turn, the "inner storage" of the granary will also grow by 6 food. Please note that the granary will only start to store food after it is completed, not on the turn it was built. Granary was completed between turn 17 and 18, but its storage is still empty, and will only accumulate food now.

19: 22 (06) / 26 (3)

City is ready to grow. Food would be 28/26, so theres a 2F overflow. What about the inner storage of the granary? Would it be 12? How much food will be on food bar next turn? 0? 2? 9? 12? 13? 14? ? This is one of the trickiest turns of the whole testing. Any bets before seeing the next screenshot? ;)



Heres what really happened: food bar was reset, then overflow food was added to it, then all the food on granary&#180;s inner storage (12, indeed) was added. Yes, all the food on granary. Not 50%. And remember, all food harvested was also stored on the granary. Not 50%. So we had 2 from overflow + 12 from granary = 14. Moving on...

20: 14 (00) / 28 (4)
21: 20 (06) / 28 (4)
22: 26 (12) / 28 (4)



Ready to grow. 32/28, so 4 overflow. Granary would have 18. So next turn food bar will have 18+4 = 22, right? Not exactly. Another interesting conclusion: granary storage is limited to half food needed to go up the current level. Granary will only add 14 food. So food bar will have 4 (form city overflow) + 14 (from granary) = 18. Last but not least, the food added to the city is not removed from the granary, so granary will still have 14 food after growth. So the actual food stored on granary on turns 20, 21 and 22 would be respectively 12 (food remains after growth), 14 (cap), 14 (cap). Due to this, the food that remains on granary basically becomes irrelevant from now on. If there is no starvation, it will always have half the food needed to grow.


All credit for most of the info on the above paragraph goes to Krikkitone. The limit of transfered food can be discovered by testing, but the info on the hard cap on granary storage and the fact that food is not subtracted would not be possible without his kind input.


23: 18 (14) / 30 (5)



Lets grow a few pop to check if this theory is correct

24: 24 (15) / 30 (5)



Ready to grow. Food will be 30 (15) / 30 = 0 overflow, +15 from granary

[continues on next post ...]
 
25: 15 (15) / 32 (6)
26: 21 (16) / 32 (6)
27: 27 (16) / 32 (6)



Ready to grow. Food will be 33 (19) / 32 = +1 overflow, +16 from granary

28: 17 (16) / 34 (7)
29: 23 (17) / 34 (7)
30: 29 (17) / 34 (7)



Ready to grow. Food will be 35 (21) / 34 = +1 overflow, +17 from granary

31: 18 (17) / 36 (8)
32: 24 (18) / 36 (8)
33: 30 (18) / 36 (8)



Ready to grow. Food will be 36 (22) / 36 = +0 overflow, +18 from granary. At this point, I think its safe to assume that the conclusions about granary and its inner storage are correct. Now, lets try to investigate a bit more the relation between whipping and food.

34: 18 (18) / 38 (9)
35: 24 (19) / 38 (9)
36: 30 (19) / 38 (9)
37: 36 (19) / 38 (9)



Ready to grow. Food will be 41 (28) / 38 = +3 overflow, +19 from granary

38: 23 (19) / 40 (10)
39: 29 (20) / 40 (10)
40: 35 (20) / 40 (10)



Ready to grow. Food will be 41 (27) / 40 = +1 overflow, +20 from granary

41: 21 (20) / 42 (11)

Now we have enough pop for our second whipping test, this time with granary present. The game says it will cost 5 pop:

Before: After:

41: 21 (20) / 32 (06)

So, as expected, whipping did not change the current food. It is still 21. The only thing that changed was the required food, that dropped from 42 (11 pop) to 32 (pop 6). Again, this is no news to the experienced player, but i hope it helps the begginer player that are always confused about whipping and its effecs on growth.

But the testing is not done yet. One question remain: whipping didnt affect the food on the bat (city food), but did it affect the food on granary&#180;s inner storage?. We hope not, but since we came this far, why not test it for sure? Its easy: lets grow a few pop and see if the overflow matches our expected value.

42: 27 (16) / 32 (06)



Ready to grow. Food will be 33 (19) / 32 = +1 overflow, +16 from granary. And the result is:



43: 17 (16) / 34 (07)

So, as expected, the granary food wasnt reset, not even halved, by the whipping. We can now safely say that whipping had no effect on the grannary, nor was affected by its presence.

[continues on next post ...]
 
As an exercice, lets find out what would happen if current food is large enough to make a city grow 2 pop in 1 turn. How would it be possible? If city size is, say, 12, and food is almost reaching next level (43/44), and we have a big surplus (10+), a full granary (22), and whip very hard (6 pop), then its possible to have more overflow (35) than the required to for the entire next level (34, pop 7). Will the game allow us to go from 6 pop to 8 pop in 1 turn if we have enough food overflow?

Here is the test:



X: 43 (22) / 44 (12)

Before whipping: After whipping:

X: 43 (16) / 32 (06)

That will yeld to 11 overflow + 8 surplus + 16 from granary = 35, enough to completely bypass pop 7 (34 food required) and skip directly to pop 8. Lets see:



X+1: 35 (16) / 34 (07)

Too bad, there's no free lunch :). Even with enough food avaliable, game requires at least 1 turn per pop.

Note: some of you may have noticed that i had "only" 8 surplus food, even with rice and wheat, both farmed and irrigated. But i should have 9. Anyone has a clue where the "missing food" is? I have NO ideia. Comments welcome :)
 
Conclusions:

  • Each turn, the Granary stores in its "inner storage" the same amount of food that was havested by the city as surplus, up to half the food needed to grow up a population
    Example: if you have a +2 food surplus in a city in a city size 6, each turn the granary will store 2 additional food up to a maximum of 16.

  • When a city grows a population, all the food stored on the granary is added to the city's food bar. That food, however, is not subtracted from the granary.
    Example: if you have 15 food stoted on a granary, and the city grows from 5 to 6 population, 15 food will be added to city, and granary will stay with 15 food.

  • Whipping population (by slavery) does not change the city's food bar, nor the granary's inner storage.

  • Whipping effect is not affected by the presence of a granary. The good thing about having a granary when using whip is because city grows faster that way, thus you recover faster to original population. But Granary and whip have completely independent mechanics, one does not affect or is affected by the other.

  • You cannot grow 2 population in a single turn, no matter how much surplus (or overflow) food you have.

  • As noted by Perugia (check his post below), the optimum time to complete the granary is when the food bar is exactly half full. Any earlier and the granary is sitting there at it's max inner storage limit waiting for the city to grow which is a waste as the hammers invested could be used elsewhere. Any later and the granary will be short.

  • As noted by Willburn and Perugia, on Epic speed where a city needs to grow to size 2 it requires 33 food and the granary will add 16 food not 17 so basically granary food added will be rounded down if there is a fraction. (in this case 16.5). This rounding down might only apply Vanilla 1.61 as I read that Warlords works to 2 decimal places but I don't know if that applies to the food bar. This happens on every odd-to-even pop growth, so you may use whipping and/or drafting to exploit this rounding (or at least not losing food because of it). Check their posts below.

Next steps:
  • Find out how starvation relates to all of this, specially if the granary's inner storage has any role on this. If anyone already knows, please tell me :)
  • Check if whipping has any relation to starvation. Is there any penalty for whipping while at 0 food? Is it efficient to whip when starving, as youre going to lose pop anyway?

Afterwords:

I hope this article helped some to understand the obscure points about how the granary really works, and the relation between food, granary, whipping.

Most of whats here is no big news for experienced players, but i would really aprreciate any kind of comment, suggestion, corrections. Feel free to point mistakes i may have done. Anything that helps to improve this article is very welcome. Last but not least, thanks Krikkitone for in-depth info that led to many corrections.

Here are the savegames if you want to do this (any ony related) test for yourself. Ill supply 2: the initial savegame at 4000BC, and after i build those luxury and health resources to raise pop cap.

MestreLion
 
Well I checked the SDK it seems like you are basically right with a key change,

Food NEVER 'Leaves' the Granary unless you are starving

assuming +3 Food
ie Food (Food in Granary) / Food needed for Growth

Turn X : 22 (12)/24
in between turns this Happens

Food is added
25 (15)/24

Granary Food is 'Adjusted' to be no more than 1/2 of food needed for Growth
25(12)/24

Pop Growth Occurs -24 from food+12 (amount in Granary)..no 'overflow' calculated.. it just is
13(12)/24

New Max Growth Caluclated
13(12)/26

Turn X+1: 13(12)/26
Turn X+2: 16(13)/26

Lets say we start Starvation in X+1 instead, Food -3

Turn X+1: 13 (12)/26
Turn X+2: 10 (9)/26
Lets say we slow the starvation, but then it picks up again so we end up at

Turn Y: 2(1)/26
in between turns this Happens

Food is 'added'
-1 (-2)/26

Granary Food is 'Adjusted' to be no less than 0
-1(0)/26

Starvation Occurs -food is added to food (-(-1))=+1
0(0)/26

New Max Growth Calculated (pop dropped 1)
0(0)/24

Turn Y+1: 0(0)/24

So key point, after the first growth, the Granary will always give exactly 1/2 rounded down of what you need

To get the full first growth you must build it before you get 1/2 of the food in the box, otherwise it will be short.

Side note: Food is Always added to the 'Granary' but if there is no Granary, that food is adjusted down to 0 each turn.
 
wow, thanks a LOT for you input! I was just about to do some testing on starvation, but you just answered all my questions!

Ill do all the corrections to the article, specially the (now obsolete) part of the food stored on granary. By the way: if i got it correctly, after a full growth cyle where granary was present, the food stored on it becomes irrelevant, right? You can just say that "after growth, half the food needed to go up to that level 'magically' appears on city food bar", correct? Or does the food stored on granary plays any other role under specific conditions?
 
Well I've thought through it, and after the granary has reached that level, there is no way for it to not be at the needed level.... Maybe with the Hanging Gardens, there might be, but thats a one time event, and could only affect it under very wierd conditions, if at all.
 
First of all, thanks a lot for the article. As a Warlord/Noble player who is starting to study the strategies of advanced play, this was really helpful. I am confused, however, by one thing. There seems to be a conflict between:

Heres what really happened: food bar was reset, then overflow food was added to it, then all the food on granary´s inner storage (12, indeed) was added. Yes, all the food on granary. Not 50%. And remember, all food harvested was also stored on the granary. Not 50%. So we had 2 from overflow + 12 from granary = 14. Moving on...

20: 14 (00) / 28 (4)

and...

When a city grows a population, all the food stored on the granary is added to the city's food bar. That food, however, is not subtracted from the granary.
Example: if you have 15 food stoted on a granary, and the city grows from 5 to 6 population, 15 food will be added to city, and granary will stay with 15 food.

In the first quote (between turns 19 and 20) all the food in the granary was depleted with the population growth (though it was added to the regular stockpile). Yet the second quote (from your conclusions) says we should have retained the amount in the granary. So by this logic, shouldn't the granary stores on turn 20 be at 12, not 0? Am I missing something here?

Thanks again for a great article, and thanks in advance for your help. :)
 
MestreLion said:
Note: some of you may have noticed that i had "only" 8 surplus food, even with rice and wheat, both farmed and irrigated. But i should have 9. Anyone has a clue where the "missing food" is? I have NO ideia. Comments welcome :)
While you were playing around in worldbuilder the corn (not wheat) somehow forgot that it had irrigation. If you rebuild the farm it will get the full +6 food back.

FastActin said:
In the first quote (between turns 19 and 20) all the food in the granary was depleted with the population growth (though it was added to the regular stockpile). Yet the second quote (from your conclusions) says we should have retained the amount in the granary. So by this logic, shouldn't the granary stores on turn 20 be at 12, not 0? Am I missing something here?
The food bar is the big orange thing on the top of the screenshot. The granary is the little white building on the left of the screenshot. They both store food, but the food in the granary building is invisible.
 
FastActin said:
In the first quote (between turns 19 and 20) all the food in the granary was depleted with the population growth (though it was added to the regular stockpile). Yet the second quote (from your conclusions) says we should have retained the amount in the granary. So by this logic, shouldn't the granary stores on turn 20 be at 12, not 0? Am I missing something here?

Thanks again for a great article, and thanks in advance for your help. :)


Thants for the compliments... and yes, you're correct: the food on granary would be 12 at turn 20, then 14 for turns 21 and 22 (because of the cap on granary storage). But, as the cap (and the fact that it retains food when grows) is only mentioned on the next paragraph, i forgot to edit and re-write those turns. I still have no idea how to edit those turns with info i only provide later... but i promise ill think in a way to say it didatically :)
 
Krikkitone, when you discuss starvtion, why is 2 food coming from the granary each turn, and one food from the food bar? How do I know how many should be coming from each source when starving?

thanks for your help! :)
 
That isn't 2 food leaving the granary

There is 3 food leaving it leaves Both
the Granary (which has 1 Food -3 food= -2 food)
AND
the Food Bar (which has 2 food -3 food= -1 Food)

So you actually (in betweeen turns only) have a negative amount of food in the Bar, and in the Granary

The Granary is 'adjusted to 0' automatically
when the food bar 'adjusts to 0' you have a starvation of 1 pop.
 
Ah I got it. This line confused me:

Food is 'added'
-1 (-2)/26

But I see now that the -1 (-2) weren't the addition amounts, but were the totals. The addition amount was -3.

Thanks.
 
Thank you for the article. I thought that the granary functioned differently (only storing 50% from the moment it was constructed). Thank you.:goodjob:
 
Brilliant article!

The key conclusion to me and which I hope to use in future is that the optimum time to complete the granary is when the food bar is exactly half full. Any earlier and the granary is sitting there at it's max inner storage limit waiting for the city to grow which is a waste as the hammers invested could be used elsewhere. Any later and the granary will be short.

At exactly 1/2 the granary is not ready to accept food on the following turn but will not end up short as the surplus on the turn the city grows gets added to the granary then put back in the food box.

Note also that if the granary is going to be late but city has some flexibility in tile allocation it's going to be beneficial to emphasise hammers first to delay getting the food box half full and switch to food later after the granary is complete. This might mean say mining a hill first and then farming a flood plain would be better than farming first then mining.


Starvation & Whipping

Without slavery, starvation even so severe that it leads to pop loss, will not interfere with the granary function as although the granary will empty, by the time the city does regrow the granary will always be full.

But even one turn of starvation followed by the whip can reduce the regrowth time so if a city is starving it is best to whip it down to food balance as early as possible to maximise the food stored in the granary for when it's economy gets back on track. Effectively the granary can hold 1/2 a pop point in reserve. This is actually quite realistic - a granary is supposed to help in times of famine but only if the rations hold out!
 
I just want to add that on epic where a city needs to grow to size 2 it requires 33 food and the granary will add 16 food not 17 so basically granary food added will be rounded down if there is a fraction. (in this case 16.5)
 
Willburn said:
I just want to add that on epic where a city needs to grow to size 2 it requires 33 food and the granary will add 16 food not 17 so basically granary food added will be rounded down if there is a fraction. (in this case 16.5)
Interesting point Willburn.

This rounding down might only apply Vanilla 1.61 as I read that Warlords works to 2 decimal places but I don't know if that applies to the food bar.

This raises interesting MM issues for those that care.....

AFAIR on Epic the food bar increases by 3 with each pop point ie:
01, 02, 03, 04, 05, 06,
33, 36, 39, 42, 45, 48,
with the granary size: 16, 18, 19, 21, 22, 24, etc

As you can see the granary size increases by 1's and 2's due to the rounding, so if you are whipping or drafting, you should, where possible, whip/draft the population down to an even pop number before the city re-grows.

This can be done over multiple whips/drafts in the same turn and can even be done over several turns as long as the the city does not immediately regrow.

You should also, where possible, time the whip/draft for when the population is odd because allowing an odd number of pop to grow costs you 1 food in rounding.
 
Actually, the so-called "missing food" comes from the fact that either rice or wheat gives 1 less food when irrigated than the other one does.

I forget which one is which, but that is where it is coming from.
 
Actually, the so-called "missing food" comes from the fact that either rice or wheat gives 1 less food when irrigated than the other one does.

I forget which one is which, but that is where it is coming from.

Rice gets one food less, but that's not the issue here. Check the screenshots and you'll see that the food doesn't add up.
 
Top Bottom