In BTS AI got greatly increased production bonuses.

Discussion in 'Civ4 - General Discussions' started by Mutineer, Jul 23, 2007.

  1. mjs0

    mjs0 The 4th X

    Joined:
    Nov 9, 2001
    Messages:
    1,063
    Location:
    Central Florida
    Having played three or four games with BTS now my personal opinion is that the AI is much more fun to play against. It is behaving more logically and with more cunning, or rather, it has been nicely programmed to appear more logical and cunning (gotta watch those anthropomorphisms!).

    In a previous life (job) I worked on, and later managed a team, creating expert systems that analysed information presented to them and then, based on captured expert knowledge, advised on optimal strategies for proceeding based on that information. So, the complexity and limitations inherent in creating an AI that works for Civ4 are professionally interesting to me.

    When considering the AI I try to bear in mind all the factors involved in creating an AI and especially my expectations of what it should be good at and what it is unreasonable to expect is to be good at:

    Examples of things the AI should be good at:
    - Efficiency and Micromanagement
    Every turn in every city the AI can optimize tile usage for current needs. Workers can immediately respond to events and start hooking up newly available resources, upgrade to railroads (though not always prioritizing tiles correctly yet), and fix sabotaged/bombed improvements.
    - Computing expectations in very specific situations (e.g. estimating likely battle outcomes)
    Brute force computing should allow the AI to determine the optimal order in which to attack with a stack, where optimal means most likely to win this one engagement.
    - Staying focused on its chosen path
    No getting distracted building favourite wonders or forgetting to change production in some cities. Once a path is chosen all cities and units march in sync, (until next turn).

    Examples of things the AI may struggle with:
    - Balancing Strategy and Tactics
    Unfortunately the AIs potential strength in assessing individual (stack vs. stack) tactical combat doesn't always result in good strategy. Optimal tactics in a single battle may result in losses of key strategic units to the detriment of the war as a whole.
    - Threat Analysis
    Is that stack a real threat or a feint? Should it be attacked in the field or should my stack turtle in a city? The correct answer may depend on the location of two more stacks that would threaten my city if I sallied. What direction did they come from, where might they be heading?
    - Overall strategy/the big picture (everything is numbers...no visualization of sweeping strategies)
    For example...without some pretty sophisticated topographical analysis routines it would be impossible for the AI to accurately compare two borders and assess which is the most defensible and factor that in when choosing which neighbour to attack and which to contain.
    - Opportunism (often hamstrung by personalities and inability to think strategically)
    Basically as a human we can assess quickly new opportunities and even when planning war with one nation spot a sudden weakness/opportunity in another area. A peacemonger like Ghandi may ignore poorly defended border cities that most humans (builder or warmonger) would find not just tempting but irresistible.
    - Vulnerability to, and ignorance of, exploits (If it used them they wouldn't be exploits!)
    The AI picks from the same hard-coded strategies every game, it doesn't read CivFanatics and try out the new uber strategy of the week, it won't know about that bug in diplomacy that will be noticed in October that allows you to extract more and more gold from Mansa Musa when you renegotiate (fabricated example). Specifically, the AI does not learn from experience.
    - Adapting (Oh dear, war looked like such a good idea ten turns ago)
    It decides war with Spain is a good idea and sets about building an army. Meanwhile, Spain builds the statue of zeus, Chichen Itza, upgrades all its archers to longbows and beefs up its defenses in border cities. Now what? Does it still go to war? Does it exercise discretion? Does it delay the war and attempt a troop surge? :mischief:

    Of course, this is just a sample of each list, and there are design approaches to allow the AI to deal with each of the deficiencies but never to the same level of competency as a good (let alone master) human player.

    In order for the AI to have a chance of competing with good players it simply has to maximize the things it is good at and receive bonuses to compensate for its weaknesses. What Mutineer is observing is a synergy between its bonuses and what it has been programmed to do. I personally regard this as a good thing, in an ideal world I would want an equal game for a really good player at around monarch (i.e. 50/50 wins) meaning emperor becomes a real challenge, immortal would be tough and deity almost impossible.
    In fact as colony just pointed out many bonuses have been scaled back...at 80% on deity the AI will grow an equivalent city with similar tactics to size 10 in the time it takes me to get to size 8, that difference, on the very highest level seems perfectly reasonable especially given the reductions in this and other bonuses (upgradecost%, inflation%, etc) since warlords. How else should the higher difficulties be made challenging?

    The beauty of Civ4 is that unlike many games where the advantages on higher levels are hard-coded it is very easy to tweak the balance to suit your own tastes. For me personally, on the games I have played so far, Firaxis seem to have done a remarkably good job of maintaining balance despite the far-reaching changes in AI behaviour and capabilities.
     
  2. Yakk

    Yakk Cheftan

    Joined:
    Mar 6, 2006
    Messages:
    1,288
    Mutineer, you are right -- the AI improvements mean that the AI will leverage it's growth and production bonuses better than it did before. I suspect that even with the reduced raw production modifiers, the AI will be producing better than it did before.

    In exchange, it's unit support bonuses are much weaker.

    Now, it could cottage spam -- but really, it should do a mix of farms to bootstrap up in size and cottages after it gains size. It should think about specialist economies. It should do a bunch of things better.

    The shift in BTS was away from "state" advantages, and towards production and growth advantages. The higher level AI is supposed to be playing at an advantage to a player.

    And note that the AI's better use of units is also important -- that means it didnt need as much production in order to match the human in warfare.

    This is actually too expensive.

    Given 10 attacking units, there are 10! orders to attack in.

    Or 3,628,800. And to work out odds, you need to keep track of the distribution of damage to the target stack, which multiplies the requirements by another huge order of magnidude.

    A 10 unit stack vs a 10 unit stack has state of:
    100^10 + 2^20
    for the purposes of dynamic programming, so we can't even use that shortcut.

    And stacks get much larger than 10 units tall.

    Sadly, one needs to use heuristics for this so the AI can run in real-time.

    The AI is open source. So yes, it does learn from civfanatics discussions. :)

    That's easy -- the tricky part is to prevent it from waffeling too much.
     
  3. mjs0

    mjs0 The 4th X

    Joined:
    Nov 9, 2001
    Messages:
    1,063
    Location:
    Central Florida
    Completely agree, there is no way all that could be done on the fly and remain playable.

    I guess I should have expounded further and explained what I meant as this is a common trade-off with expert systems and dynamic configuration/decision making. Basically in this case what I would envisage was the use of previously computed outcomes of classes of battles combined with an on the fly system of classifying encounters and using the pre-computed data to advise the AI on how to proceed.

    It might work...it might not, or (most likely) it might work but the improvement over raw heuristics be insignificant compared to the effort. However, it would be interesting to try!

    Darn, I guess I'll have to restrict access to CivFanatics using parental controls so I can keep it dumb. :)

    Exactly, the tendency to flip-flop from one course of action to another when information is at or near a decision cusp has to be carefully managed.
     
  4. LlamaCat

    LlamaCat Emperor

    Joined:
    Dec 29, 2005
    Messages:
    1,212
    this Mutineer character is something else... he just likes to complain but where are his solutions? blake and others in this community are contributing greatly to the game but he does seem to have a vendetta against him for some strange reason. I don't understand what people expect anyway... this is a computer game, it can't think like humans and it is very limited in how it scales up the difficulty levels. you have to basically trade one bonus for another if you want to adjust how it plays.
     
  5. Yakk

    Yakk Cheftan

    Joined:
    Mar 6, 2006
    Messages:
    1,288
    Aka, heuristics. :)

    In the pre-BTS AI, there is code that checks for a high chance of victory. If not, it looks for sacrifice units to weaken the target stack.

    I wanted to add a "simulate 3 to 5 complete battles, and see if we like the outcome" code, paying attention to the economic, tactical and strategic results of the fight.

    Tactical: What units are exposed after the fight? What units can retreat? What defenders are freed up by taking out the target stack?

    Economic: What is expected power and hammer costs to each side? What are the power and hammer ratios of the empires, and do we win if we continue with trades of this sort? How quickly can we turn hammers into power?

    Strategic: Does this fight further strategic goals, like "take city X"? Does it give us local power domination? Ie, what is the value of clearing units from this area or taking that stronghold, or should we just ignore it?

    Calculating numbers for Tactics and Economics is relatively easy. Deciding what to do with the results is harder. Strategic decisions are harder to make decent numbers for.

    It would be reasonably hard -- units in civ4 aren't that homogeneous. But I guess it would be worth a try.

    :p Just don't download player AI patches. And don't download BTS AI, because it is the result of lots of CFC and other player thoughts and optimizations.
     
  6. onedreamer

    onedreamer Dragon

    Joined:
    Oct 21, 2004
    Messages:
    6,580
    Location:
    Torino - Italia
    Well this is not true. I have seen more than once the AI whipping since Vanilla, not sure about Drafting as you can't tell for sure like in Civ3.
     
  7. Zhahz

    Zhahz PC Gamer

    Joined:
    Oct 18, 2005
    Messages:
    1,615
    Location:
    Phoenix, AZ
    I don't think he's saying the AI has a higher (growth) bonus now - what he's saying is that since the AI whips now, and whips a lot, that it's getting a lot more out of it than it ever did before, which results in more production than before. The point he's making is that the AI can whip a lot without sacrificing working tiles or developing cottages as much as a player, which gives it an advantage.

    However, the AIs in Civ have always had some kind of advantages on most difficulty levels, so it probably balances out. From what I've read, the AI is getting less bonuses across the board to adjust to the AI being more efficient - which sounds great - I prefer difficulty via superior AI, not via bonuses to compensate for mediocre AI. If they're paying more for unit upgrades and losing raw production or research bonuses, then that sounds great.
     
  8. Cataphract887

    Cataphract887 Prince

    Joined:
    Oct 1, 2004
    Messages:
    257
    Location:
    Michigan
    QFT

    It seems alot of players here have severe reading comprehension problems
     
  9. lockstep

    lockstep Prince

    Joined:
    Jan 15, 2004
    Messages:
    399
    Location:
    Vienna, Austria
    Whatever point Mutineer was trying to make, at least he should have mentioned that blake actually reduced the growth bonuses in BtS for higher levels (although maybe not enough in Mutineers opinion).
     
  10. sunrise089

    sunrise089 Not that good

    Joined:
    May 24, 2006
    Messages:
    797
    By far my most complex post ever:

    First bold: I think he's saying the production bonus has increased, by way of leveraging the growth bonus.

    Second bold: If that's so then the AI is still getting its bonus, but combined with its newfound ability to whip and draft more....

    Third bold: Makes Mutineer right, in the strict sense about AI potential production, assuming other bonuses haven't been reduced to compensate.

    Touché sire :)

    Thanks for providing this. It appears then that Muti is correct. The bonuses are still there, and only noticeably different on Deity level.

    I sort of agree, and I can offer a (100% purely speculative) reason: Muti is the best player I've seen at using whipping and drafting. Reading through his BlakeAI Deity SG, he would oftentimes advise very aggressive pop sacrificing and unhappiness strategies that seemed to be inadvisable, but were actually very powerful. His main contention seemed based upon actual returns from each tile and each pop - claiming that many many times it's better to get quick production and put it to good use rather than slowly building.

    During the early development of BetterAI Muti posted in its thread and made some points about food vs production issues. He was politely received, but not totally agreed with. He got the impression than the BetterAI folks didn't understand the food vs production relationship completely, and therefore were making an AI that had some flaws. Remember, Muti seems to value whipping and drafting more than any other player I know of.

    Later, in the aforementioned Deity SG, Blake was also signed up as a member. He and Muti again exchanged some mildly heated discussion. It's possible Muti had his idea reinforced that Blake was essentially wrong about food/slavery. Later, (iirc) Blake disappeared from that thread without announcing his departure. He also left RBW2 at the same time, a game I was a part of that Blake himself started. I know from experience no notice was given to me in that game that Blake had decided to end his participation.

    Therefore, I surmise that Muti feels like Blake does not understand how powerful slavery can be in the presence of lots of food, felt a bit perturbed at him for disagreeing with him and rejecting his (occasionally difficult to understand) advice, and then got a bit more mad when Blake left the SG and provided no notice. I think threads like this are the result.

    First bold: Muti is one of the best players in the game. He has at many times offered solutions to Blake himself, as well as on these forums.

    Second bold: On many occasions Firaxis has claimed this is not the case.

    I'm 100% sure from experience that BetterAI whips more than default AI. It is logical to assume that Blake's work on BtS means the BtS AI will whip and draft more.

    Agreed.

    He reduced them a tiny bit - between 10% and up to 33% on Deity. This is nowhere near enough to compensate if the AI figures out how to best convert its pop to hammers.
     
  11. Jet

    Jet No, no, please. Please.

    Joined:
    Mar 16, 2006
    Messages:
    2,365
    I disagree with either your mechanical interpretation of the numbers, or your interpretation of the change to the growth bonus as "tiny". I read number X to mean "the AI needs X% of the default food quantity to grow". If my reading is right, then in relative terms the AI growth bonus was reduced as follows:

    Prince: eliminated
    Monarch: halved
    Emperor: reduced to 2/3
    Immortal: reduced to 3/4
    Deity: halved

    Now sure, mine looks larger because I'm stating it relatively, where you're stating it absolutely.* But either way, the change to the growth bonus does not appear to me to be "tiny". "Modest", maybe; I don't know. What really matters for the purpose of describing it is its overall effect in the context of the game, and that's complicated to analyze.

    For example, when you say "if the AI figures out how to best convert its pop to hammers", then as you are suggesting, in practice it matters very much how and when the AI chooses to do it. For example, I can imagine how it could have been programmed to (a) build enough food improvements to get to its happy cap, with a surplus of 2 at the happy cap and (b) whip only emergency defenders at any pop, and other stuff only with excess food at its happy cap - but who knows. And how and when the AI whips and drafts is only one of multiple relevant issues.

    (The numbers above will be slightly different if you think the "bonus" in the number 85% is better interpreted, not as a bonus of 100%-85%=15% as I have, but rather as a bonus of ((100%/85%)-1) = 17.6%... but the difference is not that large.)

    *Well, I thought you were trying to state it absolutely, but then neither of your numbers makes sense, so I have to admit I don't understand them.
     
  12. ThERat

    ThERat Deity

    Joined:
    Nov 29, 2004
    Messages:
    11,380
    Location:
    City of one angel
    great post sunrise089

    I think a lot of people do not match the level mutineer is playing at (that surely includes myself). I have shared several SG's with him and he is one of the most oustanding players for sure. His approach is quite different from other, standard players. During the Deity SG, even I was quite annoyed that we were suddenly 'left alone' when Blake ceertainly started to work for BtS. That game showed the potential flaw of the 'better AI'. More discussion might have been beneficial for Blake's work on a Better AI.

    The problem is that there are a lot of casual players on civfanatics, that do not read threads properly and show immediate knee jerk reactions. It's pretty difficult to have a proper discussion here at times without fanbois intervention.
     
  13. Blake

    Blake The AI Guy

    Joined:
    Feb 18, 2006
    Messages:
    342
    Location:
    Apolyton
    1) The fact that AI gets cheaper units means that it suffers comparatively more happiness penalty from whipping. For example an AI axeman may cost 29h due to discounts - this means it cannot possibly be 2-pop whipped. Since the AI wont really use 1 pop whips except in total desperation, this means that the AI almost never whips early units. It may whip later units a little, but by then slavery starts to lose much of it's appeal.
    Basically the AI whipping potential is very limited by happiness - much moreso than with humans (and humans are already highly limited by happiness). It's not the perfect balance but it's workable.

    2) The AI doesn't actually whip much anyway.
    In Warlords 2.08 the AI gained a simplistic algorithm of "Always grow, and whip away the excess", that was because it was the simple strategy used to work around the abysmal governor.
    In BTS the governor does an infinitely better job of balancing growth with bringing in hammers from the land. This means that players and AI alike don't need to use slavery as a crutch.

    3) While in principle it would be possible, if extremely difficult, to optimize the AI to make use of it's growth bonuses in order to leverage slavery to the extreme, this optimization was not done. The AI does not systematically abuse slavery, basically the productivity the AI gains under Slavery is completely in line with the other AI bonuses.

    Note: It is quite likely that strong early AI armies are chopped moreso than whipped.
     
  14. sunrise089

    sunrise089 Not that good

    Joined:
    May 24, 2006
    Messages:
    797
    First of all, my numbers are percentages of the original numbers and they were estimates in my head. Therefore Prince moved from 95 to 100, so about a 5% increase, through Deity, from 60-80 and therefore 33%. I did make a mistake though and say 10-33 rather than 5-33, and even that is only the ones that actually changed. The correct thing to have said would have been "0%-33%"

    Now, about the table itself - I'm making a wild guess here, but either Muti is basically leiing in his first post, or this isn't the only table involved. Muti claimed the AI would have size 7 cities when the player had size 2, and cities with all cottages would be larger than a player made 100% growth city. Even assuming 100% Deity play, this would be very difficult to believe IF that chart is a modifier of the normal human growth rate - in other words if the "60" for Deity means the AI needs 60% of the food to grow a pop. The chart would also imply that the AI on Settler-Warlord would have smaller cities than the human, and the Monarch AI grows only a tiny bit faster than the human. That has not been my experience. What I suspect is the case (and have no proof) but what would confirm Muti's original assertion that AI growth even if Warlords was MUCH faster than human growth would be if there was a value for base AI growth was say half of the human rate, and then that chart modified that value. In other words, the Settler level AI would need 160% of 50% of the food the human needs - or about the same level as the human, leading to about the same size cities. The Noble AI would need half the food, and grow quicker. The Deity would need 60% of 50% and therefore grow over three times faster than a human, not only ~80% faster.

    If this is NOT the case, then the AI can still have an advantage if they use whipping and drafting as well as a human, since they still do have a bonus. But if the bonus in the chart is the only bonus, and its relative to a human, then I don't see how Muti's initial premise could be correct (super-fast AI growth) even if his analysis (advantage of growth bonus + whip.draft) is.

    Note that instead of all of this, and AI could also benefit from much less unhealthiness. If that was taken away at higher levels, that would also allow the AI to grow in excess of the percentage advantage over the player shown in the chart.

    Thanks TheRAT - I did enjoy that SG a lot. Re: the bold text - And it's somewhat understandable that they don't see eye-to-eye, since the AI advantages Muti is mentioning simply either don't apply or don't matter to noble/prince players. Where they go wrong is to not realize they and Muti are coming from different levels of play. Heck, I play on Emperor, and I have nowhere near the understanding of whipping and drafting Muti does, simply because right now it isn't necessary for my game. That doesn't mean that I reject his argument just because it doesn't match my personal experiences though.
     
  15. Jet

    Jet No, no, please. Please.

    Joined:
    Mar 16, 2006
    Messages:
    2,365
    As a quickie, I looked at a Warlords Emperor/Epic save and saw that my size 14 city needed 72 food to grow, whereas Hatty's size 14 city needed 53 food to grow. 53 is 73% of 72, where my interpretation predicted 85% of 72. And then Napoleon's size 14 city needed 51 food. What the hell. Huh.
     
  16. IronCrown

    IronCrown Black Foe of the World

    Joined:
    Jun 21, 2007
    Messages:
    674
    Mutineer may be a strong player but he's still talking nonsense. Difficulty levels ARE balanced, Prince is like the old Prince and Monarch like old Monarch (without BetterAI). Instead of making complaints based on academic theories, he should just play the game.

    If he does find he cannot win on Deity anymore... no big deal, just move down a level.

    Some people seem to feel the need to criticize Blake because he didn't make the perfect AI. Of course he didn't - no one could do that. As long as the AI is better than that of previous Civ versions, there is no reason to be overly critical. Or is there anyone actually thinking that the BtS AI is worse than Vanilla AI?
     
  17. onedreamer

    onedreamer Dragon

    Joined:
    Oct 21, 2004
    Messages:
    6,580
    Location:
    Torino - Italia
    Could be (but I haven't noticed the AI whipping more, it whipped more than me in Vanilla, and still whips more than me in BtS, I really don't think the AI whipping needed a bost...) anyways whipping more than Vanilla is different from saying that the AI didn't whip at all as Mutineer has stated.
    Anyways for the sake of "empirism", through espionage I noticed that the AI has a 15% less costs bonus on Monarch.
     
  18. onedreamer

    onedreamer Dragon

    Joined:
    Oct 21, 2004
    Messages:
    6,580
    Location:
    Torino - Italia
    I noticed the AI is much better at war but I do think it still sucks at placing workers and I actually think it is worse at this. I have noticed more than once the AI placing a worker in a city with 2-3 pop in a plains river when it could place it in a grass forest for better growth. I didn't ask the AI to prioritize commerce, if that's what it was doing... :mischief:
     
  19. KrikkitTwo

    KrikkitTwo Immortal

    Joined:
    Apr 3, 2004
    Messages:
    12,403
    actually (from what I understand) the AI governor Will consciously limit growth as the Happiness limit is approached (that was with the pre-expansion versions of better AI) so it could have chosen the plains river because it didn't WANT to grow.
     
  20. Stile

    Stile Emperor

    Joined:
    Jan 19, 2003
    Messages:
    1,096
    Location:
    Alpharetta, GA
    That is odd. Here's how I think it happened:

    Your base food is 33 at 1 pop. AI is 28.05 (33*.85), which is then floored. Your box increases by 3 food per pop increase. AI is increased by 3*.85 which is then floored, so in effect the AI box increases by 2. This gives a 14 size city a food box of 54. I suspect the difference (51 or 53) happens due to changes in the food box being relative. If the population decreases from 14 to 13, the box takes the 54 number and subtracts 3 * .85 which when floored is then 51. Obviously if this is the case then an ai city that whips often will find their food box for a certain city size grow smaller and smaller. The AI's bonus would become greater and greater.

    Disclaimer: This is just a guess.
     

Share This Page