Vocum Sineratio: The Whip

[size=-2]CR12 – Correction for nerf of Expansive in BTS
[anchor=CR11]CR11[/anchor] – Example of Granary optimization
CR10 – Presentation changes
[anchor=CR9]CR9[/anchor] – Updated Bibliography
[anchor=CR8]CR8[/anchor] – Minor correction on overflow
[anchor=CR7]CR7[/anchor] – Unit Obsolescence
CR6 – Images added
[anchor=CR5]CR5[/anchor] – Notes on traits
[anchor=CR4]CR4[/anchor] – First rewrite of 1.61 exploit
[anchor=CR3]CR3[/anchor] – Hammer banking
[anchor=CR2]CR2[/anchor] – Added some text which may better explain the stacking of whip penalties. Or it may not.
[anchor=CR1]CR1[/anchor] – Added bibliography, mod guide
[/size]

[h1=blue]The Whip[/h1]
[i]No time to argue. Throw me the idol, I’ll throw you the whip![/i]

[h2]WHIP BASICS[/h2]

[img]http://www.whiterose.org/danil/civ4/posts/whip.button.jpg[/img] “The whip” is a slang term for sacrificing to complete the production of a unit or building in a city. Clicking the Hurry Production button on the City Management Menu (as described on page 151 of the manual) trades population and a temporary happiness penalty for hammers.

The whip is only available if your government is currently using the Slavery labor civic; the technology Bronze Working unlocks this civic. Since this civic has the same Low Maintenance cost as the Tribalism civic it replaces, you need to have a very certain purpose to justify delaying a switch to this civic as soon as it becomes available.

The whip can be used only to finish the production of a unit or a building, and only if that item is at the top of the build queue. When your goal is maximizing production, you’ll want to be whipping on a regular basis. The implication here is that you will want to schedule your builds so that you have an appropriate item to whip ready when the time comes.

Each population point yields 30 base hammers at normal speed. As base hammers implies, your usual production bonuses apply on top of that. From this, you can calculate how much population must be sacrificed to finish the current production – but of course the game does this for you; simply hovering over the button will tell you.

How many hammers do you need? Under most circumstances, that is simply a function of the number of hammers remaining in the build. There are two exceptions: a 50% production penalty if you attempt to hurry production when you have not yet invested any hammers in it, and a 50% or 100% production penalty if you are trying to rush a Wonder.

At any given time, only one half of the city population can be sacrificed.

[h2]HAPPINESS[/h2]

Each time you crack the whip, you incur a +1 unhappiness penalty which is local to that city; when you inspect the details of the unhappiness, this penalty appears with the heading “We cannot forgive your cruel oppression”. At normal speed, the penalty lasts for 10 turns.

[img]http://www.whiterose.org/danil/civ4/posts/whip.oppression.jpg[/img]

If you crack the whip again before the previous penalty expires, then the unhappies stack – if you crack the whip twice in a single turn, you’ll be facing a +2 penalty. Furthermore, the clock on the second penalty doesn’t start until the first penalty has expired. In other words, cracking the whip twice on the same turn gives you a +1 penalty for 10 turns, and another +1 penalty for 20 turns.

[indent][i][set_anchor=CR2]It may help to understand how the game is keeping track of things under the covers.[/set_anchor] Each city has a HurryAngerTimer – when you crack the whip, you add 10 turns to the timer. When calculating the amount of unhappiness your oppression has caused, the game divides the HurryAngerTimer by the duration of the whip penalty, rounding up.[/i][/indent]

[indent][i]So, at normal speeds, if the timer is at 17 turns, that always means an oppression penalty of 2 – it doesn’t matter if you got there by whipping twice on turn 0, then hitting end turn three times, or if instead you whipped on turn zero, hit end turn three times, then whipped again.[/i][/indent]

When you crack the whip, the population goes down, therefore the penalty from crowding goes down even as the happiness penalty from the whip goes up. So in the normal course of events your net unhappiness will stay even or improve when you crack the whip. However, if you are running at a food surplus, your population is going to grow, and the regrown population may well be unhappy.

There are three common remedies which manage the extra unhappiness generated by the whip.

One is the use of the culture slider; converting a percentage of your commerce to “goodness”. Unfortunately, this is a global solution to what is usually a local problem.

Military police help to keep your citizens motivated if you are running the Hereditary Rule civic (unlocked by Monarchy). Each defender in a city provides an extra happiness, so you can move the military around to keep your cities productive.

