Better Ai? If you're 14...

City flipping after conquest encourages total annihilation even more then civ already does.
 
iAsset = "value of unit" - used for things like deciding what transport should defend in a stack.
iPower = "power of unit" - used for things like the Power Graph.

City flipping after conquest encourages total annihilation even more then civ already does.

Currently a civ's culture all disappears once it is defeated. This would also need to be changed.
You probably only need to make a few of these suggested changes, of course. :)
 
this thread started as an outcry by a maybe frustrated player, asking for BB_AI to become more intelligent.

For my short time here there have been a lot of threats out there. The most basic problem is turning Strategy into numbers.

a) Intelligent building.

The AI will build a wonder in the first city able to do so (i think). So it will build the Forbidden City (2nd Palace) sometimes right next to it's own palace because the city met the criteria to do so. And in return won't benefit from any reduced maintenance costs.

b) Unable to specialize in any sort of economical, scientific, units

Players will build a bureaucracy science city with an academia, build wall street in their holy shrined city -- the AI won't. As far as i have understood the game has no way to treat cities different from others.

This does break a lot. Same goes for the unit building / promotion process.

c) Beelining

As the scientific research of the AI is predictable, you can beeline the techs it doesn't research for trade-offs or know to focus on wonder techs (e.g. someone will focus on mathematics, but noone on Asthetics).

Changing these moves will drastically impact player strategies (e.g. no free techs from Astetics, Great library, Liberalism -> biologie) ...

d) Simulation

There was talk about letting the AI play 100 turns and compare it's result with a player playing 100 turns and marking out the 3 top mistakes the AI did and trying to improve them. We know that grows is exponential and sqeezing out every bit of hammer / food during that period will carry over ten times into the next era.


Next to evaluating coefficients like unit strength the question is if the tactics is possible to model within civ4'AI and can be broken down in numbers. Gazing at the map and 'seeing' the perfect GP farm and commerce city does not work as far as i have understood things so far.
 
Good idea about the simulation, but I think it's too much work.

I agree. For fun, though, I made a stab at it anyway. My mod has:
* no special units, no special buildings except barracks.
* half of the civs have a modded ikhanda that gives combat VI (modded to give +100% strength) and -50% military production. This is all the civs from Arabia through Holy Roman Empire.
* The other half of the civs have a modded barracks that gives +100% military production. This is all the civs from India through Zululand.
* For both sides, barracks have a cost of 10 hammers.
* All other production modifiers removed (except ones that don't effect military production). Exception: Police State (because I forgot about it).
* No Vassal States, No Culture Flips, Aggressive AI, No Espionage (probably a mistake), No Random Events, No Tribal Villages.
* "Balanced" map, standard size, 18 civs (cramped to make war important). Victories: Domination, Conquest, Time.
* AI Autoplay for 250 turns.

So one set of civs has (relatively) 4x production, and the other set has 2x strength. I was expecting the production civs to win. Unfortunately, I forgot about drafting, so the results are only meaningful until nationalism gets invented in 1570. At that point, the scores are:

1st : Strength
2nd= : 2xStrength, 1xProduction
5th : Production
6th : Strength
7th= : 4xStrength, 2xProduction
13th-16th : 4xProduction
2nd to die: Strength
1st to die : Production

I might try it again, and remove Nationalism and Police State, along with leader traits.
 
I agree. For fun, though, I made a stab at it anyway.

Interesting, but I had understood your experiment very differently. I thought you would create a setup with cities in place and units in place where one civilisation had many weak units and the other had few strong units with no way to build new units. That would create a matchup between those two forces that are being measured in the power graph.

In your setup, one set of civilisations has four times the production power while the other has twice the strength. But I doubt this will result in an ingame matchup of 4 times as many weak units as strong units. The AI unit building preferences will make it build units a certain percentage of the times that it makes a building choice (leader dependent) meaning that in principle there won't be build many more weak units than strong units, the maintenance will hurt a civilisation who wishes to raise its power by building many weak units and the overestimation of the weak units in the power graph will probably mean that the civilisations with weak units will build far too few units to get to the desired matchup.
 
Changing the power rating of units to a square of the strength won't cause the AI to build less units. It just changes the way that the AI perceives the power balance between weak and strong units. This might make the AI's with weaker units focus on building even more of these weak units to be able to somewhat compete in power with the civs with higher strength units. The AI just tries to keep up with its competition in military power.

This is an extremely important point. Imagine the FIRST AI that upgrades all his axes to macemen. Axes squared are 36, and macemen are 64. The power graph will make a huge jump, spurring ALL OTHER AI's to start building even more units. As you advance along the ages, these jumps will only increase, and I predict the AI's will pretty much stop building any but the most basic buildings, to try and keep up in the arms race.
 
I have to agree with the original post. I had great relations with every civ in a game and i was being peaceful when all of sudden every single one of them suddenly invaded after meeting another super power who had a power ratio over them. It happens A LOT and it's ridiculous. I hope the update i've heard about is going to fix a lot of this because it has seriously turned a few of us away from any modded version of civ 4.
 
This is an extremely important point. Imagine the FIRST AI that upgrades all his axes to macemen. Axes squared are 36, and macemen are 64. The power graph will make a huge jump, spurring ALL OTHER AI's to start building even more units. As you advance along the ages, these jumps will only increase, and I predict the AI's will pretty much stop building any but the most basic buildings, to try and keep up in the arms race.
As it is not things aren't that extreme....

From here:
6000 soldiers – Swordsman, Juguar Warrior, Gallic Warrior, Axeman, Dog Soldier, Phalanx, Vulture, Pikeman, Landsknecht, Longbowman, Horse Archer, Numidian Cavalry, Keslik, East Indiaman, Privateer, Guided Missle

9000 soldiers – Maceman, Samurai, Musketman, Musketeer, Janissary, Oromo Warrior
Upgrading a axe to a mace only increases the power contribution of the unit in 50% ( 3 axes = 2 maces in terms of power ), and that surely dilutes in between the contributions of other unit types, techs, buildings and pop to the power numbers.

But i definitely agree with what your saying. If the AI overestimates ( regardless of the formula or database it uses ) the real value of a newer unit in enemy hands, it will surely start spamming older units just to keep even ( what we could call the Monty syndrom ;) ) and that is a huge issue surely. OTOH if the AI underestimates the real value of the newer unit it can be disastrous for the AI as well ....
 
