AI estimating the likelihood of war

MartinHarper

Warlord
Joined
Feb 16, 2009
Messages
132
I believe that the AI would benefit from estimating the chance that another civ will declare war on it. This could help it in a number of places:
  • Deciding which cities need the most defenders.
  • Deciding how much military to build.
  • Deciding whether workers on border tiles need escorts.
  • Deciding whether to declare war, and upon whom.
  • Deciding whether to become a vassal or enter a defence pact.

I believe that, where available, the AI should take into account the opposing leader's DoW% when deciding this. Obviously this is not possible for human players. Also, it is not appropriate when "Random Personalities" has been selected in the game options. In these cases, the AI can start out with an estimate based on the average DoW% at each attitude. A sophisticated AI could modify that estimate as the game goes on. It could also increase the estimated chance of war when a civ starts declaring "We have enough on our hands right now" in peacetime, and to decrease it when a civ is already at war with another civ.

I like this because it makes the AI behave more like a smart human. For example, the AI will start treating Gandhi differently to Montezuma, and place more units on its borders with Montezuma. It is also more likely to launch a pre-emptive strike on Montezuma, rather than attack Gandhi only to be back-stabbed a few turns later.

The philosophy behind the coding of the AI in Civ IV seems to be of making the AI having the same amount of good faith against all civs, modulated obviously by the diplo considerations. Making the AI to read the XML to get their "bellicosity" is clearly making the AI to assume that not all the leaders are created equal and I'm not sure that all the players would welcome that change in philosophy ...

Treating all civ's equally is the simplest possible option. I think they went for that because the AI had bigger issues that needed to be addressed, rather than because of a design philosophy. Players who don't like the AI knowing about leader personalities can play with Random Personalities.
 
Regardless of the acidents that led to it's implementation, the fact is that making the AI put equal faith in all civs before diplo concerns is a code philosophy ;) In a part of the text you chose to not quote I expressed that I would definitely like the idea of the AI checking the personalities of the other AI in play ( it would be a way of simulating something close of the memory humans get empirically by playing a lot of games of the various LH behavious: monty being a loony that spams units and DOWs with little concerns about the actual odds, Gandhi beiing a peacenik that loves religions and culture, and so on .... ) . My problem is how the rest of the players would feel about a AI that knows this, and, as you quoted, I'm not so sure that the majority would like this.... also, making this would open the door to do similar coding to other parts of the AI ( wonderhogging, religion pursuits, ... just to name a few ) and that is definitely a good chunk of lifetime that would be taken from the coders :D
 
Bad idea all arounf. DOn't do it.

Seriously, that's just a bad way to try to imitate an human smartness. Reading XML file with comportment likelihood is FAR away from what would actually help the AI.

Don't forget : the AI already have tool to understand iothers AI, called peace weight andwarmonger respect. They are here for a reason, and trying to overdo it feel just wrong. What next, an AI that reload ?
 
Could you elaborate a bit Haze? I understand that you don't like the idea, but you haven't really explained why.

Reading XML file with comportment likelihood is FAR away from what would actually help the AI.

If the AI places more troops and walls/castles in cities bordering warmongers, and fewer in cities bordering peaceniks, that will help the AI keep its territory when the warmonger tries to invade.
It's also realistic. France built the Maginot line on the border with Germany, because France believed that the Germans were more likely to invade them than other neighbouring countries.
 
If the AI places more troops and walls/castles in cities bordering warmongers, and fewer in cities bordering peaceniks, that will help the AI keep its territory when the warmonger tries to invade.
It's also realistic. France built the Maginot line on the border with Germany, because France believed that the Germans were more likely to invade them than other neighbouring countries.