The most common approach is simply to manage growth. The penalty isn’t restrictive until you grow back to the size where you whipped – if this growth occurs on the turn when the penalty expires, the unhappiness penalty has no practical effect at all.

In Warlords, the Aztec unique building is the Sacrificial Altar, which reduces the duration of the happiness penalty for whipping by 50%.

[h2]FOOD[/h2]

The whip is converting population to hammers, which in effect is translating food to hammers. So to properly understand efficient whipping, it is important to see the precise relationship involved.

The key point is this: cracking the whip does not change the amount of food collected in the food bin. It does, however, reduce the population, which reduces the amount of food required to regrow a population point. For example, if the food bin is at 20/30, and you whip three population, the bin will then be at 20/24.

The sweet spot for the whip will be that point where, having whipped the population, you are immediately growing one of the whipped population back. In this way, you get the hammers without sacrificing more turns working your tiles than is absolutely necessary (you will necessarily lose one turn of work, because city production comes before growth).

The Granary plays a significant role in whipping efficiency, because of the enormous impact it has on growth rates. The way the granary works is very simple – each turn you have a food surplus, the food stored in the granary increases by the same amount (likewise, if you are running at a food deficit, you lose food in the granary as well). The capacity of the granary is capped at 1/2 the food required to grow to the next size.

How much surplus food is required to grow from 24/30 to 24/32? Without the granary, the math is straightforward – 6 food to hit 30 (at which point the city grows one size), then another 24 to fill the food bin to the desired level. With a granary, we need the same 6 food to grow, but at that point our food bin is at 15/32 – we need only 9 more food to get to 24/32 – the amount of food required to grow has been chopped precisely in half.

In other words, the presence of the granary reduces the amount of food each population represents by 50%, thereby doubling the efficiency by which we convert food into hammers.

[h2]PRODUCTION[/h2]

Whips are worth 30 hammers per pop, base – all of your production multipliers are applied to them. So the question becomes, when do you whip?

To reiterate the first, and most obvious point: rushing when you haven’t yet invested any hammers in the build gives you 20 hammers / pop, rather than 30, so that’s never going to be ideal (although in emergencies it may be necessary).

You get better hammer/food rates when the population is small. As the happiness penalty does not depend on the number of people that you whip, this will generally mean that you will want to whip as many people as possible when the goal is maximizing production.

This fact requires a bit of care when timing the whip. Assuming no production bonuses are in play, an axeman with 5 hammers invested in it requires only one population to finish, rather than two. You’ll normally want to have fewer hammers than that invested, to get the most out of the whip. This means that you are often setting your city into a low production configuration immediately prior to the turn when you whip (for example, having no hammer tiles worked aside from the city tile itself).

Furthermore, because the number of population that you can whip is capped by your population size, you’ll normally want to whip big ticket items before smaller items. If you are at size 8, you can whip a forge and an axeman on the same turn, but only if you whip them in that order. Reverse it, and you are too small to whip the forge (assuming you have only one hammer invested in it).

Overflow is an important consideration, since the number of hammers you generate is determined by the population you use up. The overflow is only available when you finish the unit. In normal production, the amount of overflow you get is rarely enough to matter, but when whipping many items in rapid succession you may need to exercise some care. [set_anchor=CR8]You can carry the overflow from one build to the next[/set_anchor], but there is a cap on the amount of carryover that occurs; in low production cities, the cap is controlled by the number of hammers required for the produced build. For this reason, if you have whipped multiple builds (which you will normally do biggest to smallest), you’ll want to be sure that you produce the builds smallest to biggest, minimizing the carryover lost to the cap.

[i]In Civ 1.61, the hammers in excess of the cap were lost. In Warlords 2.08, those excess hammers are converted to gold, at a 1:1 rate.[/i]

Managing overflow is a common way to get a large enough investment in your big ticket items – especially your wonders which have a penalty associated with them for whip production. Instead of trying to whip these items directly, you whip smaller units, and apply the overflow to the target item.

With no production modifiers, axemen and spearmen make excellent candidates for this approach. But once the 25% modifier kicks in, axemen require only a single pop to rush, and generate negligible overflow. Catapults, which cost 40 hammers each, are an excellent substitute (or missionaries, for a more peaceful approach).

There’s one additional twist to consider, primarily relevent if you are using the Spiritual Trait: your production bonuses are based on when you whip, not on when you finish the unit. It may make sense to whip a unit now, then take it off of the production queue, with the intention of finishing it after a change into civics which provide an experience bonus. But don’t wait too long – production rot will start eating your hammers if you wait too long.

