A Better AI.

Assert Failed

File: .\CvCityAI.cpp
Line: 5506
Expression: false
Message: infinite loop

I'll try to get a save that reproduces it.

EDIT: Just added save. Press Enter to see the infinite loop.
 
I'm guessing that the latest test build doesnt change the AI units spamming. In my latest game, the Incans and I are back and forth for top score. We do border, but share the same religion and have been at peace since Day 1.

I sent a Merchant through his land and one his border cities has 42 units in it! 42!! This is early Renn period so its HUGE pile of Longbows (17) and an equal stack of Horsemen with assorted other things thrown in. To me, that is utterly ridiculous. Not only is that probably choking the AI with cost (and production opportunities), I cant even imagine wanting to ever fight that. Some may say that is a good thing, but at some point its taking the FUN out.

Combat with this many units just becomes tedious, even with Quick Combat etc on. You still have to manage the attacks properly and select the right units so I find the need to have 50+ units to attack very unsatisfactory.

Really with this type of unit spamming, the player is utterly forced to follow suit or else be overrun when your power ranking is constantly at the bottom. So play is becoming stereo-typed with repeated play. You must spam units, more units, and yet more units. There is no alternative.

Finally, I think defensive piles like this are killing the AI's abilities to attack each other. I rarely see wars once Longbows exist. I do see Ancient and Classical Wars, but once the unit spam has kicked in, successful attacking becomes nearly impossible for the AI. Just the WW hit from taking ONE CITY requiring 50+ units is going to be insane.

Linked to that, I usually find that the Aggressive AIs are almost always on the bottom of the heap by mid-game. Toku, Monty, Nappy, etc are almost always backwards and worthless. They might come out swinging and vassalize or eliminate one opponent in Ancient, but later on they stagnate in the face of monster defenses while they struggle to keep up. And since they rarely can, they rarely ever attack again.

To me, these recent builds are moving in the slightly wrong direction. They arent simply making the AI's 'better', they are radically shifting gameplay dynamics.
 

Attachments

  • assert info.jpg
    assert info.jpg
    38 KB · Views: 130
Anything beyond 6 or 8 defenders in a city is pointless (due to collateral damage). Everything else should be used for offense or active defense (i.e. attack enemy units).
 
I'm guessing that the latest test build doesnt change the AI units spamming. In my latest game, the Incans and I are back and forth for top score. We do border, but share the same religion and have been at peace since Day 1.

I sent a Merchant through his land and one his border cities has 42 units in it! 42!! This is early Renn period so its HUGE pile of Longbows (17) and an equal stack of Horsemen with assorted other things thrown in. To me, that is utterly ridiculous. Not only is that probably choking the AI with cost (and production opportunities), I cant even imagine wanting to ever fight that. Some may say that is a good thing, but at some point its taking the FUN out.


YOu are completely correct. A stack like this should not exist unless it is getting ready to be used offensively. This is wrong. Better AI should not make the AI choke itself out, that production should go into buildings, missionaries, or this stack should be designated for offense.

That stack if sent at a neighbore should be enough to get a vassal. If it's there as Defense alone, then the AI is being stupid in another way, against the plan of better AI, V 1.0 included.
 
Some questions about what I can observe:
When mousing the AI area with Alt pressed, I can see the AI strategy information. I've seen the following at least:
- Dagger
- Production
- Cultural1
- Cultural2
- Missionary
Out of these, Dagger has been discussed extensively here, and I'm assuming the culturals refer to different methods of going for cultural victory. Missionary has been adopted by those with shrines, and looks fine. But what is Production?

Cultural represents how deeply invested an AI is on cultural victory. At cultural 1, it does not do many things different than non-cultural, other than trying to found religions more, etc. Once it gets to cultural 2, then its actively trying to build cultural buildings, spread religions, etc. Cultural 3 is full blown going all out for culture. And cultural 4 is the same but tech is turned off.

Missionary is used for an AI deciding to spread religions it owns the shrine which are not its state religion.

Production is used for leaders whose XML says they prefer production. It gives a slight weight to building production (and food) improvements over commerce improvements. Those leaders should build slightly more farms and mines and slightly less cottages.

Other code on the area has been:
- NEUTRAL
- DEFENSIVE
- OFFENSIVE
- ASSAULT
- MASSING
This seems to relate to state of war. Offensive when the AI has decided to attack, defensive when being under attack, neutral most of the time. Assault and Massing I'm not sure about - what would these mean?

Massing is preparing for war on that continent. Assault is there are cities targeted for attack on that continent.

