A Better AI.

Thank you for doing all this work.

You're welcome. Just glad I could help. I'm a CS student, so while I find attempting to tackle a project of my own still a bit daunting, doing a detailed bugreport is no problem. I know how irritating it is when someone makes an unsubstantiated* claim like "your code doesn't work" when they're using it in a situation that introduces a lot of different failure points. I'm happy to continue to try and hunt down this type of thing in the future if it would be helpful.

In all honestly, the first half of that work was just me trying to track down for sure whether or not it was betterAI or whether I'd just screwed up in trying to incorporate the different mods.

(* I'm in no way suggesting that Uncle Joe's statement was unsubstantiated. The fact that something worked with 12-9 and not 12-12 certainly warrants asking "what changed?".)
 
Regarding sea invasions you should also check overseas war declaration routine. I still never seen an AI declaring an overseas was on it's own.

Keep up the good work.
 
Playing a noble game on continents using the 12-12 build and vanilla. Shared my continent with Mansa & Washington. We're all the same religion. I made sure to spam both of them with loads of missionaries. On one turn Mansa (friendly) wants to swap world maps which I agree to since I'm trying for a diplo win. The very next turn, now pleased, the backstabbing so and so declares war on me!

The question is how did he change from friendly to pleased and then attack me in the space of one turn. We also had OB with each other. Auto saves from the two turns attached.
 
Some problem with the AI war behaviour with 12-12 build. In my recent game. I'm on a continent to left, hashepsut in middle, alexander to right. hashepsut attacked alex and made him a vassal. when they war ended most of her armies are on right side. So I jumped her with cannons and grenadiers, while she only had upto knights. Most her cities only has 3 defenders, I was able to take em down with stacks of 4 cannons and 2 grenadiers. Cut story short, one of my stack moved to the wall of GIZA. Moused over, I see at least 6 knights, 10 maceman, lots of longbow, and other units I can't see cause list too long. I thought that was the end of my stack. End turn, Hashey didn't attack, So I bombarded the city wall. Next turn, Hashey throw 15-20 war chariots at me, I didn't even know she had war chariots there, only managed to kill 1 cannon and reduced others to less than 1/3 hp. But her knights and maceman never bothered to move at all, it would be so easy to wipe my stack out, instead next turn I was able to upgrade my remaining units. My save game is too large to fit here, can't attach it.



The screen shot I attached, is the screen after hashey suicided her war chariots.
 

Attachments

  • Civ4ScreenShot0000.JPG
    Civ4ScreenShot0000.JPG
    196.9 KB · Views: 113
Regarding sea invasions you should also check overseas war declaration routine. I still never seen an AI declaring an overseas was on it's own.

Say what? AIs from other continents declare on me all the time, sometimes in apparent cooperation with vassals. Or did you mean something else?
 
Another scenario where AI seems don't know how to use all its forces to attack. with that kind of force the town of angle can be easily conquered. Yet when I hit end turn, all hatshepsut did was suicide a few trubuchet at me thats it. catapult, maceman and knights never moved an inch. Next turn I reinforced the town with 1 more grenadier + 1 cannon, Hatshe throw a few more trebuchet + a pike man thats it. It allows me to rush in 3 more grenadier after that turn. If hatshe had used knights + maceman or even all her catapults in first turn, Angle is long gone for me. Makes me wonder why they don't use all the forces to attack.

Screen shot was taking right after first round of attack.
 

Attachments

  • Civ4ScreenShot0003.JPG
    Civ4ScreenShot0003.JPG
    266.9 KB · Views: 116
I'm still back on page 13... but I have an idea for how to adjust difficult levels (which may have been known already).

One trait that marks an experienced vs novice player is how good they are at choosing the optimal long-term / short-term strategies. For a novice player, they make a *lot* of sub-optimal decisions which makes it harder for them.

Examples:

1. City Placement - On lower difficulty levels, the AI should be more likely to pick a less optimal city location. On the top level difficulty, the AI should always pick the best location. But on lesser difficulty ratings, either the score values need to be more "noisy" (random fluctuations added), or the AI needs to pick the 2nd or 3rd best location, or the AI should maybe randomly shoot off 1-2 tiles away from where it planned on settling.

Additional idea: Maybe the different styles of AI should favor/score terrain differently.

2. Promotions - At lower difficulty levels, add more noise into the choices (making it more likely to pick sub-optimal upgrades).

3. Tile Improvements, City Governor settings, Which tiles get worked, What units get created, etc.