Police State ( +25% when producing military, unlocked when you discover Facism) and Organized Religion (+25% when producing buildings, unlocked when you discover Monotheism) are the civics you want to be in when you crack the whip, but Vassalage and Theocracy are where you will want to be when the military units start rolling off the build queue – assuming you have the luxury of making the switch.

If you are intending to use the Slavery civic only for a short period of time, remember that you can prepare for it by investing a single turn of production in several builds prior to making the swap (build queue management).

[set_anchor=CR5][h2]TRAITS[/h2][/set_anchor]

When considering the production of a building where your traits give a production bonus, a little extra care may be called for,

The math all works out fairly, as illustrated by the following example. Assume a spiritual civ trying to produce a Temple, in a city that generates one hammer per turn. After the first turn, there are 2/80 hammers invested. A two population whip yields 120 hammers with the bonus, so the temple is seen to be at 122/80. Ending the turn with the temple on the queue adds two more hammers (124/80), and when the temple is finished we have… 22 hammers of overflow. The production bonus applies only to the hammers used to produce the temple, just as it should.

With small buildings (barracks, granary, lighthouse), the production bonus takes you from a two pop whip to a one pop whip. It may be preferable to whip units, and apply the overflow to the building. For example, if you whip a barracks (1 pop), you get 10 hammers of overflow to apply to your axeman; but if you whip the axeman (2 pop), you get 25 hammers of overflow to apply to the barracks – more than enough to finish it with the production bonus.

For expansive civs training workers, and and imperialistic civs training settlers, there is an additional consideration. These civs get a 50% production bonus when training these units, but the bonus applies only to hammers – not to food. Hammers generated by whipping, however, do get the production bonus – this means that whipping gives a much better return on food invested than training the unit normally. [i]Note: Expansive was nerfed in BTS – the bonus is now 25%.[/i]

[h2]TRICKS[/h2]

[set_anchor=CR4][h3=blue]1.61 EXPLOITS[/h3][/set_anchor]

Patch 1.61 has a bug in the whip production calculation that allow you to generate game breaking numbers of hammers from the whip. The nature of the bug is that population and production bonuses, which are used in the calculation to determine how much population must be whipped, are not considered when calculating the yield.

Instead, the number of hammers you get is simply the number of hammers you need, rounded up to the nearest multiple of 30.

Now, this bug can work against you. For instance, if you try to whip an archer (25 hammers) with nothing invested, two population are sacrificed. So the production of the archer should be 2 * 20 = 40 hammers. Instead, you get 30 hammers – the lowest multiple of 30 greater than 25.

If you instead whip an axeman (35 hammers) with nothing invested, the bug breaks in your favor. Two population are again sacrificed, so your yield should be 40 hammers. Instead, you are getting 60 hammers. In effect, the bug allows you to instantly whip axemen at no penalty.

Where things get really silly is the case where you have a production bonus available. A 25% production bonus should give you 37 hammers per pop. So if you invest a single hammer in an axeman, then whip, the game correctly recognizes that a single pop point will complete the unit. But instead of 37 hammers, the bug gives you 60 hammers (the lowest multiple of 30 that is greater than 34).

But have a care – if you invest 5 hammers in the axeman, the bug will reduce your yield to 30 hammers, rather than the 37 you are entitled to.

[h3=blue]GRANARY OPTIMIZATION[/h3]

Most of the time, it is best to rush the production of a build when the food bin is nearly full. The exception to this rule is the Granary, which you will want to have in place as soon as you can manage it. The explanation is that the Granary requires a substantial amount of kept food to have any real impact, and even then it has no effect at all until your city grows another size. So if you are planning to whip a granary at size 4, it is slightly preferable to whip when the food bin is at 0/28 than when at 27/28.

[set_anchor=CR11]You can do best[/set_anchor] by showing a bit more care with the timing of your whip. Consider two cities, each with population 4 (food 0/28) and 1 hammer invested in the granary. Let us suppose that the last two population are each assigned to 2F tiles – in other words, the surplus food doesn’t change when we whip the population. We choose to whip the granary immediately in the first city (now at 0/24), while the second city puts some build ahead of the granary and continues to grow. Question: when the first city reaches 12/24, how much food has accumulated in the second city? Clearly, it should be at 12/28. If the second city now cracks the whip, it too will be at 12/24.