Also, I like the new city governor. This has taken a lot of microing off my hands - I can let the build governors handle the minor cities knowing that even if they might not develop the city the way I would, they will make it useful still. One gripe about that comes to mind though: they did not care about building jails even when I had WW up the wazoo and was running the slider high on culture. Those I had to force myself. In several cases, building Jail would've been worth as much happiness (or rather reduction of unhappiness) as all the happy-buildings they could build together.

Agreed about the jails. I think Blake may already be fixing that.

-Iustus
 
A question about the BetterAI's memory within the game:

Does the BetterAI create and use historical memory such that it will be smarter if it runs continually, versus saving and reloading?

I am assuming that the BetterAI creates new memory objects to store its data and its previous decisions, and I am assuming that you cannot store some or all of these in the save file and still maintain save compatibility. If my assumptions are correct, then the BetterAI would be smarter if it runs continually for the game, and not quite as smart if you save (losing this data) and restart.

I ask because I have not seen noticeable differences with BetterAI, but this may be because I only get to play here and there when I have the time, and usually do not play more than about a half-hour at a time.

Actually, we have a few ugly hacks to keep save game compatibility to save what little information we need to save. There should be no difference between loading a save and just continuing on. It is possible that there is a bug related to this of course.

The main strategy used to combat this is to have reproducable functions that generate information based on the current state of affairs. So things like deciding to dagger is not based on a random roll, but rather on other random factors which are in the save file.

-Iustus
 
That stack if sent at a neighbore should be enough to get a vassal. If it's there as Defense alone, then the AI is being stupid in another way, against the plan of better AI, V 1.0 included.

Except for the fact that the other AIs have 10's of defenders per city as well. All it creates is an arms race IMO. Anyone who doesnt have hordes of units gets overrun but if EVERYONE has them (player included), then all its doing is slowing the game down (in research/development time).

The interface and combat system dont really seem optimized to be playing with THAT many units. So, the game should not encourage (or require!) that many to be built.

Many important things are fixed (drafting, tech/item weighting for 'power', WW, transport capacity etc etc). And the number of units they are balanced for is likely SIGNIFICANTLY less than what is required with the newer builds. That is severely skewing the game IMO (for example, who CARES about drafting 3 units/turn if it would require 30 to make a dent in the enemy attack force?..drafting would need to be changed to remain 'balanced'). Many other factors are being submerged too (Pacifism is no longer even a remotely viable Civic...the cost is astronomical etc).

People were concerned with the 'stock' AI that the military option is too easy. My feeling with this AI is that massing military is too necessary. You cant pursue any other strategy and try to play peacefully (and if you managed too, then you'd smear the AIs because it is making that HUGE investment that isnt paying off). Sure, winning by conquest is definately HARDER now, but I dont think its made the AI's 'better'...its a sledge-hammer approach that is altering overall gameplay quite a bit.
 
I have seen similar stacking effects as those reported by Joe. To begin conquering the Russians in my current game, I have had to defeat well over 50 units. And that was to take just 2 cities. That said, the AI has definitely done a better job at pillaging and picking off my unstacked defenders, so good work in those areas!
 
I started to get too many 'Asserts' to continue the game, but here is a screenshot of the Incan horde in their city. Its possible it would have eventually become an attack stack, but by this point the current military tech is starting to become Grenadiers and Cannon. And while a horde THAT big will bludgeon their way even through more advanced troops, I still dont think its an optimal or desirable strategy to pursue.
 

Attachments

  • Civ4ScreenShot0003.JPG
    Civ4ScreenShot0003.JPG
    161.2 KB · Views: 175
Well the AI civs now defend themselves well.

Builder Civs are brought down a few notches because they can never build BUILDINGS because if they don't build constant military to defend themselves they get annihilated fast. Thus building 50+ military units per city is required for builder civs.

War Civs are brought down a few notches because all their potential targets are so well defended.

If there are 3 civs, each with 50+ units per city, then how could the war civs profitably attack any other civ?

Ultimately the only really good answer is to improve the diplomacy part of the code so that 2+ civs would work together to defeat an opposing civ. Thus Monte would have to work with say Isabella to divvy up say Rangar in a mutually beneficial arrangement.

This would be a MAJOR programming task. What if Isabella agrees to attack Rangar, but gets jumped on by 2 other civs after Monte has already committed to the attack and has lost tons of units to Rangar who now can focus completely on Monte because Isabella sent no units to help Monte? Or alternatively, would Isabella be programmed to sometimes just plain out backstab Monte, agreeing to war and then making friends with Rangar? This would require code segments that update each civ-civ relationship and have the civs act according to these relationships and also according to what their "overall civ goal" is. Which means that "overall civ goals" need to be created and implemented for each civ. AI personalities would have to be customized as well, along with backstab probabilities and negotiation "toughness" etc.

This is doable, but not easy. It seems to me that a good team could pull this off in 4-6 months.

Unless the desired answer is make it so that the civs just refuse to defend themselves so that single civs can easily take them over. Which pretty much is the original solution that Firaxis came up with.

Their solution seems simple-minded and trite. Except that, for example, the idea that "AI civs should not attack civs that are too far away" has had many game changing consequences that were not anticipated. The obstacles caused by the law of unintended consequences are sometimes too expensive to overcome.

Blake and his team have taken Civ to the next level. CONGRATS and WELL DONE :)