Interesting, but I had understood your experiment very differently. I thought you would create a setup with cities in place and units in place where one civilisation had many weak units and the other had few strong units with no way to build new units.

I'm not sure how realistic this would be, but I can see how it would be a more direct comparison.

the maintenance will hurt a civilisation who wishes to raise its power by building many weak units

Good point. I will fix this by removing military maintenance from my mod. Also, I think I need to get rid of nukes, as they benefit from production but not from strength.

the overestimation of the weak units in the power graph will probably mean that the civilisations with weak units will build far too few units to get to the desired matchup.

This is indeed what seemed to happen. Presumably, the solution is to fix the power graph so that it takes account of promotions, at least in part. Then the high production civs will churn out more units as they attempt to maintain the power ratios. Then, if I give my +100% strength Combat VI promotion a +300% power mod, the AIs will obediently generate appropriately sized armies to smash into each other.

Imagine the FIRST AI that upgrades all his axes to macemen. Axes squared are 36, and macemen are 64. The power graph will make a huge jump, spurring ALL OTHER AI's to start building even more units.

I think that's a valid strategy, provided it builds defensive units and walls/castles. For example, if a hostile AI has copper and I don't, then I might well spam archers to keep myself alive until I can get to longbows/crossbows/muskets. At later tech levels, an AI might offer to be a vassal state of the more powerful neighbour, or get into a defensive pact, or try to get protection from the AP/UN.
 
I'm not sure how realistic this would be, but I can see how it would be a more direct comparison.

Realism? I don't get it. I thought we wanted to see which group of units would win in a matchup between those AI controlled units. That would show which army is more powerful.

This is indeed what seemed to happen. Presumably, the solution is to fix the power graph so that it takes account of promotions, at least in part. Then the high production civs will churn out more units as they attempt to maintain the power ratios. Then, if I give my +100% strength Combat VI promotion a +300% power mod, the AIs will obediently generate appropriately sized armies to smash into each other.

They might create those armies after some time. I'm not completely sure as the AI's build units a certain fraction of the time and buildings in other cases. There's presumably some code to increase the odds to build units when power is relatively low, but I'm not sure whether that will fully compensate for the initial setback in power that the production civs will have after both types of civs have build a single unit. Maybe this code will only be activated when relations are bad? I just don't know.