Basically, the only "perfect" AI game would be at the top difficulty level. At lower levels, the AI should make random mistakes (and lots of them at Settler) in order to give the human a chance to capitalize on them. It might even provide a natural feel to the difficulty levels where you need to make fewer wrong decisions as you go up the scale.

...

Note: I'm playing my 2nd game with the BetterAI (Dec 12 2006) and finding it very rough going on Warlord difficulty (18 civs, huge, fractal, marathon, raging barbs, w/ random sea/climate) playing as Tokugawa. Downright impossible to get any of the first 3 religions and the latter ones are also pretty much sewn up as well. About the only wonder that I can get reliably is the Great Wall (which is a huge help with raging barbarians).

Note #2: In my game from last weekend (same settings), Wang Kon's civilization got steamrolled by the barbarians. Which made life very difficult for the other 3 civilizations on the same continent as me. At one point, the barbs had half a dozen cities with over 10 population.
 
Say what? AIs from other continents declare on me all the time, sometimes in apparent cooperation with vassals. Or did you mean something else?

I'm glad you have it but i don't or don't remember this.
Maybe you're playing a top level or agressive ai?

I usually play noble without custom options and standard/8 civs
 
A big thanks to Blake and the betterAI team who improved the game so much !

I just finished my first game with betterAI. I won on Monarch, standard size, continents, 11 opponents, permanent alliances on, other options off.

I had few troubles winning but the random leader I got was Caesar and so I made my first Pretorian Rush and it helped a lot to vassalize / destroy everybody. The build was the 12/07 one (or was it 12/09 ?). The game was very pleasant.

The only real complain I have is the AI didn't seem to defend its cities with enough units. I know it's very hard to stop the pretorians, but here there were generally too few defenders (2 or 3 on monarch is clearly not enough)

To make a quick recap of my first impressions (I need to play again to be sure) :

*) Main Positives :

- More aggression AI vs AI than in 2.08. I'd like even more inter AI alliances and vassalization but it's ok. An AI destroyed another one on the other continent I didn't know (I got a message), and Brennus vassalized Monty there too.
- Much better use of the ressources
- Good places are chosen for the AI cities
- AI is much better in science
- AI seems to whip and draft much more, which is a very good thing

*) Main Negatives :

- Too few defenders in the AI cities (generally between 2 and 3)
- Maybe not enough emphasis on production from AI compared to science (not sure, but I was very often #1 in prod)
- Some strange civic choices were made for a long time (hereditary rule, caste system...) but maybe there was a good reason I don't know (I doubt...)
- I captured several workers in war time, maybe there's a bug somewhere on this part
- AI Stacks are sometimes easily destroyed in the battlefield
- I chose Emancipation but then some AI civs didn't discover Democracy before a long long time (Carthage), so I guess they were heavily penalized by my Emancipation happiness penalty... (not sure they were, didn't use the world builder to see, sorry)

*) The things I would like to see :

- AI should probably try more to make pacts, peaceful vassals or alliances, with other AIs or with human. I was much stronger, but had they allied they could have resisted better.
- AI should really aim for victory and react when they see another one is winning... If we see an AI winning, we surely try everything we can to at least delay the victory, so the AI should do the same, whoever is winning (nukes, massive invasion, etc.)
- Big naval invasions
- AI who really aims for diplomatic victory
- AI who really aims for conquest / domination victory (I know, they would need a plan and it's terribly hard to code, but these are my dreams :D )

I will make another monarch game with the latest build. I will probably have much more trouble because my random leader won't be from Rome this time ;)

Anyway, keep up the good work, the game is really great now !

Still no answer ? Anyway, I played a new game with the 12/12 build this time, on monarch / pangea / epic / 11 opponents / permanent alliances on / other options off. Great game, but I lost this time. They gave me Toku, I was attacked frequently. The thing I failed is making friends. Everybody was in free religion, it was hard to find an ally.

About the AI now (12/12 build) :

Good things :
- Aim for cultural victory very well. I had to attack Catherine she would have won this way
- Early stack attacks (with relatively small stacks) and early wars are good

Bad things :
- The stack attacks are flawed, it attacks with a low percentage, sometimes with the wrong unit in the stack
- The AI stacks are not protected enough, maybe it should go back to a city to heal
- The AI doesn't build medic for its stacks (idea : use a great general to do a super medic, a low value unit with medic 1+2+3)
- Not enough late wars when everybody is in free religion... Even Gengis Khan prepared a huge stack and then didn't attack.
Ideas : *) change the free religion diplo modifier (small penalty for 'you're a f** atheist' or 'I don't believe in your god' between athiest and religious civs)
*) just make the AI more agressive, especially the warmongers
*) create diplo penalties inter AI by making them ask for help /tech between AI and not just to the human player
- Not enough defenders in the AI cities
- The worker AI to flee in wartime still doesn't work well (low priority problem)