Do you remember that the Maginot line were one of the worst military failure of all time ? ANd that we are here not to make the AI more realistic, but better (while trying to keep some basic idea to make sure the game don't became a wallbanger)


First, it's not realistic at all to go as far as looking to the precise comportement. A,d, as I already said, the AI already know what AI is a warmonger and what is not ; should I recall that both peaceweight and warmonger respect are here for exactly that ? ANd they have the distinct advantage to give informations that the player have easily, because knowing that Ragnar is a warmonger require at most a look at civilopedia, when things like %DOW are neither readily available nor required, and to use them correctly you need more and more refinements.

For me, the %DOW is particulary a big wallbanger, because it's obviously an internal value not meant to be used by another AI. It may be a consequence of working in software devlopment, but I tend to quickly cringe in pain when people want to use internal values.

And then, you could try to make an AI that begin to try to move unit on frontier against human and warmonger. I can totally see how to exploit that. Especially since you don't check what is really happening. The good way to do that, if even you want to do that, would be to make it look at military figure, spying upon army near the border, but NOT something as obnoxious than %DOW of the AI.

Last thing,the other AI will also be improved AI. That mean that we want them to declare war if their is an opportunity to gain a lot, and in general be less predictible. So using the fact that they are predictible to make more "intelligent" decision is ... Well, no a good solution. With good AI, it would be stupid not to guard at least correctly a frontier, just in case. And also not to put too much troop in one region, just in case.
 
Thanks for the response.

I don't see that DoW% is any more internal than any of the other values in the same XML file, such as peaceweight and war-respect. Forum users often discuss which AIs will back-stab on Friendly, which is an application of DoW%. What makes DoW% internal, but iBasePeaceWeight and iWarmongerRespect external?

Especially since you don't check what is really happening. The good way to do that, if even you want to do that, would be to make it look at military figure, spying upon army near the border.

Certainly DoW%, as now, should only be a small part of the calculation. Happily, the AI already looks at the number of enemy units near the border, in this line in CvCityAI::AI_cityThreat:

Code:
iValue += 2 * GET_PLAYER(getOwnerINLINE()).AI_getPlotDanger(plot(), 3, false);

This could also be improved. The number "3" should probably vary based on the average unit speed, the presence or absence of roads, and how close the city is to the nearest cultural border.

I like your idea of looking at the total military power of the neighbouring civ. The code doesn't do that at all at the moment. This may help civs respond better one one of their neighbours is building up a huge military, and the other is not.
 
First, it's not realistic at all to go as far as looking to the precise comportement. A,d, as I already said, the AI already know what AI is a warmonger and what is not ; should I recall that both peaceweight and warmonger respect are here for exactly that ? ANd they have the distinct advantage to give informations that the player have easily, because knowing that Ragnar is a warmonger require at most a look at civilopedia, when things like %DOW are neither readily available nor required, and to use them correctly you need more and more refinements.
First of all , a clarification... the peaceweight and the warmonger respect are there to stop things that are completely diferent of what you think. The warmonger respect is there simply to avoid that agressive leaders enter in a spiral of self destruction: A makes bad face to B , B dows them, both spam troops, make peace after inconclusive war, hold grudges, start warring again ... and the cicle repeats until Mansa or Gandhi smash their longbows with tanks ;) . The peaceweight is there for a similar reason: it was made to make less likely the AI of making pairs of agressive leaderheads fed techwise by a peacenik leaderhead. None of this functions has anything to do with what Martinharper is sugesting and , to say the truth, probably they would still be needed if his proposal was implemented.
And then, you could try to make an AI that begin to try to move unit on frontier against human and warmonger. I can totally see how to exploit that. Especially since you don't check what is really happening. The good way to do that, if even you want to do that, would be to make it look at military figure, spying upon army near the border, but NOT something as obnoxious than %DOW of the AI.
Like Martin said after this, that is included. In fact this discussion is only a spin-off of a bigger question that I inadvertedly put in other thread: "How to make the AI aware of what civ is a bigger threat to them?", a question that needs to be awnsered to make a better code for the "we fear your enemies" vassaling denial. What he probably meant to ask in the first place was if we should also make the AI consider the %DOW XML values of every leaderhead to make that decision.... mainly because the %DOW values can't be taken in a void: a Monty reduced to a city will most likely be a smaller threat than a Gandhi with a continent wide empire, and this in spite of the well know disparity between this two leaders in terms of belicocity ... and obviously I have more fear of a furious Sitting Bull than of a pleased Monty if both are in a diferent continent and have roughly the same power ( Sitting Bull has the same prob of starting a overseas war than a war in the same continent )

About this being exploitable ... well, every rule is exploitable ;) I can even put the question in oposite terms : aren't we exploiting the AI coding that gives equal faith to all leaders ? :p
 
Top Bottom