But they have accomplished so much that the law of dimisishing returns is kicking in, and further refinements will require ever increasing amounts of work with expanded risks of unintended consequences.
 
I'm in agreement with Uncle Joe's position on the military buildup issue. I found particularly illuminating his points about the ineffectivness of drafting and the folly of Pacifism with the latest Better AI builds.

I believe that the AI needs fewer units but needs to know how to use those better. This means effective use of siege units for both attack and defense. It means building more attack-oriented units and fewer defense-oriented units. It means keeping only up-to-date units, upgrading or disbanding the rest.
 
The purpose (at least for the builder civs) of having a large military is to prevent others from taking over your civ, optimally deterring people from even attacking you in the first place.

It sounds like for peaceful AI civs that this mission has been accomplished. For AI civs desiring peace, 50 and more defending units per city seems to be successfully keeping their civs safe.

The problem is that if each civ builds effective defenses, it takes 2 (or more) civs vs 1 to have a high probability of taking over another civ, or even taking 1 or 2 cities without completely destroying their own economy. If a target civ devotes a lot of resources to military spending, in theory an attacking civ of about equal size would be unable to build a large enough army to defeat the target country. If I remember correctly, if all else is equal, attacking forces typically need to have a 2-1 or 3-1 force superiority to have a high confidience of successfully accomplishing a mission.

Old Problem: AI civs defended themselves poorly, and were too weak and easy to conquer.

Solution: Better AI, in which each civ builds enough units to defend itself from other civs.

New Problem: Attacking AI civs is too expensive from a game standpoint, and too tedious from a game playing standpoint. Furthermore, since AI civs can no longer profitably attack other AI civs 1 on 1, AI warfare basically becomes non-existant.

New Solution: ???

In my opinion this is a difficult problem.
Keep in mind that once Blake improves the offensive capabilities of the AI civs, which is what is being proposed as the next task on his plate, everyone will have to drop one or two difficulties again because the human civs will be constantly overrun by the AI warmongers.

Afterall, what is the better target civ - the AI civ with 50+ defenders per city, or the human civ with just 20 defenders per city?
 
Old Problem: AI civs defended themselves poorly, and were too weak and easy to conquer.

I don't agree about the old problem. The old problem was 1) that the AIs managed their cities poorly, 2) that they did blatantly stupid things with their units, and 3) they knew how to win only with Space Race.