The second city has worked some extra tiles, at a cost of not yet having stored any food in the granary. However, because the amount of food stored in the granary is capped, the second city has precisely enough time to catch up before both cities together grow to size three. In addition to the profit from the extra tiles, you’ve also potentially accelerated the production of some other unit or building (simply because it can be finished naturally in the second city on the turn where the first city is whipping the granary).

[h3=blue]WORKER[/h3]

A worker first build normally requires 15 turns to complete – 60 hammers at 4 (food plus hammers) per turn. This is about the amount of time required to research Bronze Working if you start with Mining. For these civs, there is an interesting optimization available when there is a 3F tile inside the inner ring of your initial city.

A 3F surplus grows the city to size 2 in 8 turns, and 6 turns at 5 (food plus hammers) per turn reduces the amount of production required to a point where whipping a single pop will finish the worker. As soon as Bronze Working is finished, revolt to Slavery and whip out the worker. The worker appears on schedule, but you have gained the hammers produced while growing to size two, and perhaps a bit of commerce as well. The exact timing will depend on the details of the terrain available, and whether or not you pay an anarchy penalty when switching civics.

With the right set of tiles and a bit of micromanagement, you can get a warrior or scout finished before starting the worker: after seven turns the food bin will be at 21/22, and you will have 7 hammers invested in the build. Now switch to a 1/0/2 tile; the city grows to 0/24, and you have 10 hammers available. Work two 1/0/2 tiles, and you are still at 0/24, but 5 more hammers finishes the build, and you can begin producing the worker.

For an expansive leader, the timing is slightly different, as only 15 hammers need to be invested prior to the whip, rather than 30. On most maps, this means you will want to start the worker three turns before Bronze Working finishes.

[h3=blue]HEREDITARY RULE[/h3]

Hereditary rule gives you +1 happy for each military unit stationed in a city. So whipping a military unit is a break even proposition. You can use this notion to lean very hard on the food to hammer conversion. Since the happiness penalty cancels out automatically, you can in theory whip as often as you want. In practice, you need something sustainable – since the population cannot grow back faster than one pop per turn, the maximum yield you can get out of the whip is 30 hammers/turn. But you can certainly get all of that.

The game here is to keep producing military as quickly as you can (occasionally allowing the overflow to spill into something useful). As long as you have enough surplus food to work, you can grow every turn, keeping the cycle going indefinitely (you will occasionally need an extra turn to grow a pop point, which is ok as that is the turn you use to produce something useful with the overflow hammers you have been accumulating). Of course, military aren’t particularly useful until you move them out of the city, and when you do that the city goes pear shaped. But a junk city like this can be used to whip up an army very quickly – just don’t bother with a lot of infrastructure, because it shan’t do much good. If you are going for this sort of a gambit, you’ll usually be placing this city in close proximity to some useful city, so that it overlaps a food resource and a few other tiles.

[h3=blue]HEROIC THEATRE EXPLOIT[/h3]

The Globe Theatre takes the Hereditary Rule gambit a step further, as the theatre completely cancels out all unhappiness penalties, allowing you to whip out hammers as quickly as you can manage to grow the population back. This is a game breaker, especially when combined with barracks, forge, and the Heroic Epic – you are now producing promoted military units at 67 hammers per turn. We’re talking Cavalry every other turn, with overflow. Furthermore, because the Theatre cancels all previously incurred happiness penalties as well, you can use the hereditary rule trick, with overflow, to get the Globe Theatre built, then immediately pull the garrison out of the city.

[img]http://www.whiterose.org/~danil/civ4/a8/1810a.lyons.jpg[/img]

[set_anchor=CR3][h3=blue]HAMMER BANKING[/h3][/set_anchor]

One issue that comes up when trying to optimize the production yield of the whip is that of timing – those circumstances where you should be whipping now, but the thing that you want to apply the overflow to isn’t available yet. The trick here is to remember that, having whipped a unit, you can take if off of the queue until you are ready to apply the overflow. A few turns later, when the tech you are waiting for comes in, you can restore the unit to the queue and direct the overflow to your desired build.

Another circumstance where you may want to bank hammers is if you are about to acquire a production doubler. When circumstances permit, you would prefer that your overflow of hammers go to the Pyramids after Stone has been connected, rather than before.

This approach has the additional benefit that you pay no unit upkeep costs while the finished unit is parked on the queue. Just don’t forget that you’ve a limited window before the invested hammers begin to decay. Using buildings instead of units to store the hammers offers a longer opportunity window, because the building production decay time is 50 turns, as opposed to 10 turns for units.

