Roland -
Glad we're in agreement on most of the valuations, it definitely does make it seem like we're on the right track.
Finding the power of allies is a little harder than enemies since Civ4 doesn't have explicit offensive alliance relationships (other than permanent/vassal). We sort of have to use the old "the enemy of my enemy is my friend" approach. Between AIs you'll almost never get war triangles, where civs A, B, and C are all at war with each other, since the AI avoids opening second fronts like the plague.
What if the AI was losing relative power during a war which would make nationhood seem attractive but it had just bought an ally into the war. At that point, the combined strength would make nationhood uninteresting, not needed to win the war or stop the enemy. However, in the present plans the AI doesn't consider this war ally.
Or what if the AI was the one who was bought into a stable war between 2 parties or who backstabbed one party in a stable war between 2 parties where each party was double its power. In the present plans, the AI would immediately consider nationhood as it's enemy is twice as strong as it is itself, but it is really not needed due to its strong ally. Together, they're 50% stronger than the single enemy.
I do think the power of an ally should be valued less than your own power. It's clear that an ally won't protect your cities well and it also won't capture cities for your civilisation.
The AI does consider war allies when backstabbing someone. It looks at the balance of power already in the war and decides whether it's a good opportunity to join the fray. So the idea that an ally should count for something is not unheard of.
The losing cities and power part is something the AI doesn't keep track of in a usable fashion currently, so that was one of the reasons I focused on power ratios. The AI tracks how many cities it has lost in total over the whole course of the game, and then also tracks it and its enemy's "war success" for each individual war. War success is something like:
4*(enemy units killed while attacking) + 3*(enemy units killed while defending) + 25*(enemy cities captured)
It seems that war success is something that holds the necessary values. But if I understand you correctly, the AI only maintains this combined value and not the individual values of killed units and captured cities. So it would be tougher to teach it to also maintain those values.
I think the combined value 'war success' is good enough to help the AI see it needs extra troops quickly and thus needs drafting abilities.
So, our enemy's war success variable basically counts how much we have lost in the war. ...
Using war success or creating some new version of it certainly could be done, but it's inherently reactive ... the power ratio is something that can cause the AI to switch to nationhood immediately when attacked, while counting cities or power lost in the war means the AI is already doing badly. Switching civics in the middle of a losing war can be a costly proposition unless you're Spiritual.
In my mind, there are 2 good reasons to go to nationhood:
1) you're going to fight or are fighting in a tough war
2) you're losing the war and you need troops now or you'll lose your entire civilisation
1 is covered and 2 might be covered by the power ratio consideration.
I also felt that the power ratio covered most of the scenarios where the AI would be losing cities or power from the war already, although I definitely take your point that a human player can capture important cities while having equal or even lower power than their opponent. As a hack, a human player's power could be over estimated to account for their inherently superior tactics.
In my latest game, there was a situation where 2 AI-led civilisations were actually balanced in power and still quickly after declaring war, one of them captured several (5 or so) cities of the other. There was a very good reason for this. One of the AI's had just transported its stack of doom and entire fleet over to another continent to fight in a war against a weak opponent (it immediately signed peace with that enemy). It was doing well in that oversees war, but it didn't have any spare troops in its homeland and the enemy stacks could do what they wanted with little resistance. I'm quite sure that an immediate switch to nationhood after losing 1 or 2 cities could have made a difference.
What if max(War Success enemy/War Success us , 1) was used as a multiplier of the enemy power (in the power ratio valuation of drafting)? In that case, an enemy with relatively lots of war success would be valued as having a greater power. This would help the AI recognize capable human generals or lucky AI's who caught them in a bad tactical sitiuation. Of course some damage would have already been done but drafting might stem the tide.
It would even be ok, if the War Success from earlier engagements with the same opponent would be considered.
I'm personally not a fan of isHuman type of modifiers because not all humans behave the same. Some human players are quite bad at war and complain that capturing cities is far too hard and that they need 5 times the AI troops to capture cities. And there are also players who are quite allergic to isHuman modifiers in the AI.
Reconsideration: the quotient of war success is a bit too variable. If one party loses 2 units and the other 1, then the quotient is suddenly 2 which is too influential as a multiplier of power. If you add a constant to both the numerator and denominator, then the variability is a lot less. Say a constant of 25-50 or so (25 is 6-8 units or 1 city, right).