Better AI has fixed 1, has reduced the amount of 2, and has added Cultural Victory to 3. Many would like to see Domination Victory be added to 3, but some have argued (I'm in this camp) that it can't happen with the current Better AI because of the skewing toward huge defensive militaries. Others have indicated that the huge militaries are impeding the other victory types (and I agree with that too).

Given the successes that Blake and the team have achieved, it's not time to throw in the towel, declaring the problem just way too hard. I believe a little tuning and some more smarts about units can/will make all the difference.
 
For comparison, I went back and played a stock 2.08 game. The AI might not be optimized properly for city site selection or for governors or for whipping/drafting, but it still plays a pretty solid game (with the same handicaps and parameters as the latest Better AI build). It expands smoothly and techs pretty well. It does leave itself open to being attacked in some cases, but minimal changes here could rectify large portions of that problem.

The observation I might make is that the code has moved much too far in the direction of preventing a human player from winning via conquest (to the exclusion of other things). The 2.08 AI is not 'bad' at all. I think with many of the refinements in the earlier Better AI builds, it would be just fine for the vast majority of players.

With those refinements, I'm not convinced that conquest would be a cakewalk even without the hordes of AI units. Each of those units takes production and upkeep. If we are running on the assumption that the AI needs 'more' because its not efficient with what it has (militarily), then expecting the AI to be 'better' just because it has more units is backwards thinking.

If its mismanaging its 30 unit military, its going to mismanage its 100 unit military too, but it will paid more than 3x the amount to get there. The human players must follow suit, so the odds against the AI havent changed a whit. Instead of the human player defeating the AI's 30 with their 20, they can defeat the AIs 100 with their 60-70. So all thats changed is that everyone has clogged up their production with a lot more units.

I guess the bottom line here is that simply having the AI building more units is not making it 'better'. In fact, in many cases it appears to be making it worse. The only way it would be 'better' is if it were to be able to build more units than a human player by somehow being more efficient (or using handicap cheats). But that holds true whether it has 30 units or 300 units. If the humans have the same ratio, then they'll hold the same advantage.

If the Better AI is going to continue down the path of simply trying to use mass number of units to make conquest difficult, would it be possible to perhaps branch the project a bit and provide the economic optimizations without the extreme military changes?

On another note, I believe that Firaxis adopted the earlier 'Better AI' changes into 2.08 because it was optimizing the routines without unduly affecting gameplay. But I cant see them including something like the latest builds because the game plays radically different. And on top of that, many of the game mechanics are being knocked out of balance. I believe a return to the simpler 'tweak' oriented approach would be good if the intention is to shoot for inclusion in a future patch or expansion.

Please note:

I'm not in any way, shape, or form trying to take away from the extreme amount of thought and effort that has gone into this project. The fact that the Better AI team is willing to go through all of this work is appreciated in the extreme. I certainly understand that the mod cant be everything to everyone. So, if my observations run counter to way the project will go, so be it...its certainly not my place to complain. What I am attempting to do is provide feedback based on what my understanding of the original project goal was....to optimize the AI without making gameplay changes. And while the 'rules' have not changed, I firmly believe that gameplay has been radically altered from a more balanced Civilization-style game to one even more focused on military action (or prevention of the same).

Thanks!
 
Two issues I found with BetterAI (07-01-08 build):
- My vassal no longer bought my excess resources. This used to be a big reason for me to keep vassals: they pay the premium price for resources, being willing to lower their own research rate. I still gifted all the resources (including oil) to the vassal, but this doesn't seem to be right.
- Build governor was building a nuclear plant. This is a big nono: there are ways to combat the unhealthiness from coal plants, but there's nothing at all that can be done about the meltdown chance of a nuclear plant. I never build them for that reason.

Other than that, I'm going to use the build governor for cities that don't have a key role in my empire from now on. That saves me a lot of time and the cities will become productive in the hands of the governor.
 
i wouldnt completly discount the AI and its improved ability to wage war. agreed most of the time its still uses its stacks poorly, and over defends. but i did recently play a game on noble difficulty in the 1/8 build for vanilla where monte did quite an admirable job of going for a domination win, he managed to wipe out 2 civs and do quite a number on a third before i even gained access to his continent. he was even razing cities left right and centre which was quite interesting.

it would have been interesting to see if he could have gone all the way had i just let him alone completely.
 
I don't think large stacks of AI units are making the game a whole lot more fun, just more tedious.
 
Here is an assert I received. It looks like it was the same as one posted earlier by Uncle Joe but just in case I thought I would post it. Just load and press enter.

By the way, I was playing multiplayer and I received an OOS. Sorry, it didn't occur to me to go back to my auto saves and stash it. :blush:

Assert Failed

File: .\CvTeam.cpp
Line: 1612
Expression: iCount >= getAtWarCount(bIgnoreMinors)
Message:

----------------------------------------------------------

View attachment Assert.CivWarlordsSave
 
I don't think large stacks of AI units are making the game a whole lot more fun, just more tedious.

And once you get used to them, it really doesnt make the game any 'harder' either. At first it catches you off-guard when you first play the build, but after a game or so, you can easily keep up the same unit spamming. The net result is not much gain for the AI in the war department IMO, but a whole lot more micromanagement for the player. Development is definately slowed across the board, but there seem to less 'guns or butter' decision to be made.

Having played a second 2.08 game where I was soundly beaten tech-wise by two AIs, I'm convinced that the 'Better AI' is not really 'better' at this point. I like the optimization of the governor and the attempts at the Cultural victory etc, but I think the military focus AND the rampant drafting or pop-rushing are actually hurting the AIs quite a bit. In the 2.08 games, I was struggling to keep up (same handicaps and difficulty). Sure, I could build a military and take out a neighbor (and I did), but that opportunity cost put me further behind the other teching AIs.

I do believe that the AIs could definately use a little defensive tweaking from the 2.08 build, but they arent THAT far off. In many cases they are trading military power for better tech/econ. To me, that is a fair trade-off. Ocassionally the gambit fails and they lose, but thems the breaks IMO. Overall, I think that is preferable to having the AIs overbuilding troops.
 
Back
Top Bottom