Because I don't know how the AI will react in this case, we can't know if we'll get the desired matchup of 4 weak units versus 1 strong one. At least, I guess that was your wish with this setup.

I know there is some code that makes the AI's stop building units when a certain fraction of their income is spent on units (or something like that). So I also don't know what will happen when you remove upkeep. I guess that at least the aggressive civs (not the trait) will benefit as they'll presumably build lots of units as they have a high unitprob (probability to choose to build a unit when another building choice is made).

It's hard to get to the desired matchup of 4 weaks versus 1 strong by just giving some AI's different advantages because it depends too much on AI construction behaviour.
 
Realism? I don't get it. I thought we wanted to see which group of units would win in a matchup between those AI controlled units. That would show which army is more powerful.

Maybe realism is the wrong word. My concern is that things like plundering improvements or taking cities are useful in a normal game, but won't be useful in a game with no unit production, and this will effect the outcome. For example, the first civ to take a city may end up losing the game, as its units get chewed up trying to defend that city.
 
This last part wasn't clear to me.
So I first assumed that units are linear in power with HP.

Ie, power is HP% * (some power factor). This isn't true, but it is my first approximation.

From this, I find that a power X unit fighting a weaker power Y unit will take, on average, (Y/X)^2 damage (as percentage).

Naively, this would imply that a power X unit is (X/Y)^2 as strong as a power Y unit. It isn't true, because the damage you take reduces your power by a larger amount than merely (Y/X)^2.

How much does it reduce your power?

Well there is where I had to get half-assed about it. There is the linear decrease in power I expect from lower HP. There is also a reduced hit chance -- which scales with (1/2+HP/2). 1.32 was an attempt to create a simple HP^K power-scaling curve that approximates HP * (1/2+HP/2).

I used a spreadsheet "goal finding" algorithm (basically a binary search) to find (under some metric) that HP^1.32 was "close" to HP*(1/2+HP/2).

Then I divided the naive power curve of ^2 by ^1.32 to get ^1.5 as my power curve approximation.

However, I'll admit that probably doing a mass killing is more effective. Fight 1000 power 100 creatures and generate a distribution of resulting power X creatures killed, and graph the result as as X goes from 25 to 100 (X > 100 will be a mirror of X < 100).

I suggested a similar approach to approximating the 'power' of producing units during the war.
That is the idea. You could go and use 50% of the last K turns of production and multiply it by the best unit power multiplier that the player can put out. By using K historical turns, we get a smoothing effect (although, after a golden age, you'll overestimate a player's production ... but I'd be ok with that).
It's a bit hard to estimate the power of upgrading due to a new technology. You could calculate the power of the army when it would be fully upgraded with the new technology and multiply that value by 1.5^-t where t is the number of turns until the technology is available (as long as t<=10). Then you take a weighted average of the current power and the future power (weights 1 and 1.5^-t)
There are a few things here. First, there is the cost of upgrading -- which can be viewed much like production. We look at the nation's GDP and assign a fraction of that to upgrading, how quickly could we do it?

We presume the existing army is reasonably modern, and work out how much stronger it would be after we get the technology and spend 10% of K turns of GDP on upgrading units.

That would give the player an estimate of how much the other side's power would spike in response to getting a new technology.

However, this is being a bit ... foresightful. I sort of like the idea that the AI doesn't "know" about future technologies as much as it "should".

In the real world, there are actually two responses of countries towards strong countries:
A) Kiss their but and become friends
B) Create another group of nations that can compete with the strong country and its friends.
I would enjoy similar behaviour in civ4.
I would very much like to see B happening. Among other things, it would extend the 'sweet spot' of Civ4 gaming fun further.

If the AI seeks to form alliances that are of roughly the same order of magnitude, power-wise, as the strongest alliance it sees out there...

Then a player that is far behind would be picked up by friends wanting to catch up as well, and form 'grand alliances' to deal with the threat of the super powers (or picked up as a 'client state' of a super power).

A player that got far ahead would find that AIs that like each other would start forming a competing power block.
 
Maybe realism is the wrong word. My concern is that things like plundering improvements or taking cities are useful in a normal game, but won't be useful in a game with no unit production, and this will effect the outcome. For example, the first civ to take a city may end up losing the game, as its units get chewed up trying to defend that city.