[set_anchor=CR7][h3=blue]UNIT OBSOLESCENCE[/h3][/set_anchor]

Cities cannot produce obsolete units. For example, if you have discovered Bronze Working and Hunting, you can no longer create warriors in cities connected to a copper resource. If you have a partially completed warrior in the queue, those hammers will be carried over into the training of a spearman.

First application: this shaves a turn off of the time required to whip out a unit without penalty. The normal order for whipping out a unit is to start the unit on turn 1, and whip it on turn 2. But because hammers are carried forward, you can move everything back a turn – start training the old unit on turn 0, then whip the unit as soon as it is available on turn 1.

Second application: because of the ordering of tech discovery and production, you can actually shave an additional turn off of the production of the new unit. Simply start the old unit two turns early, and whip it to completion on the turn before the tech finishes. With the carry over applied, the new unit is available to move on turn 0. As in the case of hammer banking, you can whip the previous unit early, and keep it off queue until you are ready.

[set_anchor=CR1][h2]MOD GUIDE[/h2][/set_anchor]

[i]GlobalDefines.xml[/i]

NEW_HURRY_MODIFIER – the % penalty you pay to rush a build with no production invested in it.
HURRY_POP_ANGER – the magnitude of the cruel oppression penalty for each whip
HURRY_ANGER_DIVISOR – the duration of the cruel oppression penalty, in turns

BUILDING_PRODUCTION_DECAY_TIME – number of turns before a dequeued building begins to lose invested hammers
UNIT_PRODUCTION_DECAY_TIME – number of turns before a dequeued unit begins to lose invested hammers

[i]CIV4GameSpeedInfo.xml[/i]

iHurryConscriptAngerPercent – how the duration of the cruel oppression penalty scales with game speed
iUnitHurryPercent – how the production required scales with game speed
iHurryPercent – how hammers per pop scales with game speed

[i]CIV4HurryInfo.xml[/i]

iProductionPerPopulation – number of hammers generated for each pop whipped
bAnger – toggles the penalty for whipping units

[i]CIV4BuildingInfos.xml[/i]

iHurryAngerModifier – % change to the duration of the whip when this building is present in a city
bNoUnhappiness – toggles whether this building eliminates unhappiness
iHurryCostModifier – additional penalty for rushing this type of building

[i]CvCity.cpp[/i]

CvCity::unhappyLevel determines the effect of the Globe Theatre and other buildings with bNoUnhappyiness set.

[set_anchor=CR9][h2]BIBLIOGRAPHY[/h2][/set_anchor]

[thread=178491]The Inner Mechanics of Food, Growth, Granary, and Whipping[/thread]

[indent]Details of experiments to reveal how the granary works.[/indent]

[thread=192497]Does Using Slavery Hurt My Game[/thread]

[indent]Experiments on how using the whip affects commerce cities[/indent]

[thread=250927]Whipping Cycles[/thread]
[indent]More math experiments investigating efficient whipping[/indent]

[thread=159109]Micromanagement Is Alive and Well in Civ 4[/thread]

[indent]Details the slavery exploits in 1.61[/indent]

[url=http://realmsbeyond.net/forums/showthread.php?t=1594]Is Slavery Broken? Or Is Just the 2 Pop Whip Trick?[/url]
[url=http://realmsbeyond.net/forums/showthread.php?t=1564]Adventure 14: Compromise’s Report[/url]

[indent]The Realms Beyond crowd discusses variant rules to bring the whip back under control[/indent]

[url=http://forums.civfanatics.com/attachment.php?attachmentid=137640&d=1157570705]malekithe’s 1.61 whipsheet[/url]

[indent]A zipped excel spreadsheet which calculates whip efficiency[/indent]

[thread=193651]Hammer Banking the Great Library[/thread]

[url=http://apolyton.net/forums/showthread.php?s=&threadid=157333]Apolyton: The Whipping Thread[/url]

[indent]Blake’s whipping guidelines, with case studies[/indent]

[b]CREDITS[/b]

The Heroic Theatre exploit was first described by [thread=169499]Paeanblack[/thread].
The mechanics of whipping the first worker was described by [url=http://realmsbeyond.net/forums/showpost.php?p=17599&postcount=14]Blake[/url]
Unit Obsolescence was first brought to my attention by [post=4913415]Zombie69[/post]

[url=http://forums.civfanatics.com/showthread.php?t=193659]Discuss this article on the forum[/url]