1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. Photobucket has changed its policy concerning hotlinking images and now requires an account with a $399.00 annual fee to allow hotlink. More information is available at: this link.
    Dismiss Notice
  3. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  4. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  5. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  6. Dismiss Notice
  7. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

Hammer Overflow

Discussion in 'Civ4 Strategy Articles' started by vale, Apr 21, 2007.

  1. vale

    vale Mathematician

    Joined:
    Mar 14, 2007
    Messages:
    742
    Location:
    San Antonio
    Hammer Overflow

    Introduction

    In this article, I will explain what happens between turns to the excess :hammers: from a completed build. After that I will examine some potentially uses of overflow to gain some advantages. Throughout the article, any numbers I quote are from the marathon game speed but can be scaled appropriately to your game speed of choice. As of the most recent patch, the way gold overflow works has been slightly changed. The numbers in the original article are still valid for Warlords 2.08. I will update to reflect the BTS changes as I expect them to be based on the patch notes. When I get to try out the patch I will confirm that this is correct. I still have not been able to test this in 3.19 but from all information I have, early game gold overflow does not exist.

    Definitions:

    True Cost - The actual :hammers: cost of a build
    Production Multiplier - The production bonus applied to a build converted from a percent + 1
    Base Production Multiplier - The production bonus in the city that is applied to any build that city makes + 1.
    Base Cost - True Cost/Production Multiplier
    Excess Hammers - at the completion of a build in a city, the total number of :hammers: invested minus the True Cost
    Base Hammers - Excess Hammers/Production Multiplier
    Hammers per Turn - the number of :hammers: produced in a city each turn before any production bonuses
    Modified Hammers per Turn - the number of :hammers: produced in a city each turn for a build including production bonuses
    Overflow Hammers - the number of :hammers: that are carried over the turn after a build is completed in a city (how to calculate is below)
    Overflow Gold - the amount of :gold: added to the treasury as a result of overflow (how to calculate is below)

    The Mechanics of Overflow

    At the completion of a production project in a city, if the Base Hammers value does not exceed both the Base Cost and the Hammers per Turn values, then the Overflow Hammers = Base Hammers. This is what happens most of the time.

    However, if the Base Hammers exceeds both the Base Cost and the Hammers per Turn values, then the Overflow Hammers = max{Base Cost, Hammers per Turn}. To compensate for the lost :hammers:, in Warlords 2.08, Overflow Gold = Excess Hammers - max{True Cost, Modified Hammers per Turn} is added to the treasury. In BTS 3.19, the system is quite strange and very unintuitive. I'm not a code guy so I don't really understand exactly what is happening in this post and how the terms there relate to the terms used in my original post.

    The Wonder Whipping Overflow Trick - still just as relevant in BTS 3.19

    Whipping wonders does not convert :food: to :hammers: at the same rate as whipping normal buildings or units. However, if you whip a building the turn before completion, the Overflow Hammers will be applied to the wonder that follows even though they were created using a more beneficial :food: to :hammers: ratio. This is very easy to pull off, just try to ensure that none of your Excess Hammers are being converted to Overflow Gold by whipping only on a building that has a Base Cost somewhat greater than 90 :hammers:.

    The Chopping/Whipping Wealth Without Currency Trick - no longer boosted by specific bonuses in BTS 3.19, these will only work in Warlords 2.08

    Another possible use is to generate gold by creating an enormous Excess Hammer value. Since production bonuses do apply to the gold generated this way, early double production buildings can be used to create a large amount of gold. Lets do the math on one example:

    Say we have an aggressive leader knowing mathematics(not Shaka since his barracks are more expensive) and bronze working, have adopted slavery, and are building a barracks in a city with some available forests, a granary and at least 2 population. We build to within one turn of completion then move it down in the queue and build something else while we chop two forests simultaneously. On the turn that the forests finish chopping, we move the barracks up in the queue and whip it. So

    True Cost = 150
    Production Multiplier = 1 + 1 = 2
    Base Cost = 150/2 = 75
    Excess Hammers = [90 (forest chop) + 90 (forest chop) + 90 (whip hammers)]*2(production bonus) + 150 (cost of barracks being covered by "real" production of city) - 150 (True Cost of the Barracks) = 540
    Base Hammers = 540/2 = 270
    Hammers per turn is unknown but certainly less than 75
    Modified Hammers per turn unknown but not relevant because of the above
    Overflow Hammers = 75 since 270 > 75
    Overflow Gold = 540 - 150 = 390

    So, for the cost of chopping two forests and whipping one population we have created an overflow of 75 :hammers: and 390 :gold:.
     
  2. vale

    vale Mathematician

    Joined:
    Mar 14, 2007
    Messages:
    742
    Location:
    San Antonio
    Do Production Modifiers Really Make a Big Difference?

    Heck yes. Lets do the math for this with a monument.

    True Cost = 90
    Production Multiplier = 1
    Base Cost = 90 = 90
    Excess Hammers = [90 (forest chop) + 90 (forest chop) + 90 (whip hammers)]*1(production multiplier) + 90 (cost of monument being covered by "real" production of city) - 90 (True Cost of the monument) = 270
    Base Hammers = 270/1 = 270
    Hammers per turn is unknown but certainly less than 90
    Modified Hammers per turn unknown but not relevant because of the above
    Overflow Hammers = 90 since 270 > 90
    Overflow Gold = 270 - 90 = 180

    So we are only getting 180 :gold: and 90 :hammers:.

    But How Does This Relate to the Protective Trait?

    What a great question :lol:. Lets redo the above math, but this time we will be using walls with a protective leader and access to stone.

    True Cost = 150
    Production Multiplier = 1 + 1 + 1 = 3
    Base Cost = 150/3 = 50
    Excess Hammers = [90 (forest chop) + 90 (forest chop) + 90 (whip hammers)]*3(production multiplier) + 150 (cost of walls being covered by "real" production of city) - 150 (True Cost of the walls) = 810
    Base Hammers = 810/3 = 270
    Hammers per turn is unknown but certainly less than 50
    Modified Hammers per turn unknown but not relevant because of the above
    Overflow Hammers = 50 since 270 > 50
    Overflow Gold = 810 - 150 = 660

    So, for the cost of chopping two forests and whipping one population we have created an overflow of 50 :hammers: and 660 :gold:.

    Admittedly, you did just build a walls and everyone gets to make fun of you for that.

    Can You Do the Numbers for Other Game Speeds?

    No. It isn't too hard to convert them yourself. In general any numbers I've used as an example here that aren't multipliers will be multiplied by a factor of 1/5 for quick, 1/3 for normal and 1/2 for epic. Multipliers are obviously independent of game speed.

    Can you provide a concrete example of this in action?

    Luckily, it seems Sisiutil has done this in one of his ALC games complete with pretty pictures and all.

    Note that in this case, the chops were not math powered so there were fewer base hammers than in the example above.

    Conclusion - Isn't that a Little Cheap?

    Hey, I'm just reporting the mechanic here. Exhibit restraint if you think its an exploit. I do agree that at best this borders on exploitative. I haven't actually used this in game but a way to generate that type of cash that early in the game seems pretty decent.
     
  3. the oob

    the oob Retired PTBS host

    Joined:
    Nov 5, 2005
    Messages:
    1,004
    Location:
    Auckland, New Zealand
    You took the production multiplier into account twice, by making the chop/whip amount 90 (3 times the normal amount) and then multiplying the sum again by 3.
     
  4. vale

    vale Mathematician

    Joined:
    Mar 14, 2007
    Messages:
    742
    Location:
    San Antonio
    This is marathon speed settings. Math powered chops and any whips are 90 hammers.
     
  5. the oob

    the oob Retired PTBS host

    Joined:
    Nov 5, 2005
    Messages:
    1,004
    Location:
    Auckland, New Zealand
    Ah, my bad.
     
  6. vale

    vale Mathematician

    Joined:
    Mar 14, 2007
    Messages:
    742
    Location:
    San Antonio
    A Random Thought Experiment

    Warning: more detailed math analysis to follow than before. Proceed at your own risk.

    Lets suppose we get towards the late game when we have a powerful military production city (P hammers per turn) that is stagnant growth (production will not change) with a large military production bonus (k production multiplier for military units). Let us also suppose we have a military unit having True Cost C hammers that we want to produce indefinitely in that city that can be more than completed in 1 turn (that is kP>C). I am wondering how the overflow amounts are going to change over time.

    Define xi = the hammer overflow coming in at the start of turn i and yi = the gold overflow coming in at the start of turn i. So x1 = 0 and y1 = 0.

    Now we are interested in finding xi+1 in terms of the prior amounts. I'll work out the math the same way as before:

    True Cost = C
    Production Multiplier = k
    Base Cost = C/k
    Excess Hammers = kP + kxi - C
    Base Hammers = P + xi - C/k
    Hammers per turn = P
    Modified Hammers per turn = kP
    Overflow Hammers xi+1 = min {P + xi - C/k, P} (since P>C/k) = min {i (P-C/k) + x1, P} = min {i (P-C/k), P}
    Overflow Gold = yi+1 = max {0, kxi - C} (since kP>C) = max {0, min {(i-1)kP - iC, kP-C}}

    What this means is that the overflow hammers will increment by P-C/k each turn to a maximum of P at which point it will remain constantly P. It will reach its maximum on the ceiling[P/(P-C/k)]+1 turn. The overflow gold on the other hand will start off as a constant 0 until after kxi > C, at which point it will grow linearly until reaching its maximum value of KP-C the turn after overflow hammers max out.

    This is happening linearly so it is a finite number of turns before they achieve these caps. So at some reachable point that city will be spitting out one unit and kP-C :gold: each turn. To provide a real example, on quick speed, artillery cost 100:hammers:. A city producing a base of 63 hammers per turn with a military production multiplier of 3.75 (1 base + 1 heroic epic + .5 military academy + .25 police state + 1 forge and powered factory) will eventually (in fact by the fourth turn) be churning out 136.25 :gold: a turn in addition to the artillery it makes.

    This is all good in theory but when I put it into practice something weird happened. The overflow starts capping at 62 instead of 63 and thus the numbers come out slightly off. I'm guessing there is some sort of rounding issue happening here, but I'm not a code person so I have no idea. I would be much obliged if someone can explain to me why the theory is not meshing perfectly with real life.

    Turn before overflow:





    Turn after:



    As you see the net hammers per turn have not increased (overflow is still only 62) and I am getting 132:gold: instead of the predicted 136.25:gold: (understandable since we don't have all the hammers predicted). Still, note how superior this is to building wealth (which would be providing 126:gold: per turn and no artillery)
     
  7. oyzar

    oyzar Have quit civ/forums

    Joined:
    Oct 7, 2006
    Messages:
    6,923
    Location:
    Norway
    this might be the reason that upgrades work the way they do. Otherwise it would be way to easy to get units for cheap. as it is now you pay about the same in hammer overflow for the upgrades. Wealth is of course usefull for more things than upgrades. whipping 2 pop into a barracks on normal speed as agressive with or running that is allready overflow from forests would give you 135 gold? or even 67 gold from 1 pop is pretty crazy especially at small sizes. one wonder how good HE + GT + forge is in a city that can still produce warriors(not hunting is enough for this right?). Assuming you whip a warrior when its 1 turn from completion thats still 50 gold for 1 pop(and likely 1 turn of growth) and you get a warrior for cheap happiness boost somewhere else. Of course you could just do like in the artillery expriment. If you can ladder up units somehow archer/chariot -> axeman/spear -> catapult/sword -> longbow -> x-bow/phant -> maceman you might get alot of gold. Though it might require loads of chopping anyways as some of the basehammer requirements are quite high.

    ok i tried this. It seems quite insane to me. I had a city with HE and GT(high food high production from world builder) and forge. I let it put out 15 basehammers per turn. Here is what i did. Got a swordman axeman and a catapult all within 2 hammers of compleetion. I then started whipping them once each just to see the effect. Building sword -> axe -> catapult it produced 58 160 252 gold in 3 turns at the cost of 3 pop and 3 unhappines with a baseoutput of 15 hammers with 17 hammers left over using HE and forge i got 252/(45*3)=1.86667 times the hammer invested returned in gold, the rest is lost to rounding error and i did get 17 extra hammers with multipliers this is 296/135=2.19 times the hammers invested so not too much is lost. This is quite huge since you can whip pop into gold at pretty much moments notice assuming your allready producing units at a steady rate. It happens fairly often that you get high food high hammer capitals. Alternativly if you want to use your capital to produce other gp's than artists you can put it in a captured capital as they tend to be awesoeme high food and production cities too. This was without burecracy, with it would obviously be higher.

    This basically allow you to turn pop into gold at a conversion rate of ~65/1 which is quite decent imo. Of course it comes nowhere near what a super science or comerce city can put out but its quite alot considering its mostly from a city producing units only.
     
  8. UncleJJ

    UncleJJ Chieftain

    Joined:
    Jun 13, 2006
    Messages:
    2,226
    Location:
    London
    vale; does this still work the same way in BtS? I would test it myself but you know better what to look for.
     
  9. vale

    vale Mathematician

    Joined:
    Mar 14, 2007
    Messages:
    742
    Location:
    San Antonio
    From limited testing, it appears to work the same way in BTS 3.03.
     
  10. Cer

    Cer Chieftain

    Joined:
    Aug 20, 2007
    Messages:
    145
    I have Civ4 vanilla, I wonder if it's the same in vanilla.
     
  11. vale

    vale Mathematician

    Joined:
    Mar 14, 2007
    Messages:
    742
    Location:
    San Antonio
    Definitely in the original patches of vanilla, this did not work the same way. If I remember correctly, the overflow hammers were capped in the same way, but excess hammers were not converted to gold. I haven't tested it basically in forever (once I get a new toy its very hard to convince me to go back to the old ones). My original Civ IV dvd is all scratched up after probably a little bit of overuse, so it isn't even clear I can load vanilla anymore, so I will have to leave the testing to someone who didn't abuse their dvd.

    Easy to set up...start game settings duel, no barbarians, Isabella. World builder yourself 3 or 4 workers, bronze working, pottery, mathematics, a border pop, some random improvements to work, and some population.

    Start construction of the Granary. When it gets close to complete, have all the workers start chopping an individual forest each. If the Granary would be completing before the chops come in, swap it away until the chops happen. On the turn the chops happen, swap back to the Granary and whip it. End turn and see where your gold is. Now open the city screen and see how many hammer overflowed when you start a new build.

    If the hammer overflow cap is the same, then your overflow hammers should be capped at half of the granaries cost (I believe 60/2=30 hammers on normal). If the excess hammers are being converted into gold, you should have a ridiculous amount of gold sitting around. Oh and if someone actually sets up this test on the latest Vanilla patch, feel free to report back what your results were.
     
  12. PieceOfMind

    PieceOfMind Drill IV Defender Retired Moderator

    Joined:
    Jan 15, 2006
    Messages:
    9,312
    Location:
    Australia
    vale, I have a question for you (or anyone else competent enough to answer this)...

    I'm not very familiar with this hammer-to-gold overflow mechanic as most of the game mechanics I learnt were for vanilla civ.

    My question is, seeing as so many have been complaining about how cheap guided missiles are in BtS and how much a waste of time it is to build them, would it be feasible to build these in a high production city (but probably not the HE city) and "rake in the dough" for all the overflow? This could make them an attractive build order when wanting to bring in more gold without fiddling with the sliders.

    Thanks in advance.
     
  13. vale

    vale Mathematician

    Joined:
    Mar 14, 2007
    Messages:
    742
    Location:
    San Antonio
    I will respond to your question assuming quick speed because that is the speed most conducive to this type of gold mongering because the hammer costs are reduced.

    First a disclaimer: I'm tired and not 100% sure about this but in my recollection, the only things that will give specific production bonuses to guided missiles would be heroic epic (+100%) and police state (+25%). If there others please pm me or respond here and remind me of them so I can correct the analysis.

    Anti-math-ish answer:

    So assuming no heroic epic in the city and no police state, the gold generated from overflow will max out in theory at 40 gold per turn less than just building wealth would. In practice, it will probably be somewhat more than that (around 44 gold per turn) because of rounding issues in the game. So unless those missiles have some other value to you, wealth would be better.

    If you are running Police State, but no Heroic Epic things get better. Still it will be producing less gold than just building Wealth unless your city is producing more than 160 base hammers per turn (i.e. pre modifier hammers not including any overflow).

    If you have HE, but are not running police state, then the overflow gold exceeds Wealth when the base hammers more than 40 per turn.

    If you have HE and police state then the overflow gold exceeds wealth when the base hammers are more than 32 per turn.

    Math-ish answer:

    Building Wealth in a city generates k1P gold per turn where P is the base hammers per turn and k1 is the total non-type-specific production multiplier (stuff like forges, factories, bureaucracy). Gold overflow will eventually cap out at (k1 + k2)P - C gold per turn where k2 is the type-specific production bonus and C is the cost of the built item.

    So the gold generated by overflow in excess of the possible gold generated by wealth in a city is just k2P - C. We want that to be bigger than 0 or wealth will be better so we need that P > C / k2. Using C = 40 (cost of guided missile on quick, and the various values of k2 associated with different combinations of Heroic Epic and Police State, we arrive at the conclusions listed in the other answer.

    Main point is, this is very unlikely to be worth it outside of the HE city unless the built units have some value.

    Incidentally, if the only purpose of building a military unit is to generate the gold overflow (and you are planning on just deleting the built units as they come out), explorers give the best bang for the buck at that point since they cost only 26 hammers and so can generate significantly more gold.

    Edited to add: Until you hook up oil or uranium, Caravels could theoretically be really good for gold overflow tricks. They cost 40 hammers on quick, and there is another 50% production bonus available for them in Drydocks. Of course there is the whole problem that coastal cities aren't typically hammer monsters.
     
  14. T-hawk

    T-hawk Transcend

    Joined:
    Feb 14, 2002
    Messages:
    2,564
    Location:
    Hoboken NJ / NYC
    Right. The overflow cap is the same in vanilla, and there is no conversion of overflow hammers to gold at all.


    And this is because these tricks depend on intentionally trying to exceed the absolute cap of 1 unit built per turn in a city, which does not scale with different speeds. On Marathon, we can build 4.5 units in a city in the same portion of game time that we can build only 1 unit on Quick. To close this loophole, we'd have to have cities able to build multiple units per turn, either uncapped or scaling with game speed (1/2/3/4.5 on Marathon/Epic/Normal/Quick.)
     
  15. PieceOfMind

    PieceOfMind Drill IV Defender Retired Moderator

    Joined:
    Jan 15, 2006
    Messages:
    9,312
    Location:
    Australia
    I'd written a reply for this thread but it must have gotten lost somehow. Anyhow, I'll try to remember what I said..

    I don't intend to build the missiles for the sole purpose of making money. I want to build them under the assumption that they are the same value as any other military build for their cost. However, I would like to think that building them in a city which could build more than 1 of them per turn is not wasting anything unnecessarily.

    I asked about the missiles in particular because they seem to be the cheapest late game build order, and it seemed this overflow hammer to gold trick seemed to work best with low-hammer build items.


    So really I'm interested in whether it's worth it when you factor in the fact that you're getting missiles as well, and assuming they are not a useless unit for what they cost. (I'm yet to decide yet whether they are worth the hammers they cost.)

    Thanks vale!
     
  16. KrikkitTwo

    KrikkitTwo Immortal

    Joined:
    Apr 3, 2004
    Messages:
    12,296
    Side note, essentially, this is basically building Wealth with special bonuses so it works for

    Building your Trait's special building (Courthouse with Organized)
    Building something with a resource bonus (Eiffel tower with Iron)
    Building Military units in Heroic epic/Military Academy/Police State Cities*
    Building Naval units with a Dry dock*
    Building Workers/Settlers with Expansive/Imperialistic*

    *These appear to be the exploitable ones since units can be repeat built


    Still that is a minor exploit and its nice to know hammers aren't just wasted.
     
  17. vale

    vale Mathematician

    Joined:
    Mar 14, 2007
    Messages:
    742
    Location:
    San Antonio
    To make the sentence fully true, you should say this is basically building Wealth with special bonuses and hammers from chops and whipping incorporated.

    The italicized part is what makes this potentially lucrative in the early game. One protective stone boosted walls in the early game with heavy whip and chop overflow can generate a ton of gold in a nice lump sum. This can be used to deficit research to currency and code of laws in the unfortunate situation where you have over expanded before obtaining these critical techs. In fact to hearken back to the thread in Strategy and Tips about hammer worth, the hammers are being converted at as good a rate as 1 hammer to 3 gold which is pretty amazing according to most of the estimates given in the thread.

    Even doing other production boosted buildings gets you as good a rate as 1 hammer to 2 gold. Expansive Granaries, Aggressive Barracks and especially Aggressive Ikhandas seem like excellent targets for such tricks.

    Also thanks for mentioning the military academy. It totally slipped my mind because I've always dismissed it as a waste of a great general as opposed to settling.
     
  18. Qwack

    Qwack The Poopman

    Joined:
    Jan 21, 2006
    Messages:
    836
    This is somewhat similiar to the 1.61 bug with whipping. Im surprised it was not fixed in BtS, but that is probably because alot of people do not know about this yet. I just came across this thread today so I can assume that others may not have seen this it yet.

    Nice find though Vale, hopefully it is fixed in the next patch. Also a random thought: If you build research while chopping all forests in a single city, all those chops will get "saved" and there is no decay on them, then whenever everything is chopped you can switch over to the walls or whatever other building has modifiers and cash out alot of gold. This allows you to make the conversion without pre-chopping the forests or many workers chopping at the same time.
     
  19. vale

    vale Mathematician

    Joined:
    Mar 14, 2007
    Messages:
    742
    Location:
    San Antonio
    I think the only thing they really need to do to fix the exploit is to make sure that they factor out the type-specific production bonuses (k2 in my math-ish explanation above) when converting lost hammers to gold. With this simple fix then hammers are being converted at the same rate as wealth would with the only exploit being that you can chop and whip this "wealth" and you can build it before currency, both of dubious value without the improved conversion rate offered by discounts.
     
  20. KrikkitTwo

    KrikkitTwo Immortal

    Joined:
    Apr 3, 2004
    Messages:
    12,296

    Actually, It might be good if they allowed chopping for Wealth/Culture/Research, so that the 'overflow' doesn't just sit around

    All they really need to do to fix it is change

    Overflow Gold = Excess Hammers - max{True Cost, Modified Hammers per Turn}

    to

    Overflow Gold=General Multipliers * (Base Hammers - max{Base Cost, Hammers per Turn})


    Overall I really like this, since I was used to finding just the right cities to build things like missionaries. Its nice to know that if the city was done with its buildings anyways (and onto research) then there's no waste.
     

Share This Page