FfH2 AI Issues Thread

Joined
Jan 7, 2009
Messages
1,922
I looked for an AI Issues Thread but didn't see one. The forum search doesn't have a way (that I could find) to limit searching to thread titles, and was rejecting "AI" as a search term because it is too short, so I could have missed it. If there is already a thread for this, someone please point it out.

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

Patch R:

The Illians started 2 spaces from Letum Frigus, but 900 turns into the game (marathon) they still had not claimed the Aggressive trait. I know the Amurites didn't beat them there because they started on the other side of the map and I was playing them.
 

Grey Fox

Master of Points
Joined
Dec 19, 2001
Messages
8,726
Location
Sweden
The AI can't even get the Aggressive trait from it at this time.

Code:
def canTriggerUniqueFeatureLetumFrigus(argsList):
	kTriggeredData = argsList[0]
	iPlayer = kTriggeredData.ePlayer
	pPlayer = gc.getPlayer(iPlayer)
	[B]if not pPlayer.isHuman():[/B]
		[B]return [I]False[/I][/B]
	if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_ILLIANS'):
		return False
	iImp = gc.getInfoTypeForString('IMPROVEMENT_LETUM_FRIGUS')
	iCount = 0
	for i in range(CyMap().getNumAreas()):
		iCount += CyMap().getArea(i).getNumImprovements(iImp)
	if iCount == 0:
		return False
	return True
 

WarKirby

Arty person
Joined
Jul 13, 2006
Messages
5,317
Location
Glasgow, Scotland
FF seems to have improved AI in regards to these things. I know the AI in that can explore dungeons and lairs, at least.
 

WarKirby

Arty person
Joined
Jul 13, 2006
Messages
5,317
Location
Glasgow, Scotland
Code:
def canTriggerUniqueFeatureLetumFrigus(argsList):
	kTriggeredData = argsList[0]
	iPlayer = kTriggeredData.ePlayer
	pPlayer = gc.getPlayer(iPlayer)
	if not pPlayer.isHuman():
		return False
	if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_ILLIANS'):
		return False
	iImp = gc.getInfoTypeForString('IMPROVEMENT_LETUM_FRIGUS')
	iCount = 0
	[B][U]for i in range(CyMap().getNumAreas()):
		iCount += CyMap().getArea(i).getNumImprovements(iImp)
	if iCount == 0:
		return False[/U][/B]
	return True


What is this part ?

It's making an additional check for something there. The number of improvements of some sort on the map ?
 

Grey Fox

Master of Points
Joined
Dec 19, 2001
Messages
8,726
Location
Sweden
I'm not sure why it does that. It seems to be counting how many letum frigus there are on the entire map. Why it does this I do not know.
 

WarKirby

Arty person
Joined
Jul 13, 2006
Messages
5,317
Location
Glasgow, Scotland
So it's checking that Letum Frigus exists before returning true?

Maybe to stop people putting the letum frigus script in some other tile, or somesuch ?
 

Monkeyfinger

Deity
Joined
Oct 24, 2006
Messages
2,002
That "AI decalres before turn 75" behavior happens even on settler. I played a good chunk of a settler game to try out a graphics mod, and... yeah. Guess what.
 
Joined
Jan 7, 2009
Messages
1,922
The AI tries to keep defenders in important squares (goody huts, lairs, cities), but it doesn't make active decisions regarding which unit(s) should stay in the square to defend. Instead, a unit won't leave unless there are enough other defenders left in the square to satisfy whatever threshold of defenders the AI wants to satisfy. As a result the AI will often leave valuable assets defended by inadequate defenders. I've seen a scout move into a city and the two warriors that were there before both leave. Here's a screenshot I just took of a bear defending a city by itself:


For goody huts and lairs this is not a major problem. Cities have the potential to shift power balance dramatically. The AI should be trying to defend them at least reasonably well. Most animals don't receive defensive bonuses, and are vulnerable to many recon units, and so do not make good city defenders. Also, the idea of a HN animal defending a city is fairly out-of-flavor, at least imo.

In order to prevent this the AI needs to make better decisions about when to move units out of a valuable square, including discounting the presence of units that would not be suitable to defend the square.
 

Lone Wolf

Deity
Joined
Dec 4, 2006
Messages
9,908
Well, barbarian cities aren't a good example - don't they start empty?
 

Psycho_Ivan

Warlord
Joined
Oct 6, 2008
Messages
218
Well, barbarian cities aren't a good example - don't they start empty?

Nope, AI cities start with the two most preferable city defenders the barbarians can create. Expect to see Warriors early on, and Axeman and Archers in the latter stages.
 
Joined
Jan 7, 2009
Messages
1,922
I have this nice game, about turn 300 normal speed and the only religion founded so far is Empyrean, by me. Either the AI beelines a religion, or it will never found it because it researches mysticism on turn 500 or something?

I saw this in another thread and I thought I'd add it here, with some of my own screenshots as illustration:



