# How exactly does a granary "store" food?

Discussion in 'Civ4 - General Discussions' started by DigitalBoy, Oct 7, 2017.

1. ### DigitalBoyEmperor

Joined:
Jun 29, 2006
Messages:
1,346
I've been playing this game for years and this is something I've never gotten a straight answer on or been able to figure out entirely for myself. When do you need to build a granary for it to have its full effect the first time a city grows after building it?

What I mean is, if you finish construction on a granary the turn before a city grows, the city's food bar doesn't begin halfway filled like you might expect it to. It only "stores" a little bit of food. It's obvious that the granary must begin "storing" food after it's been built instead of simply causing the city to start with a partially full food bar each time it grows, though practically this would only make a tangible difference the first time a city grows after the granary is built.

2. ### lymondRise Up! (Phoenix Style!)ModeratorHall of Fame Staff

Joined:
Mar 11, 2008
Messages:
22,872
The granary can be complex, and others here likely have better and more mathematical explanations, but at a basic level understand that the granary stores half the food bin, as the city's food surplus is added to the bin at a given pop to grow the bin to the next pop.. So the ideal time to complete a granary is before the food bin reaches halfway the turn of completion. Keep in mind that other things factor into growth like food surplus, so a city with high food surplus grows faster after the granary completes. You can really jump start growth in cities this way and turn food into production by whipping.

So in short, try to complete the granary at or shortly after it grows a pop...but note the food surplus as well and how fast the bin is filling...

If you have to build the granary after the bin is complete, you can use a little trick on the turn before growth by using the avoid growth button for a turn, then growing the next turn. The granary will store food that turn. However, it depends on the food the city has already..sometimes that trick is not worth it.

It's easier to show this live, but I recommend playing around with this in World Builder. Set a game, add a couple of food improvements, add/remove the granary at different points.

3. ### FippyMycro Junkie Queen

Joined:
Mar 17, 2013
Messages:
11,993
Gender:
Female
Granaries start storing food when you get the message it's completed, after clicking next turn
So not in between turns when it's showing granary 1t in your city bar, that would also be a possibility but that turn does not count yet.

An optimal granary build would show 50% of the city food bar filled, on that completion turn.
At size 2 that would be 12/24 food, size 3 13/26 and so on.
Since they store 50% food after growth, they still have time for gathering that amount when it's half full.

Completing your granary earlier also gives 50% food, and later you are not getting the amount that exceeded 50% already before the granary finished.
If it's completed at 16/24 you will get 8 extra food after growing, at 20/24 only 4 food etc

I guessed that will be you Lymo, when i saw somebody posted before i finished

4. ### lymondRise Up! (Phoenix Style!)ModeratorHall of Fame Staff

Joined:
Mar 11, 2008
Messages:
22,872
..you provided the math, which is really helpful understanding the granary.

5. ### Pedro78King

Joined:
Oct 20, 2016
Messages:
987
That's not exactly correct. Technically - after it's completed - the granary stores the food surplus every turn, the cap being (20+2*CityPop)/2 (normal speed).

For example, let's say you complete the granary on size 2 at 16/24 food, and your city is doing 6 food surplus.
• At T+1 after completion, your granary has stored 6 food, and the food bin is now at 22/24
• Between T+1 and T+2, the granary will store another 6 food, even though the food bin will be full at 24/24
• This means that at T+2, your city will be at size 3 with full regrowth, with the food bin at 16/26

Fippy likes this.
6. ### FippyMycro Junkie Queen

Joined:
Mar 17, 2013
Messages:
11,993
Gender:
Female
You are right, and i learned something new ~~

7. ### Pedro78King

Joined:
Oct 20, 2016
Messages:
987
As some pictures/saves are worth a thousand worlds, here's an illustration to the above example:

On T1, we 2pop whip a granary 4-2:
Spoiler :

Here, FoodBin=10 and FoodInGranary=0

Granary is completed on T2:
Spoiler :

