1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

1 game 4 suicides....

Discussion in 'Civ4 - Better AI' started by Still_Asleep, Jan 13, 2010.

  1. Still_Asleep

    Still_Asleep Warlord

    Joined:
    Apr 5, 2006
    Messages:
    152
    Location:
    Vienna, Austria
    For some reason, my last game was particularly full of gamebreaking mistakes by the AI. Right now I am so disappointed that I simply make a new thread and describe what happened, and why I think it happened. Game settings were: immortal, huge pangea, 18 civ, epic speed, better AI, rest standard. Here we go:

    1.) Lack of unitcounters: I started next to Montezuma and was his only neighbour. I had a bad start and lacked copper AND iron. I expected him to attack sooner or later, went for early horseback riding and built numidian cavalries (I was Hannibal). Montezuma did attack soon. He lacked horses, and his army consisted of axes, jaguars and spears, exactly (!) 1/3 of each. A little later I traded for ivory and built elephants. My army was mounted only because I was unable to build anything else. Monty didnt care at all, throwing numberless Jaguars and Axes at me, and once my Elephants were experienced the spears were no problem either.

    In the end I killed him and looked at the unit statistics: Over the course of 50 turns I had killed exactly 25 axes, 25 jaguars and 25 spears. If Monty had built 50 spears and nothing else, he would have won with ease. He didnt know how to counter at all.

    2.) Polution in the industrial era: I had enough espionage-points to gain full city sight of any city in the game, and I didnt like what I saw :( Mansa Musa, my voluntary Vassal, had a very small empire and only 3 health-ressources. When he got Assembly Line, he instantly built factories and coal plants in all his cities, without any way to counter the polution. As a result, his capitol Timbuktu went from size 17 to 8, were it finally stagnated because the food-surplus of 7 countered the 7 excess unhealthy faces. He didnt have the techs for hospitals, environmentalism, and not the ressources for grocer. He had an Aqueduct and +4 from rice and corn for health, and -10 from forge factory coal plant. He starved all his cities to death, killing his economy and ending up with less production than he previoulsy had.

    3.) SAM-infantry: While I was starting to build SS-parts, Justinian declared war on Hammurabi. They were my 2 main-rivals, the remaining superforces, and I was glad to see that they distracted each other. Took a look at the power graph, and Justinian had about 1,5 times the army of Hammurabi. But he had only a huge number of infantry, some cavalries, cannons and Airships, while Hammurabi also had fighters and bombers. And SAM-infantries :mad: Long story short: Hammurabi massed SAMs as primary defenders, and got raped in a couple of turns by normal infantry. He somehow thought that he had to build the amazing power-18 gunpowder unit to counter the power-20-25%-bonus-vs-gunpowder-units unit. In fact he lost because he had a techlead :confused:. The SAM infantry is generaly a poor unit unless you fight air without airunits, or gunships, both was not the case. But the AI thinks it should be massed, and it is an upgrade from the normal infantry. This needs a fix.

    4.) Poor build priority: I accepted Hammurabi as Vassal and helped him. Eventually I had nukes and beat Justinian pretty hard. Justinian was pumping out defenders like he should for a while. Until he discovered fission. He instantly started building nuclear power plants in all 7 remaining cities, despited the fact that

    a) he was under heavy attack
    b) all his cities had power from coalplants
    c) in difference to Mansa Musa, he had no problems with polution at all
    d) he was able to build an artillery in 2 turns in most cities, but he needed about 8 turns for useless powerplants that he simply didnt have
    e) he just acquired the tech to build bomb shelters, the only non-unit project that would have helped him

    5.) Privateers: A minor issue in this game because thankfully the AI didnt built too many ships in this pangea-game. However, 2 privateers entered my territory, both when I already had destroyers, and both directly attacked a sleeping one for no reason at all. Why build privateers vs modern ships, and why go for direct suicide? My ships werent even protecting a sea-ressource, they were simply sleeping in random border-tiles.


    I wanna finish with saying that I really like the espionage-improvements, most moves in this department seemed reasonable to me. However, the game left a bad impression altogether :sad:

    Moderator Action: Watch your language, please.
    Please read the forum rules: http://forums.civfanatics.com/showthread.php?t=422889
     
  2. scu98rkr

    scu98rkr Prince

    Joined:
    Nov 2, 2004
    Messages:
    463
    Have to say I havent seen some of these problems before namely 2 and 4. However they both look pretty easy to fix.

    2. dont build factory if amount of hammers gained is less then hammers+commerce lost from unhealthiness.

    4. If I remember rightly building a nuclear power plant after you've built a coal power plant confers no benefits at all. Not even health benefits. Surely the answer would be to build no more than one power plant per city, Im surprised this isnt in already.

    In answer to point 1.
    Its extremely unlikely you an enemy will only have 1 type of unit ie mounted. Also why would nt you build some archers to defend as well ? Would nt the archers defend better than horsemen against spears ?

    Personally I think its a good idea if the enemy build mixed stacks. The AI cant easily tell if your just about to hook up iron and launch a horde of axemen on him. And what if someone else attacks and he decides to retreat ?

    No its much to hard to program the AI to successfully analyze an opponents army and wether there is any likely hood of him linking up a new resource in the future. Best to stick to mixxed stacks.

    Part of the problem here is monty's jaguars although used by the right player they can be annoying the AI would probably be better with swordsmen. Ie a Monty swordsman = 6 +10% combat + 10% city attack = 7.2 base city attack. They probably would have stood a better chance against elephants.
     
  3. MartinHarper

    MartinHarper Warlord

    Joined:
    Feb 16, 2009
    Messages:
    132
    True. However, the AI will normally be able to produce counter-melee as quickly as the player produces melee. If the AI tries to keep its existing unit balance in line with the (potential) forces it is facing, then as soon as the enemy forces change composition, it will rapidly adjust what it produces.

    The main reason to keep some privateers around is to kill off scouting caravels. Suiciding them against destroyers is a waste of resources, though.
     
  4. Still_Asleep

    Still_Asleep Warlord

    Joined:
    Apr 5, 2006
    Messages:
    152
    Location:
    Vienna, Austria
    @2: I have seen AI-cities shrinking in the industrial era before, I just never figured out way it happened. In one game Tokugawa had only size1 cities in 1850. This time I had enough EP to take a look.

    The problem with your solution is that the unhealthiness can increase later when the AI gets access to oil, and factories by themselves arent that useful at all, they need power to really get going, adding more polution.

    Also, building water plants in cities with coal plants will reduce the polution by 2, this can be worth it, I sometimes do this myself.

    @4: Nuclear plants are simply useless in general, I think the AI should never build them, thats the safest way.

    @1: Yes I had 1 or 2 archers in the city where the initial SoD went, but most fights took place on the open field, where my numidian cavalries slaughtered unprotected axes/jaguars. Yes, Monty's unit movement sucked as well.

    I go with the above poster: In theory, the AI should try to counter what it sees, and switch if the opponents units change. Especially on attack, because on defense the AI will mass its standard defense unit (in this case archer) anyway.
     
  5. scu98rkr

    scu98rkr Prince

    Joined:
    Nov 2, 2004
    Messages:
    463
    Im not saying the AI should nt try and counter what units it says. I just think it would require a large if not huge programming effort for a potentially poor return. I also think that this calculation that would be computationally intensive and generally slow the AI down. A mixed stack is generally the strongest stack so the AI should stick to this.

    Obviously if anyone wants to program this change thats all well and good, but I would imagine jDog and glider want to go for easily programmed changes that dont slow the AI down and give good results.

    Problems 1 and 4 above could be easily fixed with minor effort now we know they exist.

    For AI warring I still think the biggest improvement, with possibly the least processing strain, would be to stop the AI suiciding stacks.

    I believe both jDog and glider have been asking for someone to come up with a formula which can calculate the odds of a whole stack attack winning. As far as I am aware no one has managed to do this yet.

    Because the AI cant correctly calculate the chances of a stack winning an attack it often wastes unit rather than using them to pillage/annoy the opponent.
     
  6. TheMeInTeam

    TheMeInTeam Top Logic

    Joined:
    Jan 26, 2008
    Messages:
    25,318
    1) Spears suck pretty bad vs archers, which you also had available. What he really needed was siege + spears.

    2) This has been a consistent problem for the AI, and possibly one of the reasons base BTS has them avoid AL for a long time, to their detriment since infantry are a huge upgrade, and so is the production. It's a shame really.

    3) Yes, SAM spam vs anything but air or heavy gunship use is a poor strategy.

    4) I agree here, but bear in mind the vast majority of the need for AI bonuses stems from a combination of tech choices and build priority. BetterAI has been working on it from what I can tell (see the opening 100 turns threads), but it's not easy stuff.

    5) Flagrant weakness in the AI, but you might as well tie it to build priority too ---> why was it even making these at that point?
    Is it even possible without cheating (aka playing "lookahead at RNG outcomes")? I mean, without using up exhorbitant computing power as the first battle's possible outcomes are tallied, then the possible outcomes of possible following battles (bearing in mind that in many cases the amount of damage will dictate the next defender chosen on top of this). You can probably have 10's of thousands if not more (probably a lot more) possible outcomes in a stack fight w/o cheating to know the outcome using the seed. And half the forum probably knows how I feel about hidden AI cheats by now :/.

    The AI should definitely use mixed stacks, but I'd like to see it consistently use siege in comparable #'s that human invader would. Yes, that can be countered too, but it is by far the most devastating overall. 25 25 25 w/o siege is ridiculous. It should be close to 1/2 siege...1/3 at minimum (diminishing returns in stacks that huge, but not rapidly diminishing).
     
  7. Fuyu

    Fuyu Emperor

    Joined:
    Nov 5, 2009
    Messages:
    1,225
    Location:
    Austria
    ad 1.) If your enemy lacks both copper and iron, you'd expet him to defend with archers. Against archers, both axes and jaguars are a valid choice. If the enemy has hourses, you expect chariots and horse archers too, against those you build spears.
    True, the AI didn't account for the UU, and probably didn't adapt his biulding prioriteies after seeing all you have are numidian cavalries, but I honestly don't think that's much of AI fail. That's just a very good UU in that situation - seriously, what do you use to attack a stack of archers and numidian cavalries if you don't have horses?

    3.) just sounds awful, that should really get fixed if SAM gets built more often than normal infantry.

    Ad 2. and 4,) Same problem maybe.
    First suspect: BUILDINGFOCUS_PRODUCTION 1
    The other: The AI simply ignores :yuck: ? ...
    When there's a production building, it is built, no matter what, or so it would seem. No matter how much something else should be done or how heavy the downsides are (pollution).
    On the pollution front, I don't know if the AI even understands what it is getting itself into. Either it doesn't factor in the sideeffects at all or it just misses the important parts: Factory and Coal Plant give only +1 :yuck: from buildings, and that's from the factory. The important parts would be the +2 :yuck: from coal and +2 :yuck: from oil that you get with a factory, and +4 from coal plant wit haccess to coal even though the description says +2 :confused: .... for a +9 :yuck: total effect (+1 :yuck: from buildings +4 :yuck: from Power +4 :yuck: from Bonuses).
    Factories & Coal Plant should only be considered with a huge heath buffer or with Environmentalism, neither is common at the moment of discovering assembly line though.

    For a moment I thought maybe this is fixed in the newest SVN revision, but since I'm using the very latest 0.83g and the exact same thing is happening to Korea, I can be sure it isn't.

    Log is there, saves will probably require my merge or BBAI 0.83g as a mod, with mod folder renamed to Better BULL AI.

    Screenshots:
    #1 is Korea's captial, only a shadow of its former self, stagnant at -6 :food: from :yuck:
    #2: the city to the northeast of said capital is building a coal plant because apparently -6 :yuck: is not enough. Description says +2, truth is +4. A bug?
    #3: What a wide and important ocean this is. Of course, we have to build a drydock here, even if it's just to get more unhealtiness (The city on the west side already has one, the other one is building it)
     

    Attached Files:

  8. r_rolo1

    r_rolo1 King of myself

    Joined:
    May 19, 2006
    Messages:
    13,818
    Location:
    Lisbon, Portugal
    Beware of how to fix 1 ,because that has a strong potential to make the AI worse ... making a decent decision about what to build to counter a enemy implies knowing atleast in rough outlines what the enemy has and the resources it has in hand. Given that the AI has no memory for what it saw in the previous turns and that you can buy resources, there is no way of solving either of those two issues without either some AI hacking or some serious improvement in terms of memory and planning of the part of the AI. Because if you simply make the AI responsive to what it sees it will be extremely easy to induce the Ai to make units to counter what it sees while you make your real army to smash those counters ( say, show HA to the AI to induce spear prod while making axes/xbows in the backround )

    I guess that the current AI build is basically a standart recipe that works reasonably well in most scenarios with some room to adapt to change of unit types by the part of the oponent. It is far from perfect, but it is not that bad considering that the AI has no memory and no central planning worth of that name.
     
  9. Yakk

    Yakk Cheftan

    Joined:
    Mar 6, 2006
    Messages:
    1,288
    Part of 1 is a problem with mono-culture attack stacks in general.

    While a mono-culture attack stack can be bothered by a mono-culture defence stack, against a mixed-culture defence stack mono-culture usually wins.

    Imagine a basic RPS game with Horse, Melee and Archers.

    Imagine the enemy has a mix of 1/3 anti-horse, 1/3 anti-melee, 1/3 anti-archer. And you both have equal sized stacks.

    If you attack with a 1/3 mix of each, for the most part your horse is defended against by their anti-horse, your melee by their anti-melee, and your archers by their anti-archers.

    And each attack fights against a full health opponent.

    Now, try attacking the above with a full stack of horse.

    The first 1/3 of your horse fights anti-horse at full health.

    The next 1/3 of your horse either fights wounded (previously attacked) anti-horse, or non-anti-horse at full health.

    Now, against the enemy counter-attack, your stack of horse may do worse. But during the attack itself, you have a hope of overwealming the anti-horse. And in Civ4, anti-X units tend not to be so overwealmingly good that they can beat two of the unit in a row (barring significant terrain advantages) reliably. Even when you measure in hammers.

    The AI could, in theory, detect your inability to build anything except horses, and counter with pure spearmen. But even if they have 50% spearmen, going 100% horse isn't a silly idea.
     
  10. MadmanAtW

    MadmanAtW Knight

    Joined:
    Apr 13, 2008
    Messages:
    579
    Location:
    San Leandro, CA
    Yeah, as Yakk points out, until we get the AI some memory, I would say that a nice mixed stack is actually a pretty good move.

    Possibly a workable idea, though I know in my games I will sometimes build the factory before the next health providing building on the grounds that it is hammer conservative to do so, if I can finish the hospital or whatever before starvation would cost me a pop point.

    As for the stack attack odds... yes, in theory it can be done, without lookaheads. You'd need to take the sum over a ridiculously large branching tree of possible outcomes at each step, but in theory it's possible. I work in statistics and my brain has just latched onto this problem as preferable to think about than work, so maybe I'll think of a way to make it marginally manageable but I doubt I'll think of anything that hasn't already been tried. :p
     
  11. r_rolo1

    r_rolo1 King of myself

    Joined:
    May 19, 2006
    Messages:
    13,818
    Location:
    Lisbon, Portugal
    That until land colateral damage enter in play, that branches things out even more and flanking damage, that makes things even worse and air collateral damage , and nukes ... to be honest , I don't see this being computationally feasible ( unless you are willing to wait ... ) above 10-15 units in each side
     
  12. MadmanAtW

    MadmanAtW Knight

    Joined:
    Apr 13, 2008
    Messages:
    579
    Location:
    San Leandro, CA
    Yeah, actually, once I started thinking about it I headed over to the Tips forum to ask for more details about how collateral damage works... :p The way to solve the problem is to figure out how much stuff you can throw out. A rough answer is almost as good as a solid answer, here.
     
  13. Cowardly Maggot

    Cowardly Maggot Chieftain

    Joined:
    Oct 17, 2009
    Messages:
    45
    Location:
    Denmark
    Surely some "rules of thumb" could save the AI from some of its most stupid suicide attacks. I've definitely seen them send stacks which are smaller and composed of weaker units into the blender. We don't need a complete "solved" answer, we need some common sense rules (with randomizers).

    You could, for example, consider if the attacker would destroy many defenders if the battle was divided up nicely into a series of duels.

    You could determine how much of the attacking stack it would take (on average) to defeat each single defender, as if there were only the one unit defending. Then sum up all the needed attacking units. If it there aren't anywhere near enough attackers to pull that off, then don't do it.

    Collateral damage would have to be modeled separately.

    Interestingly enough, while the AI loves to smash itself into dust when on the offensive, which is a total waste of time, they are cowards of the defensive. Very often I just march my army, heavy with siege, right up to their city and burn it down around their army, which itself contained a lot of siege, and which could have chased me off their land. If there is a time for the AI to commit suicide, it is when the enemy enters their land with an army designed for city assault.
     
  14. Still_Asleep

    Still_Asleep Warlord

    Joined:
    Apr 5, 2006
    Messages:
    152
    Location:
    Vienna, Austria
    @2: I think the 4 :yuck: from Coal plants is a bug, it has just been accepted because it is a welcome challenge to fight polution and not just spam factories/plants as nobrainer. But having a total of 7:yuck: from factory + coalplant like description says, and 5:yuck: with waterplant ( = no added polution from waterplant) would still be a lot, and slightly easier to handle for the AI.

    In general the AI should plan its polution tough. The production boost is essential, the AI should build factories and plants, but only after it took some preventive steps. Try to get medicine and/or refrigeration faster, build hospitals and supermarkets, switch to environtalism if needed BEFORE building up heavy polution. 6:health: from environtalism +added bonus from public transport is the easiest fix because it isnt dependent on any ressource, and should have priority.
     
  15. Ninja2

    Ninja2 Great Engineer

    Joined:
    Nov 17, 2005
    Messages:
    1,142
    Location:
    Denmarkia
    Quoted for Truth. I would love to see more open-field battles.
     
  16. TheMeInTeam

    TheMeInTeam Top Logic

    Joined:
    Jan 26, 2008
    Messages:
    25,318
    Open field with siege initiative. Make it almost impossible for the human :p.

    Actually I wish the AI would do this so that its bonuses on all levels could be dropped.
     
  17. Fuyu

    Fuyu Emperor

    Joined:
    Nov 5, 2009
    Messages:
    1,225
    Location:
    Austria
    Stack attacks / suicides: We currently have combat odds, we'd need "stack odds".
    Who would win if I attack, who would win if I get attacked, what would survive in both cases? And the AI would need means to evaluate the results, and weight them against each other and against the alternative to wait a turn while both sides get reinforcements - and against the alternative to turn around and run.
    But let's face it, "stack odds" would be a new concept and we'd need to give that to the player too, not just to the AI. Most importantly though, I doubt it's all that easy to implement. What I am sure about though is that "brancking out" as in iterate over all possible outcomes is NOT going to be doable - that just eats too much CPU time.
    But any "rule of thumb" is bound to fail. Actually I think there is a rule of thumb at play anyway. I guess we'd need to run some simulations - I think that's what was meant with "lookahead"?

    :yuck: : It would be best to disallow the AI from building anything that would cause immediate unhappiness or unhealthiness. For that, the AI needs to know the actual unhappiness and unhealthiness effects and the current health and happy status of the city - and it would need to check against it. Also Factories probably need a lower AI value, and power plants need a higher one - even more importantly the values for plants when the city already has power should be close to zero. (Coal Plant info needs to be corrected to say +4 :yuck: ) Higher priority for Medicine might be a good idea too. The basic idea though would be to keep the AI from building a factory and most importantly a coal plant before it gets of fission or plastics. At least I am always waiting for that ..

    SAM Infantry: I just reached that time in my game -_-;
    Actually that one is easy. The AI doesn't build a lot of them but it will ALWAYS upgrade units when it has the chance to do so. And since Rocketery has high AI priority, that's where you end up.
    Fix is a simple gameplay change: Let the SAM be an upgrade only for the Grenadier - problem solved, I bet (will include that in my BBAI/BUG merge as a temporary fix unless someone complains, until jdog finds a way to keep the AI from upgrading to something weaker)
     
  18. Still_Asleep

    Still_Asleep Warlord

    Joined:
    Apr 5, 2006
    Messages:
    152
    Location:
    Vienna, Austria
    I dont have anything to back my statement up, but I think the AI currently builds quite a few SAMs. Also, there are situation where they are decent, although rare and far in between.
     
  19. scu98rkr

    scu98rkr Prince

    Joined:
    Nov 2, 2004
    Messages:
    463
    "But let's face it, "stack odds" would be a new concept and we'd need to give that to the player too, not just to the AI. "

    We would nt need to give stack odds to the human we already have them its called experience.

    By accessing the chances of the available siege units, plus the best couple of attackers, a good human player can generally predict whether a stack will take a city or not.

    This is what the AI needs not an exact prediction of what the chances are of a stack will winning. In fact it would be very easy to calculate exact stack odds. It would just be very computationally demanding and if every AI had call this routine every time it considered attacking a city it would seriously slow down the AI.

    As people say we need some general rules to estimate whether a stack will win, however this kind of abstract reasoning is much better suited to the human brain than it is the step by step calculation of a computer.

    Ok so what would we generally look for when deciding to go ahead with a stack attack ???
    I know we have a routine for selecting the best attack/best defender but does it give any other data ? Ie worst attacker/defender ?

    1. Are we attacking a city? If y goto 2 if n goto 100
    2. Do we have seige ? if y goto 3. if not goto 10

    3. Assuming we attack with all Siege units calculate the minimum damage (ie just collateral damage) we could do to the best defender.
    Average (the chances of BEST attacker against defender and maybe a random unit against another unit) * ratio of attackers to defenders * If this number is above "50%" attack.

    You also want some rule like if ratio of attackers is greater than defender but % are high enough to attack to leave a few units to defend.

    Or something like this. I have a feeling I remember someone setting something like this out before.

    I think the idea to calculate the minimum collateral damage to the best defender might be a good one. I think what we want to fix first the AI stalling and bombarding a city when it really should attack straight away.

    You could possibly add something like this

    If think if might even be an idea to add in something like if number of turns to bombard >10 retreat.

    * 0.5+(1-(1/number of turns to bombard defenses to 0%+1))
    So if 10 turns to bombard the above = 1.4
     
  20. r_rolo1

    r_rolo1 King of myself

    Joined:
    May 19, 2006
    Messages:
    13,818
    Location:
    Lisbon, Portugal
    The issue with that solution ( that is not that bad, regardless of being in skeleton state ) is that the biggest use for stack attack odds ( and why not a stack defense odd counter as well? In terms of stacks, odds of sucessful attack + odds of sucessful defense != 1 necessarily ) is far before the time where the stack is facing the city, when the would-be stack is leaving home ( the human "is this enough?" ). Otherwise, if the AI sends a insuficient stack, realizes that it can't take the city just when it gets there and proceeds to retreat, it will actually make the AI fight worse than it does today , because the more difcult thing to do in a war is a sucessful retreat ( this also applies in civ IV: it means running away 1 tile/turn against a foe that has the potential to use the huge active defense bonuses to reduce it to a shadow of what it was ( at best )
     

Share This Page