This is just past 1/3 of the way through the game. At some point he conquered the Elohim, and now he has 10 cities. Although he has researched Horseback Riding it's not doing him much good. He hasn't researched Cartography, so he's stuck in a Despotism. Each of his cities is defended by a single warrior, and he has no other military units (although he does have quite a few idle workers). I strongly suspect he's at 0% science as a result of massive city support costs, and so getting Cartography would probably take him most of the rest of the game. He's got lots of farms, but because he hasn't researched Mysticism he has no way to make sages to help get to Cartography faster. He has essentially defeated himself.

The AI needs to understand that Despotism is fatal beyond three, or maybe four cities. Once it has that many cities it should either wait until another civic is available before continuing a conquest spree or else start torching cities instead of keeping them.
 

Lone Wolf

Deity
Joined
Dec 4, 2006
Messages
9,908
The AI should understand the importance of Carthography and Education. It seems that the AI's who neglect it are just pathetic when it comes to research, and those who do not are OK:



Note that, at turn 275, Sandalphon, Arendel, and Capria are just horrible (I've recently gifted them Education and Carthography so that they would have some chance), Valledia is pretty much the same (althrough maybe she'd do better with the Amurite lock on tech trading taken out of the XML), Faeryl and Alexis is OK, Cardith and Keelyn are strong technologically, and Cassiel (who, BTW, obliterated Tebryn) is running away with the game.

(Auric Ulvin is also in the game, dunno about his tech status).

And I looked in the Worldbuilder at the stating locations of the lag-behind AI's - nothing too horrible.

So, the AI's really should understand the importance of Cartography and Education. Perhaps these techs should be given many weights of different kinds?
 

Attachments

  • Civ4ScreenShot0020.JPG
    Civ4ScreenShot0020.JPG
    207.5 KB · Views: 1,238

Thunder_Gr

Emperor
Joined
Dec 8, 2008
Messages
1,362
Location
Universe
I don't know about the AI, but I rarely give much importance to cartography. I prioritise other techs first.
 

Lone Wolf

Deity
Joined
Dec 4, 2006
Messages
9,908
Carthography means City States means ability to REX without doing much harm to your economy.
 
Joined
Apr 26, 2008
Messages
355
I've also seen the lack of cartography as a problem, especially with tansuke and sheelba. In at least half of my games, one of them conquers a ton of land and rises to the top of the chart. Then, they spend the rest of the game in relative stasis because they refuse to research cartography to jump start their research.
 

JonathanStrange

PrinceWithA1000Enemies
Joined
Dec 25, 2005
Messages
1,306
Location
TThe Dreaming
Yet I've seen Cartography researched by AI civilizations (I play at the Immortal/Deity level) - but I suspect there are circumstances which come up where the AI neglects or is unable to research a relatively basic tech that it normally uses.

For example, an AI successfully conquers a wide-spread empire and the maintenance cost stifles its research - I've had that happen to me myself and learned the hard way back in the day - and then either doesn't see Cartography as the solution to its dilemma or is prioritizing some other goal despite the slow-down.

Yet if it had been less successful, it might have researched Cartography and been ready to switch to City States civic if needed. Sigh...the AI civilizations sometimes won't even trade for Cartography even if it would help...

There are times when some basic tech (like Education) is completely ignored and I have to conclude that at some point, the AI's algorithm calculated another tech was a bit more important, and then another was, and another, so that Education was neglected entirely. No cottage for you...
 

WarKirby

Arty person
Joined
Jul 13, 2006
Messages
5,317
Location
Glasgow, Scotland
looks like the AI needs a check, for if it's maintenance is too high vs income, to switch to City States. And to research towards cartography if it can't.
 

notque

Artificially Intelligent
Joined
Nov 13, 2005
Messages
1,672
I just redid the ai in my mod minor leaders mod.

The major changes are the AI cannot build scouts (improved the AI by a ton), if the ai has more than 4 cities, it researches code of laws next.

And then a complicated per leader tech decision making process with rands thrown in so it gets changed up.

Right now, I'm most impressed with the Elohim, I have them soft beeline honor, and righteous law and it's working wonders.

There is no beelining though really. There are multiple paths with degrees of importance, and also allowances for the AI to pick a trait to make sure that resources are picked up.

Although I wish I could even check against those. I still need to find a way to get the AI to stop getting horse techs without horses, and some other weirdness.

So far, from the changes the AI is significantly more competitive, and as I went through, the ones I made changes for were clobbering the ones I hadn't gotten to yet.

You can check it out and see. Every Leader has some changes. The leaders with their own major tech paths so far are Thessalonica/Elohim, Teithra/Bannor, Baron Duin Halfmorn/Doviello, Casin Loveless/Lanun, Captain Blackheart/Lanun, MordMorgan/Lanun, Tya/Amurites, and Lorelei/Amurites.

Although everyone has somewhat improved Ai on at least a minor scale.

I'm also having good success with the DynScriptAI mod.

The most major open concern right now is SeaAI, and Snarkos option mod has it, but I don't know enough C++ to hack it into mine yet. Or at least, I've been unsuccessful so far.
 
Top Bottom