We're trying to compare the power of units of varying strength ratings. The effects of the production power of a civilisation on its power rating are calculated separately in the power calculation. Mixing these two power rating effects in one simulation will make it harder to detect whether the separate parts of the formula are correct. In any scientific experiment, you won't change multiple variables at once as you won't know what variable caused the changes.
 
This is such a fascinating discussion going on here that I could not help myself butting in.

To bring things into perspective, the problem put forward is that of technologically backward AIs mounting feeble and often vain assaults on enemy cities with masses of weaker units.

I believe we have reached a consensus that we can better evaluate a civilization's power ( i'll call it CivPower for short) by recalculating a units power to be iPower^1.3 (or higher exponent) and factoring in the civilizations production capabilities, separating land and sea iPowers as well as some other factors.

But we also agreed that a proper CivPower calculation will only exacerbate the problem as the weak civilization will amass a greater army of weak units, ruining it's economy even more.

So what is then, the solution to the initial problem?
What would we do in the weak civilization's place?
-Cease military production and concentrate on economy and research and offer the most powerful civilizations to be their vassal
-Try to get another civilization with an adequate army to go to war with the enemy in mind
-Offer to be the vassal of a civilization who is most likely to go to war with the common enemy
-Offer the most powerful civilizations to be their vassal if they declare war on enemy (not sure if that is a valid trade)
-Defense Pacts and focus on economy/research

Unfortunately all the above proposed solutions involve diplomacy.


I'd also like to point out an additional consequence. Won't the new CivPower calculation result in technologically advanced civs fielding smaller armies against backward civs?
 
Won't the new CivPower calculation result in technologically advanced civs fielding smaller armies against backward civs?

Suppose that one civ discovers Machinery first and upgrades its army of Axemen to Macemen, so its total power is now 80% higher than its nearest rival. There are two ways the AI's decision could go:

* I have a power advantage over the hated Mongols. Let's build even more Macemen and invade.
* I don't want to invade anyone. Let's cut military production for now. We can build more troops when other civs catch up with us.

Both of those are fine decisions. Currently the AI does neither, which is somewhat feeble.
 
* I have a power advantage over the hated Mongols. Let's build even more Macemen and invade.
Actually the 'right' answer is "I have a huge power advantage over someone I hate. Let's invade now.

I'd love to see this happen more -- a civilisation gets a technological edge, does a mass-upgrade, then invades their lower tech neighbour.
 
Suppose that one civ discovers Machinery first and upgrades its army of Axemen to Macemen, so its total power is now 80% higher than its nearest rival. There are two ways the AI's decision could go:

* I have a power advantage over the hated Mongols. Let's build even more Macemen and invade.
* I don't want to invade anyone. Let's cut military production for now. We can build more troops when other civs catch up with us.

Both of those are fine decisions. Currently the AI does neither, which is somewhat feeble.

Personally I dont think the problem (currently and to code for the future) here is really with the AI that discovers Machinery. I think the problem here is with the Mongols. As people as have mentioned the Mongols likely response to this will be spam Axemen/Longbows. However the Mongols really need to look at how long it will take them to beeline to Machinery and how best they can do that, and then how then to upgrade their troops. These are difficult decisions.

If I remember rightly one of blakes better AI builds did manage to produce some very very effective warmongers who would vasselise everything in sight. However I think they suffered even more from falling behind in tech from spamming units.
 
First off, one of the things I love about this forum is that a thread which begins as a flaming bad mood rant can turn into a civilized (haha) and thoughtful discussion of how to make things better.

So, thank you to all of you! It's this kind of attitude and community which enables modding to flourish (that, and all the power Firaxis has given us!).

My other broad comment is that the mod title is Better AI, not Great AI ... it's an ongoing process, and while the AI is certainly making much better decisions in a large number of circumstances (IMO), Civ is a complex game and these decisions can add up to produce larger behavior or in game experiences which aren't intended. Finding places to tweak the actions of the AI is the easy part, tying them all together into a coherent and balanced whole is the real challenge. This is where reports from you guys playing with the new AI and the kinds of big picture discussions which comes out of it are huge, without this feedback the mod would not have made it this far and could not continue to get better in the future.