Anyway, thanks for all tour work, Blake and Iustus !

Klokwerk
 
I have been following this project since the 2.08 patch was released, and I love the work that that you guys are doing. Very early on I noted that one of the side effects of the improved AI's economic management was the drying up of AI gold available for trades. Not just the lump sum gold, but the amount of gold available on for per turn trades have dried up, too.

The economic/trade model in cIV is sparse enough already. Unless you are pursuing a Diplomatic Victory, there is very little reason to develop anything akin to a "trade relationship" with an AI nation. Eventually, it will be easier to take the resources they have than to try and trade for them. With the stingier AI even less "interested" in your excess resources, it seems there is even more incentive to build up your own economy by usurping theirs.

I don't know what specific coding changes have been made, and I realize that milking the AI of excess cash to fuel deficit research is/was the foundation of many a player's strategy, but the forced "economic isolation" has made the game even more of an army-building game than a civilization-building game.

I also realized that I cannot remember the AI ever initiating a gpt trade. Why not? The obvious answer is that they aren't coded to do so, which gets to my real question: why aren't they coded to do so? We know the AI is aware of what resources are availabel for trade, because they will initiate resource><resource trades. Can't they be coded to examine gpt><resource trades as well? Ideally they should even consider the benfits of decreasing their research % in order to generate gpt to acquire an extra resource (Would having a given resource be of enough benefit to enough of my cities to counter the lost beakers?). Even more ideally, the AI should be able to analyze the cost of the added benefit to the other party (Would having a given resource be of enough benefit to enough of my cities to counter the lost beakers AND the boost I am giving my trade partner)

The AI changes have improved the AI's performance: of that there can be no doubt. But the changes have also heightened the flaws in an already shaky aspect of the game: international trade. As this is the only positively cooperative and interactive side of the game, can anything be done to improve the AI's awareness and management of the global economy?
 
1. City Placement - On lower difficulty levels, the AI should be more likely to pick a less optimal city location.

I'd like to point out that this is a double-edged sword. Especially at lower difficulty levels, military conquest is one of the easier victories to go for. However, new players often are poor judges of when to keep/raze a city. Making the AI place its cities badly means that a player conquering them also gets bad cities, which doesn't really help him in the long run. I understand that, in theory, at least his own cities would be better placed and he'd have a mild economic benefit compared to any other civ because of that, but still.

I think your idea is very sound though. If we're trying to make AI that plays like human, it'd be great if they scale from 'careless' to 'micromanaging everything perfectly'. To that end, things like how they value stacks of units during wartime (overvaluing their own at lower difficulties, etc), their trade generosity (being willing to accept trades that aren't in their best interest at lower difficulties) make sense too.

By lower difficulties, I mean under Noble. I'd still like to see the AI get smart enough to the point that it actually has a chance in a fair game.

The AI changes have improved the AI's performance: of that there can be no doubt. But the changes have also heightened the flaws in an already shaky aspect of the game: international trade. As this is the only positively cooperative and interactive side of the game, can anything be done to improve the AI's awareness and management of the global economy?

As a follow up to that - do the AIs currently attempt to deliberately pursue positive/negative diplomatic relations with specific civs? A typical 'algorithm' many humans use:
1) Maintain relatively neutral relations until Medieval period, once most religions get founded and many 'favorite civics' are possible.
2) Determine what religion would be most advantageous to run.
3) Examine power graph. Chose geographically remote, different-terrain, high-power opponent - forge strong alliance there. Deliberately spread chosen religion there if not already present, etc.
4) Similarly, establish friendly relations with nearby, moderate-power 'buffer states'.
5) Bully nearby weak civs prior to their eventual conquest
6) For the most part, maintain neutrality about the rest of the world. When this fails, that's what the civ in #3 is for.
There's plenty of articles discussing alternatives, like 'triangle diplomacy' to form an unshakable group of three civs, and such, which all work equally well for what I'm trying to discuss - planning out diplomatic strategy.

To my knowledge, the AI never deliberately sets out to make a friend of someone (or an enemy). They never deliberately do things like steps 3 and 4. They just let the chips fall where they may with civics, religion, built-in modifiers like warmongerrespect (ghandi vs alexander, etc). Am I wrong? If not, you'd have to put in all of this underlying structure before you could really hope to deal with the AI's diplomacy, trade, and global economy stuff.
 