Now FoodBin=16 and FoodInGranary=0 because the granary only starts storing food the turn after it is completed, as Lymond and Fippy explained

On T3 we get +6 food and the granary stores 6 food:
Spoiler :

Now FoodBin=22 and FoodInGranary=6

Between T3 and T4, we gain another 6 food, which is completely stored by the granary:
Spoiler :

So now FoodInGranary=12 and FoodBin=(22+6-24)+FoodInGranary=16. In other terms we get the extra food from growth plus the whole granary capacity.

Now let's see what happens if we work an unimproved grassland instead of the corn on T3:
Spoiler :

Now we only have 2 food surplus. We still have the T3 numbers : FoodBin=22 and FoodInGranary=6

Between T3 and T4, the granary gets +2 food, which is the food surplus, and the food bin is completed @24/24, which means the granary only stores 8 food and we end up with FoodBin=8 on T4. See the difference?

I've tried to make it as clear as possible, hope this is clear enough

Save attached if you want to experiment a little. Just open WB and change settings

#### Attached Files:

• ###### TEST BC-3960.CivBeyondSwordSave
File size:
42.4 KB
Views:
105
Lexicus and Tatran like this.
8. ### MichkovEmperor

Joined:
Jul 5, 2010
Messages:
1,475
Hang on are you saying, finishing the granary fills the food bar up to 50% if not already above 50% at turn of completion?

9. ### TatranDeity

Joined:
Aug 23, 2002
Messages:
4,184
I wonder if there are more situations like this, besides world wonders?
A world wonder is yours when no more hammers are required.

Btw, Kossin made a excellent thread/exercise 'Microchallenge' years ago explaining the granary.

10. ### DigitalBoyEmperor

Joined:
Jun 29, 2006
Messages:
1,346
Thanks for the replies. I've tried before to figure out how granaries work, and I think this is what was throwing me off the most. I wasn't expecting food that goes over what is needed to make the city grow to count toward the granary. That actually has a lot of pretty huge ramifications. It means you can finish the granary well after the city is halfway to the next population point and still get a lot of the granary's benefit if your surplus food per turn is high enough. It also means there are lots of paradoxical situations where city growth can be significantly improved by strategically halting it. Hypothetically, if the granary in your screenshots was finished at 18/24, you could have squeezed an extra six food out of it by purposefully halting city growth for a single turn. That's huge.

I tried messing around with world builder to figure out more about how granaries work, and I also noticed that granaries continue to store surplus food even if the "halt city growth" button is used. I also found out that starvation will subtract stored food from the granary (but won't drop stored food below zero).

11. ### sampsaGhost

Joined:
Jan 1, 2006
Messages:
3,121
Location:
Finland
Yeah, this is huge. If you can't finish the granary in "optimal" time, often just working the best food tiles but clicking halt city growth for one turn wins you food.

12. ### lymondRise Up! (Phoenix Style!)ModeratorHall of Fame Staff

Joined:
Mar 11, 2008
Messages:
22,872
lol...the granary still a bit puzzlin' 12 years on...

great stuff, Pedro..pics so much better

13. ### Reg PitherWarlord

Joined:
Sep 14, 2004
Messages:
269
Gender:
Male
Location:
London
On a related inconsequential sidenote... do you guys in the US pronounce it as 'grainary'? I've watched some videos where guys have called it that and was just wondering.

14. ### s.bernbaumMostly lurking

Joined:
Dec 2, 2006
Messages:
2,794
Location:
The wilds of Montana
Like you folks in England, we in the USA have regional dialects, which differ in the pronunciation of many words. Some here would say "grainary" (long "A") others "grainery" or "granary" (short "A") and there are probably a few other variations, depending on where one is brought up.

Fine_Distinction and Reg Pither like this.
15. ### ArchGhostPrince

Joined:
Aug 2, 2016
Messages:
461
"Grain - er - ry"
Midwest American dialect.