It's nice though when the thoughtful discussions start up without the initial flaming ;)

In my view, there are several components which have added up to the observed behavior:

- Once an AI decides to go to war, it will now pour a ton of resources into building units.
- Improvements to the AI's handling of its economy and production allows it to produce and afford increasingly huge numbers of units (where to the AI, afford loosely means having the science slider at 40-50%).
- As in BtS, the AI waits for sometimes 20-30 turns before actually declaring war.
- When an AI is declared upon by a much stronger power, it will now pump out units like there is no tomorrow to try to stay alive (with no regard for whether it can afford them long term ...).

The war declaration decisions are basically the same as when Blake modified them for Warlords/BtS. My impression is Blake had a rather war-monger centered approach, out of a combination of personal preference and addressing the biggest flaw with the AI at that point (the vanilla and Warlords AI was not much of a threat ...).

So, it seems to me the issue is that this series of changes intended to make the AI better in war has produced some unintended side effects, creating an AI that is too trigger happy and cannot properly weigh the threat of getting left behind in tech against the potential gains from war.

This is such a fascinating discussion going on here that I could not help myself butting in.

To bring things into perspective, the problem put forward is that of technologically backward AIs mounting feeble and often vain assaults on enemy cities with masses of weaker units.

I believe we have reached a consensus that we can better evaluate a civilization's power ( i'll call it CivPower for short) by recalculating a units power to be iPower^1.3 (or higher exponent) and factoring in the civilizations production capabilities, separating land and sea iPowers as well as some other factors.

But we also agreed that a proper CivPower calculation will only exacerbate the problem as the weak civilization will amass a greater army of weak units, ruining it's economy even more.

So what is then, the solution to the initial problem?
What would we do in the weak civilization's place?
-Cease military production and concentrate on economy and research and offer the most powerful civilizations to be their vassal
-Try to get another civilization with an adequate army to go to war with the enemy in mind
-Offer to be the vassal of a civilization who is most likely to go to war with the common enemy
-Offer the most powerful civilizations to be their vassal if they declare war on enemy (not sure if that is a valid trade)
-Defense Pacts and focus on economy/research

Unfortunately all the above proposed solutions involve diplomacy.


I'd also like to point out an additional consequence. Won't the new CivPower calculation result in technologically advanced civs fielding smaller armies against backward civs?

Yes, I think this is a pretty good summary of the power calculation discussion so far. Improving the power calculation both for units and including a stronger economy/tech component in some places will keep weak civs from starting plans to invade stronger civs. As a result, these weaker/backwards civs will (if someone else doesn't pick on them ...) put more emphasis on buildings and other infrastructure, which will help them in the long run.

The next question is what to do with civs who are in a war. One of the new features in BBAI is that an AI that is being invaded by much more powerful players will pump out units to defend itself. Aside from this new feature, relative power has no direct effect on unit production decisions (!). This is a fairly new feature, so it may be catching a wider swath of situations than it was intended too and probably needs some adjustment.

The main throttle on unit production in war is frankly how fast the AI can build them and how many it feels it can afford to have. An AI in a long, protracted war will pump out units until it can't afford any more ... if it hopes to break the back of a powerful opponent, then this is the only strategy that works. However, this is also the only strategy the AI uses now, it won't back off on unit over production if it's creaming some tiny civ or engaged in a limited war. Once the war is over, the AI can be stuck with an enormous army it doesn't really have a use for. By the time it picks another target, its army may be obsolete. So, now that we know the AI can pump out huge stacks of units when it needs to, it's time to teach it to better use the ability.

(I hope that also answers your last question, a technologically advanced civ will still pump out tons of Modern Armor to take out a stone age neighbor)

The final aspect you bring up is what a civ that's feeling threatened should do in diplomacy ... this is another important tack which I haven't had time to look into yet.

^^Do you mean the AI using more the AI_STRATEGY_DAGGER, that doesn't require a "hands full" period ?

The use of Dagger dries up by the Renaissance, it was intended as an early game rush (hence the stabbing name) mechanic when Blake first introduced it but then seemed to morph into something bigger along the way. There were a couple other war strategy flags he created which were never implemented as they were either subsumed into Dagger or he just didn't get to it.

Anyway, I've done a little on the build-up period front already, cutting it in half for powerful civs ... this could probably be expanded.
 
Back
Top Bottom