Any news on the next update? Not to make pressure... just out of curiosity.

We are testing a few pretty big fixes, I am shooting for a new update soon, in the next few days.

Expect more wonder building, sea combat, overall better production, better city specialization, governor improvements, and more!

-Iustus
 
I recently played some Warlord/Monarch games with the newest build and discovered that Great Wall/Stonehenge are sometimes built by the AI before training a settler. I noticed that because of the GW-graphic sourounding just the outline of the capital. Checking in Worldbuilder than showed that also Stonehenge is built before a settler. Regarding the AI-Bonuses, this could be justified by beiing industrious/ having stone, but that was not the case. Seems inefficient, especially for GW which is quite expensive. One cause for that could be they lost their first settler to Barbarians and didn't switch production to another one. But with all their Archers that is unlikely.
Maybe this happened before the patch, too, but i can't remember seeing the GW just surrounding the capital.
 
Expect more wonder building, sea combat, overall better production, better city specialization, governor improvements, and more!

Better AI production would be great. Its very odd to be out-producing the 'Rival Best' by a factor of over 3 to 1 even though techs, GNP, Land Area etc are all comparable.

Are the AIs over pop-rushing or something? Their cities almost always seem considerably smaller than mine (8-9 as opposed to 15-18). Having read the article on pop-rushing since the 1.61 bug fix makes me feel that is not as blanket beneficial as it once seemed. And if the AIs are using it quite a bit, it will definately be hurting their production in the long run

The same holds true for forests. If the AI is mass slaughtering all of its trees in the short term for the production boosts, its definately going to run into long term shortages of easy production and health. Wholesale deforestation was also tweaked in an early patch so again, it isnt quite the no-brainer that it once was.
 
Basically, the only "perfect" AI game would be at the top difficulty level. At lower levels, the AI should make random mistakes (and lots of them at Settler) in order to give the human a chance to capitalize on them. It might even provide a natural feel to the difficulty levels where you need to make fewer wrong decisions as you go up the scale.

I would take the other side of this . . . I'd like to see a difficulty level (Noble or Prince) where the AI makes full use of its abilities without "cheating". Higher difficulty levels with advantages for the computer players would still be there for those who want serious challenges, of course. That's the way the AI is implemented in Galactic Civilizations 2, and I rather like it--a serious challenge, but it's still possible to beat the AI, and it actually feels like you're in a fair competition, instead of searching around for dirty tricks of your own to match their unfair advantages.
 
Better AI production would be great. Its very odd to be out-producing the 'Rival Best' by a factor of over 3 to 1 even though techs, GNP, Land Area etc are all comparable.

Are the AIs over pop-rushing or something? Their cities almost always seem considerably smaller than mine (8-9 as opposed to 15-18).

You must be the only person playing the mod who is able to consistently get larger cities than the AI. I often end up with AI capitals hitting size 20 by early AD.

Is the mod even loaded :confused:?
 
Hum. I replayed my game without better AI, the results are drastically different. Hatshepsut managed to retake 2 of the cities I conquered with her massive left over army from alexander campaign. This time she throw everything at me, knights, mace, trebuchet..... Both cities fall in 1 turn. While with the 12-12 better Ai build, she was incapable to take any city back, because 2/3 of her army just sit there do nothing with Better AI build. Is there any bugs in 12-12 build preventing hatshe to use her better units to attack or what?
 
Bear in mind that the old tactical AI are basically like lemmings - they'll ALWAYS attack even massively against the odds... a big part of the tactical changes is overcoming these suicidal tendencies and ensuring the AI DOESN'T attack when doing so is suicide. So if you swap the mod out at a point where the AI should attack - yeah they're gonna attack, if you swap the mod out a point where the AI shouldn't attack - they're gonna attack ;).

Why don't you post a save? It's a lot more useful than a screenshot in this case.
 
You must be the only person playing the mod who is able to consistently get larger cities than the AI.

I dont know. I know I'm not the only one to notice the production drop off though:

posted by klokwerk under 'the bad':

- Maybe not enough emphasis on production from AI compared to science (not sure, but I was very often #1 in prod)

Is the mod even loaded

Most definately. I check it with the Alt key. I also notice the other changes as they implemented, but it still seem that AIs are almost always being well outproduced (ie, in terms of Productivity). Perhaps they are pop-rushing lots of things giving them similar true 'output', but their capacity for war or space race are quite reduced.
 
Back
Top Bottom