View Full Version : AI Changes/To-Do list


Seven05
Jul 19, 2006, 11:14 AM
Ok, here's a list of reported, known and fixed AI (computer controlled opponent) issues and the to-do list of AI changes for the next version. I'll keep this first post updated so please review it before posting.

1.94 AI Issues:

(Fixed for 1.95) Improve spawn rate of Barbarians on non-standard world sizes
(Fixed for 1.95) Tweak/Clean-up Unit AIs
(Fixed for 1.95) Remove combat strength from non-combat units (sappers, merchants)
(Fixed for 1.95) AI makes poor unit production choices, excessive siege units
AI makes poor choices for unit actions, chariots defending/attacking cities
Babylonia too demanding (see post #2 for test update)
Phoenicia too spiteful if help isn't offered (see post #2 for test update)


AI To-Do list (1.95 or later):

Tweak aggression as needed
Adjust AI personalities for "memory" effects & delays
Enhance diplomacy options including making unreasonable demands
*Possibly* Define better regional animosty/friendship
Improve AI use of merchant vessles/trade barges
Improve AI understanding of unit bonuses & penalties
Improve AI unit build priorities (smart variety, not so random)
Improve AI response to siege (attack the attackers, reinforce)
Improve AI handling of increased maintenance
Improve AI ability to form war alliances
Improve Barbarian AI (attack/pillage choice and target choice)


Feel free to post any issues, observations or requests for the AI here. I can't promise that we'll be able to fix everything but we can try.

Seven05
Jul 19, 2006, 11:16 AM
Since I have the #2 post I'll use it for test versions. The CIV4LeaderHeadInfos.xml files goes in your Civ4 Installation\Mods\The Ancient Mediterranean\Assets\XML\Civilizations folder. If you're comfortable with copyign and pasting files it should be pretty easy :)

The following test version requires TAM 1.94 (or 1.941), the changes from 1.94 are:

Reduced chance & frequency of Babylonian tribute demands
Reduced penalty for refusing to help some civs
Tech trading slightly easier
Increased some positive bonuses for trading

Updated July 24th

AndreasS
Jul 19, 2006, 11:48 AM
Please change the Great person graphics for 1.94. Its really ruining the ancient feel of the MOD to see those modern engineers walking arround.... ;)

I'm telling you again, because Thamis meant it was an easy change, but you just forget to do it all the time......

Another small estetical fix I recommend, is the Sid's tips for the tech. Polytheism. It still says this tech founds Hinduism.......

Seven05
Jul 19, 2006, 12:33 PM
While I agree, I'm working with the AI primarily. So if you have any issues or suggestions/request related to AI behavior then I can help :)

sapon
Jul 19, 2006, 06:02 PM
While I agree, I'm working with the AI primarily. So if you have any issues or suggestions/request related to AI behavior then I can help :)

Seven05, first off you've done an outstanding job improving TAM and thank you. Is there a way to improve the AI's cooperation in launching wars? I would love to see the Carthaginians and Viriato launch an attack on Rome simultaniously etc.

Seven05
Jul 19, 2006, 07:25 PM
Well thanks, but you won't see any of my efforts until 1.94 is released, hopefully the "new" AI won't make me any enemies here :)

I can add that to the list. There is some cooperation built-in already, most commonly seen in the form of "dog pile" war plans by the AI. The AI also does have code in place to actively request other AI civs to join them through normal diplomacy AI. With my recent changes to aggression levels, AI relationships and diplomacy you should see some wars with multiple AI civs involved, sometimes on both sides which can be a lot of fun to watch. Unfortunately the stock code has a lot of random variables that make war allies fairly rare.

Anyway, yeah, I'll add it to the list and we'll see how violent things get when 1.94 is out and I have some more feedback. The fun bit for me is the change to the way the Aggressive AI game option works, now it applies a negative modifier to everybody (among other things), not just human players, so you get some intense wars with that enabled.

baptiste
Jul 20, 2006, 10:08 AM
Here is a list of some remarks/suggestions not included in Seven05 report :
- cultural victory made hard with Ius Civic available very late. Civil Laws could be sooner (after Republic ?) without imbalancing the game.
- roman legionary commando capacity is too powerful once road building is discovered. Well used by human player, they are imo much too powerful.
- free religion with holy empire sounds strange and gives few interest to theocracy. Either you could make civs hostile to this vote or put this option out of the votes.
- few buildings allow artist, unless you are under patronage, it is very difficult to have artists. Some wonders and garden could allow to make artist specialists.
- few spiritual civs. teuta/viriato/boudicca are quite weak with their capacities, they could could become also spiritual without imbalancing the game
- trade barges and merchant vessels are too powerful imo, they should give less gold. AI do not uses them properly.
- too few late wonders. colossus could come with seafaring. riches of kroisos could come with commerce.
- plutocracy is by far under aristocracy. plutocracy could become medium upkeep and aristocracy could become medium or high upkeep.

These comments are done after 19 games in 1.9x under prince/monarch difficulty, all with marathon speed (3 domination/conquest victories with rome/carthage, 11 cultural with many different leaders, other are time victories). I don't make any historical comment, but mainly game balance suggestions. I didn't tested emperor but i guess it becomes very hard to have any kind of victory unless you play Rome for domination/conquest victory.

I think it would be very useful to have Large maps, the huge ones creating barbs problems and the other ones being quite small.

Seven05
Jul 20, 2006, 11:21 AM
Kind of the wrong thread, I'm only working on the AI... well, primarily working on the AI. So I added the part about the AI use of trade barges & merchant vessels but the rest is beyond the scope of this thread. Try adding non-AI reports & suggestions to the new 1.94 thread or making a new thread for specific topics so they don't get burried.

schlappi
Jul 20, 2006, 03:39 PM
I have had funny experience with AI unit movement in my last game. I was playing Makedonian, the Civ i was at war with were the Lydians. He declared war on me, but due to my superior fleet Kroisos was unable to have his units cross the sea. What happened now? The AI decided to move his (quite big) army across eastwards and north around the black sea, and since this area is unhabited and quite woody it took quite a while...
In the meantime i gathered a strike force to capture and raze some of his cities, until finally his lands lay in ruin, but he was not willing to make peace (due to his assaultforce still moving)... even though our population's war-wearyness was rising and rising :(

In general, AI attacks are laughable, even if the opposing forces exceed mine by far, the many small and a few huge stacks, leaving enough time for my units to recover after an assault are poorly coordinated. It's like i choose a target and move via right-click to the other edge of the map.

Maybe it is possible to force the AI to use waypoints, where the units gather again after drifting apart due to different unit speed and/or starting points, barbarians, cultural borders expanding etc etc... and reconsider the best possible and reasonable way...

Same goes for mountain passes, i just need to place a single strong unit into a pass and can be sure the AI will take the long way around.

Not sure if such a thing can be modified, it would certainly rock though ;)

darkedone02
Jul 20, 2006, 11:01 PM
can you please add this in your list of to-dos? make some custom music for every dipomancy screen and also custom music to listen to for all ages. I will be gladly happy if you do. BTW, your mod is awesome and i like it.

thamis
Jul 21, 2006, 04:54 AM
can you please add this in your list of to-dos? make some custom music for every dipomancy screen and also custom music to listen to for all ages. I will be gladly happy if you do. BTW, your mod is awesome and i like it.

I've always wanted to look into it. I've got lots of great music, but it's copyrighted material. I'll look into Creative Commons to see whether there's any open license music there.

Seven05
Jul 21, 2006, 10:55 AM
Quick test update added to post #2.

baptiste
Jul 23, 2006, 10:38 AM
About terrirorial development.

On huge maps (*) the AI is extending territory very fast, really killing economy. This way, they fall far behind in tech. They are frequently building one (or more) very far city, making things even worse. Unless you play in Emperor+ games, it is very easy to have a terrific tech advance and crush them later.

If something could be done to help AI as to develop more smartly, it would be nice.


(*) especially fertile crescent and huge med map, not the greece one because of barbs

thamis
Jul 23, 2006, 11:23 AM
I've been playing a test game with Agamemnon right now, on Prince level. I always made sure I had good relations with Rome, and they were pleased with me for most of the time. Nonetheless they refused to trade techs (ever) and were very reluctant to open borders with me.

In general it's good that there aren't many open borders, but on the other hand they are required for trade barges... Your friends should be willing to open them.

On the other hand I also noticed that the AI will give you open borders when you are fighting a war against a mutual enemy. Good.

On tech trading: It's good that it's been reduced, but I think it may have been reduced a bit too much.

On trade relations: I noticed that whenever you trade with anybody, ALL other AI says "you've been trading with our worst enemy." This is weird, as they are normally simply "cautious" towards the supposed "worst enemy" that I traded with. I think they shouldn't demand break of relations unless they are "annoyed" with that civ.

Religion still has a pretty strong function, I saw a -4 for religion once. Too much IMHO. -3 maximum.

baptiste
Jul 23, 2006, 03:38 PM
On the other hand I also noticed that the AI will give you open borders when you are fighting a war against a mutual enemy. Good.
You can have +5/+10 relations without acceptance to open border.

I just had a funny example, Agammemnon just offered open borders since we are fighting the same ennemy, even with terrific relations between us (+2 struggle +4 trade -2 religion -3 declared war -1 war ally against him -15 razed cities = -15 total). I made peace with him 10 turns ago, captured 3 cities including capitol, razed many others and he offers open borders :confused:

It seems that a common foe is the main (only ?) motivation for open borders.

Seven05
Jul 24, 2006, 12:49 AM
Open borders and techs are tied to your relation, the word part not the numerical value (not specifically). Previously everybody would offer/accept open borders while cautious, now most will only offer/accept when pleased. They also enjoy cancelling open borders at the most inopportune time, such as when you have two merchant vessels one tile from the nice big coastal city.

After reading the code in the SDK I see that the AI places a value on open borders, much like they do with techs, bonuses and cities. What happens now is that they will frequently decide that what they gain from open borders is not enough and either cancel them or refuse to offer them. They also are less likely to agree to open borders if they are experiencing financial trouble unless they're at war with a common enemy. Since they don't fully grasp a lot of the changes made to upkeep (they still "expect" vanilla civ4 rules & upkeep) the AI players in TAM are in a perpetual state of financial trouble.

I think the best solution in this case is not to make open borders easier to get & maintain but to allow the merchant vessles & trade barges to enter rival territory (must also set strength to zero or they can't enter cities). And then on top of this making the AI use them which may be possible without too much work. The current state of difficult open borders has an outstanding effect on exploration, contact with other civs and war with disconnected civs so I'd rather not change that.

Some of the work on personailities is also in place so historical trading empires will be more open to trade agreements (Carthage & Phoenicia are good examples). However, all AI is less likely to trade technologys because of the way Civ4 AI values techs, this is also a side effect of the financial issue since one of the most significant side effects is the reduced research rate for the AI when they're broke. Basically they have research at 40-60% if they're doing OK, much lower if they aren't, at that rate they will value techs more making them less likely to offer them and pay more cash in exchange for them.

Vineyards and Caravan houses also appear to be broken, they don't add the gold (I'm assuming that's supposed to be +gold, not +commerce). They AI also doesn't seem to build many of those buildings at all despite inflated flavor settings to encourage it. This leads me to think that the trade buildings are sub-par when compared to other build options. So the production costs are too high or the bonuses are too low otherwise the AI would be building them like crazy when they needed money.

On a related note, this is going to be a very busy week for me so I'll be around the forums a bit, since I can do that at work, but I won't have much time for testing and uploading test updates for you guys to try out until the weekend. Of course now that I said that I'll probably have somethign to upload tomorrow :)

thamis
Jul 24, 2006, 07:23 AM
Gifts... In my game I have been supplying a few of my friends with resources for milennia now (free resources, not money paid back by them). Important resources even, such as iron. All I get (after 2000 years of giving them iron) is "+1 We appreciate that you have supplied us with resources." One even gives me +2... I think that's a bit low, considering that giving resources for free is quite a useful thing to do. Maybe we can increase that bonus to a max of +4?

Pvblivs
Jul 24, 2006, 09:47 AM
+4 is too much. If it is the only thing you do for a trade partner it should be max +3 but very very seldom. Just compare it to mutual struggles, traded technologies or other trades etc. etc. +2 is a good mean value I think and +1 the starter.

If you can achieve such good values just from gifting (while not being demanded those gifts) you could easily make a neighbour pleased just by giving him fish and clams even if those are the only health resources he has :)

Seven05
Jul 24, 2006, 09:49 AM
They don't grasp the value of copper, iron, tin and timber since none of them are prereqs for building anything. The only true "strategic" resource is ivory, giving them some ivory will work wonders. Hapiness resources are always good too and the AI understands them :)

I don't know if the relation bonus for supplying resources is accessible to us in XML, I don't recall seeing it in there so it may be a fixed value burried in the code somewhere. I'll look into it.

Seven05
Jul 24, 2006, 10:12 AM
I put a quick test update in the second post, I haven't had a chance to try any of the included changes so it may or may not work well :)

I made the AI more likely to accept & offer tech trades and adjusted some of the positive "memory" bonuses for trading.

The religion modifiers are all set to +/- 1 or 2, I'll have to dig through the SDK to see why some still give a +/- 3, perhaps it combines the modifiers from both civs.

thamis
Jul 24, 2006, 10:13 AM
You can't gift resources that the other party already has.

Any resource that is gifted should give a more significant bonus than +1. I gave Caesar 6 resources for free and he still gave me +1. I think 6 resources should give definitely +4, especially if given over a long period of time.

I'd like an algorithm like this:
+1 for 1st resource
+1 for every other 2 resources
+1 for every 50 turns suppy to a total of +3

So if I have given my friend 3 resources over 100 turns, I would get: +1 (1st resource) +1 (2 more resources) +2 (2x 50 turns) = +4. I think that's not too much and actually very balanced. Giving 3 resources for 20% of the game is quite a significant advantage.

Seven05
Jul 24, 2006, 03:35 PM
Those bonuses (years supplied with resources) also apply with regular trading, not just gifted resources. The AI also doesn't know when to stop a trade which will make it very easy for the human player to "exploit" their trade weakness. We need to be careful not to turn trade into the "freebie" relations tool that religion is. Currently it is very easy to monopolize certain resources especially wheat, fruit, olives, fish, crabs, clams, whale, sheep, amber, spices, wine, incense and ivory.

So playing as Greece I can almost always have tin, sheep, wheat, olives and fish to trade with the Dacians. If I gift them all I will get a +4 for fair trade and +1 for supplying them with resources. Using your proposed changes that would increase to +4 and +4 (+5 after 100 turns) for a total of +8 (+9 eventually) from trade alone making them friendly without needing open borders, mutual enemies or giving them any help. The +4 for fair trade can be affected by more than resources making it possible to get +5 relations with only a single resource gift. You can also get to this point by gifting one or two to get them friendly enough to exchange other resources, trading 1 for 1 on those, removing the gift(s) after 10 turns and retaining the bonus to relations for the remaining even trades. The AI will also agree to almost any GPT for resource deal you offer and almost never cancel them.

Sisonpyh
Jul 25, 2006, 01:22 AM
They don't grasp the value of copper, iron, tin and timber since none of them are prereqs for building anything. The only true "strategic" resource is ivory, giving them some ivory will work wonders. Hapiness resources are always good too and the AI understands them :)

I don't know if the relation bonus for supplying resources is accessible to us in XML, I don't recall seeing it in there so it may be a fixed value burried in the code somewhere. I'll look into it.

Well, Vitario sure likes to hoard all of his horses. Playing as Carthage, I was peace with the guy the entire game, most of the time he remained at 'pleased' but refused to trade Horses. Eventually I gave him techs for his decleration of war on Ceasur which bumped his disposition up to friendly. Only then would he part with his precious Horse (even though he had 4) - only at a ridiculous price. He wanted Ivory, Gold, Wine and Spices in return. Screw that, I declared war on the selfish bastard next turn.

Pvblivs
Jul 25, 2006, 01:33 AM
Those bonuses (years supplied with resources) also apply with regular trading, not just gifted resources. The AI also doesn't know when to stop a trade which will make it very easy for the human player to "exploit" their trade weakness. We need to be careful not to turn trade into the "freebie" relations tool that religion is. Currently it is very easy to monopolize certain resources especially wheat, fruit, olives, fish, crabs, clams, whale, sheep, amber, spices, wine, incense and ivory.

So playing as Greece I can almost always have tin, sheep, wheat, olives and fish to trade with the Dacians. If I gift them all I will get a +4 for fair trade and +1 for supplying them with resources. Using your proposed changes that would increase to +4 and +4 (+5 after 100 turns) for a total of +8 (+9 eventually) from trade alone making them friendly without needing open borders, mutual enemies or giving them any help. The +4 for fair trade can be affected by more than resources making it possible to get +5 relations with only a single resource gift. You can also get to this point by gifting one or two to get them friendly enough to exchange other resources, trading 1 for 1 on those, removing the gift(s) after 10 turns and retaining the bonus to relations for the remaining even trades. The AI will also agree to almost any GPT for resource deal you offer and almost never cancel them.

Yep, that is what I thought of. To be gifted many things is of course nice. But if you're a bad guy because you traded with my worst neighbours (-2), we have open border tensions (-1) and you refused a tribute (-1) then you could simply buy yourself out of this evaluation by just gifting many crappy things. What is crappy? For example 3 food resources if your neighbour already has 4 different.

Good relationships should require more effort than just simply sending away things that you don't need. Additionaly gifting even works when trading doesn't. If it grants you high bonuses (even after 50 turns) then it would be a no-brainer to open trade relations to someone you formerly declared war on.

What is this more? Open borders, help in military struggles, same religions etc. Those are all things that make a good friend in Civ4. Making one aspect that is very easy to apply very strong will undermine those other mechanisms because they are more difficult. Like war that is often expensive for you, trades and open borders are not possible without at least normal relations etc.

That's the reason why I wouldn't make free-bees so strong.

thamis
Jul 25, 2006, 03:41 AM
Well, Vitario sure likes to hoard all of his horses. Playing as Carthage, I was peace with the guy the entire game, most of the time he remained at 'pleased' but refused to trade Horses. Eventually I gave him techs for his decleration of war on Ceasur which bumped his disposition up to friendly. Only then would he part with his precious Horse (even though he had 4) - only at a ridiculous price. He wanted Ivory, Gold, Wine and Spices in return. Screw that, I declared war on the selfish bastard next turn.

That's precisely what I would like to prevent...

Also, one more thing (which I think I mentioned before but which wasn't picked up on yet):

In the beginning, if you trade with ANY civ, all other civs will tell you that you traded with their worst enemy. By default. They're not at war with that nation, don't even have anything to do with them. Simply because they're "cautious" towards that civ. I think worst enemy should only come in when they're at least "annoyed". Is that possible to change in the SDK?

Pvblivs
Jul 25, 2006, 03:58 AM
:lol: I thought "worst" would mean a specific worst. Now I realize that the whole world can consist of worst enemies. Very amusing...

much2much
Jul 25, 2006, 05:23 AM
Those bonuses (years supplied with resources) also apply with regular trading, not just gifted resources. The AI also doesn't know when to stop a trade which will make it very easy for the human player to "exploit" their trade weakness. We need to be careful not to turn trade into the "freebie" relations tool that religion is. Currently it is very easy to monopolize certain resources especially wheat, fruit, olives, fish, crabs, clams, whale, sheep, amber, spices, wine, incense and ivory.

Excellent points.
Giving something away for free that you do not need is obviously a way to make someone like you without a high cost. Plus it is not a boost like cash or tech gifts are: it is a turn by turn thing. Sure 1000 years may have passed but you can always cancel the deal at any time. Maintaining it should be the cost for maintaining the relationship bonus.

Seven05
Jul 25, 2006, 09:19 AM
In the beginning, if you trade with ANY civ, all other civs will tell you that you traded with their worst enemy. By default. They're not at war with that nation, don't even have anything to do with them. Simply because they're "cautious" towards that civ. I think worst enemy should only come in when they're at least "annoyed". Is that possible to change in the SDK?
The "worst enemy" depends on more than just the relationship level and that particular penalty is one of the "memory effects" so it is entirely possible that they were cautious, something made them annoyed while you were trading with them and then they're back to cautious but you still get the penalty for a few turns.

schlappi
Jul 26, 2006, 02:20 AM
Playing as Persian on the huge map (monarch) i noticed the following:

Deiokes from the Medeans always was around the same level as me, until he captured a barbarian city far east, then he began slowly falling back.
The Hittites, when i met them, were a medium power in anatolya. They too decided not to raze a barbarian city (near ganges river). After they did, they never gained any more points, began to fall back quickly behind their neighbours and were slaughtered after.

I think the AI's choice about razing captured cities needs to be reviewed.

Greets,
Schlappi

PeteT
Jul 26, 2006, 04:35 AM
Originally Posted by thamis:
In the beginning, if you trade with ANY civ, all other civs will tell you that you traded with their worst enemy. By default. They're not at war with that nation, don't even have anything to do with them. Simply because they're "cautious" towards that civ. I think worst enemy should only come in when they're at least "annoyed". Is that possible to change in the SDK?



Originally Posted by seven05:
The "worst enemy" depends on more than just the relationship level and that particular penalty is one of the "memory effects" so it is entirely possible that they were cautious, something made them annoyed while you were trading with them and then they're back to cautious but you still get the penalty for a few turns.


Well, for the purposes of this mod, you might want to change ATTITUDE_CAUTIOUS to ATTITUDE_ANNOYED in the below method:


/*! \brief Determine if one of the other teams is this team's worst enemy.
*
* \remarks 'Worst Enemy' means most disliked, with an attitude < ATTITUDE_CAUTIOUS
*
*/
// Determine if one of the other teams is this team's worst enemy.
// 'Worst Enemy' means most disliked, with an attitude < ATTITUDE_CAUTIOUS
void CvTeamAI::AI_updateWorstEnemy()
{
PROFILE_FUNC();

TeamTypes eBestTeam;
int iValue;
int iBestValue;
int iI;

iBestValue = MAX_INT;
eBestTeam = NO_TEAM;

for (iI = 0; iI < MAX_CIV_TEAMS; iI++)
{
if (GET_TEAM((TeamTypes)iI).isAlive())
{
if (iI != getID())
{
if (isHasMet((TeamTypes)iI))
{
if (AI_getAttitude((TeamTypes)iI) < ATTITUDE_CAUTIOUS)
{
iValue = AI_getAttitudeVal((TeamTypes)iI);

if (iValue < iBestValue)
{
iBestValue = iValue;
eBestTeam = ((TeamTypes)iI);
}
}
}
}
}
}

m_eWorstEnemy = eBestTeam;
}

Seven05
Jul 26, 2006, 11:19 AM
Well, for the purposes of this mod, you might want to change ATTITUDE_CAUTIOUS to ATTITUDE_ANNOYED in the below method:
About the only time the AI is furious (only attitude below annoyed) with other AI is when they are actually at war. I'd rather change the text from "worst enemy" to "enemy." This penalty is essential for the "domino effect" it causes with your neighbor's neighbors, without it the only people you will ever have less than cautious relations with will be your immediate neighbors (border tension) or civs with a different state religion (easily avoided by having no state religion). Take the Romans, Iberians and Gaul for example, without this penalty the Romans will be annoyed with the Gauls due to border tension in most games. With this penalty in place the the Romans would become annoyed with the Iberians if they traded with the Gauls or the Gauls would become annoyed with the Iberians if they traded with the Romans. If the Romans and Iberians had some border tension the trade between the Iberians and Gauls would be enough to kick the Romans into being Furious and would spark a war more often than not. Now, if they had to be Furious before the penalty kicked in they may never become furious in the first place like you see with many distant civs that remain cautious despite religious penalties because they have no border penalities.

As for the Virato example I don't think that's a problem, how many players would willingly trade iron to an AI civ that they weren't absolutely sure would never attack them? I know I'm very stingy with certain resources like horses, ivory, iron, copper, tin and timber. About the only time I trade them away is with somebody who is fighting one of my enemies.

And, Virato is not in our leader personalities list as somebody who likes to trade often so he will be less likely to offer good trade deals than other leaders may be.

Ankenaton
Aug 01, 2006, 08:41 PM
About the only time the AI is furious (only attitude below annoyed) with other AI is when they are actually at war. I'd rather change the text from "worst enemy" to "enemy." This penalty is essential for the "domino effect" it causes with your neighbor's neighbors, without it the only people you will ever have less than cautious relations with will be your immediate neighbors (border tension) or civs with a different state religion (easily avoided by having no state religion). Take the Romans, Iberians and Gaul for example, without this penalty the Romans will be annoyed with the Gauls due to border tension in most games. With this penalty in place the the Romans would become annoyed with the Iberians if they traded with the Gauls or the Gauls would become annoyed with the Iberians if they traded with the Romans. If the Romans and Iberians had some border tension the trade between the Iberians and Gauls would be enough to kick the Romans into being Furious and would spark a war more often than not. Now, if they had to be Furious before the penalty kicked in they may never become furious in the first place like you see with many distant civs that remain cautious despite religious penalties because they have no border penalities.

As for the Virato example I don't think that's a problem, how many players would willingly trade iron to an AI civ that they weren't absolutely sure would never attack them? I know I'm very stingy with certain resources like horses, ivory, iron, copper, tin and timber. About the only time I trade them away is with somebody who is fighting one of my enemies.

And, Virato is not in our leader personalities list as somebody who likes to trade often so he will be less likely to offer good trade deals than other leaders may be.
I get Virato to open up early on by gifting techs and resources. During the middle part of the game he will trade. However during the last third (if he is still alive) he will not trade, even if he is your closest allies.

Seven05
Aug 02, 2006, 02:03 AM
Yeah, that's the old Civ4 code at work in the DLL. The old method of valuing trades doesn't work well with our modified upkeep and increased wars.

Ankenaton
Aug 02, 2006, 03:17 PM
Yeah, that's the old Civ4 code at work in the DLL. The old method of valuing trades doesn't work well with our modified upkeep and increased wars.
I hear you; I just wish that Firaxis would code some of this stuff from the beginning rather than you and others trying to add to it. Thanks for the good work.

Seven05
Aug 03, 2006, 05:32 PM
The code is there, it's just built around their original upkeep values and resources so it makes a lot of (now incorrect) assumptions.

Ankenaton
Aug 03, 2006, 08:44 PM
The code is there, it's just built around their original upkeep values and resources so it makes a lot of (now incorrect) assumptions.
Thanks I stand corrected.:goodjob:

Seven05
Aug 03, 2006, 10:34 PM
Wow, if only the AI were so easy to convince :)

Ankenaton
Aug 04, 2006, 12:28 PM
Wow, if only the AI were so easy to convince :)
Hey man, I have been a sometime contributer and full-time reviewer of posts concerning this mod almost from the beginning. So I give praise where it is due. When an individual presents a convincing argument based in logic; it would be sheer folly (if not outright ignorance) to debate otherwise. So unless someone who is as well versed in the game code as you are posits a logical counter-argument, then I must graciously concede the point. Keep it coming! :goodjob:

Seven05
Aug 07, 2006, 02:05 AM
Now I just need a few day of less work to test out some new changes. I haven't had much time to test out the most recent AI fixes in 1.95 so any feedback on their behavior would be appreciated. Particularly the number of units they build and how many cases of wrong units for the job you see (like chariots defending cities or huge stacks of rams & siege towers). I'm also curious if the trade is working out better/worse and would be interested in any specific suggestions on leaders that should be more/less likely to raze cities (or build wonders while we're at it).

Ankenaton
Aug 07, 2006, 04:49 PM
Will do.:)

baptiste
Aug 08, 2006, 04:50 PM
I haven't had much time to test out the most recent AI fixes in 1.95 so any feedback on their behavior would be appreciated.
I noticed something weird in my current game.
Hatshepsut is declaring war from time to time (logical since we are neighbors with different religions), she comes with a stack of 5 to 10 units rushing always the same city defended by 3/4 units (while i have some easier target for her), she declares war, comes to 1 tile distance from my city, and then retreat. She did that 4 or 5 times, letting just 1 unit attacking, all the other units in the stack going back in the fog (i don't bother to visit desert, i am as hammurabi).
After that, she stays at war for long periods, always asking for something for peace and never declare peace until i give her something.

I've been at war also with the Median without this kind of "intimidations".

(huge mediterranean map, monarch difficulty, playing babylonians, egypt and i fighting for 2nd ranking. I specify since it could change her behavior)

I observed persian and median behavior about unit balance, they seem to be much wiser than before, with less siege engine -especially at the borderline- and smarter with units balance (with something like 3 lancers, 3 javelins, 1 archer and 1 to 2 siege in border city)

Seidrik_The_Gray
Aug 09, 2006, 02:18 PM
When I play Egypt, the Nubians are always attacking me, even when they are much less powerful than me. When the AI plays Egypt, he is best buddies or at least never has a war with the Nubians....

When I play Persia, I recognize the value of a city in the west at the mouth of the Tigress/Euprhates valley. The AI for Persia, seems to just build in a tight cluster around Persepolis.

I echo comments posted earlier, concerning AI reluctance to go for Iron working to clear the dense forests that are choking out the "primative" civs.

When a Human attacks, he uses seige weapons and skirmishers first (collateral damage), then his/her heavies (I rarely incorporate more than a couple Medium Units). Additionally, I use my least experienced units first, to minimize the chance of losing an experienced unit. Finally, if it's a slow battle, I may only soften the target, and try to whipe out 60% of the enemy defenders, and plan for a second attack in the next round, vice using all of my units in the first attack. Heck, I have also found it useful to pull out the Pyric victory card, throwing yellow health units at the surviving defenders in the next round, gambling that this will weeken the defenders for my full health units that I "saved in reserve."

The AI does not do this. I don't know how you begin to teach it, but it would really make battles interesting.

Also, to support an earlier poster, concerning an apparent AI obsession with one or two cities. I totally support his experience. I have fought wars spanning a thousand years with other civs...and the whole time I could confidently just defend one city. I think this has to do with the distance factor in their decision to go to war. I also believe that the AI has a fixation on resources versus "strategic strikes" and "crippling the oponent."

More on tactics...who hasn't used this exploit?

When facing an AI city stacked to the gills with Archers and Spearmen, you send in a stack of Skirmishers, Spearmen, Axemen and Catapults, keeping your Chariot/Chariot Archer stack just out of range. The AI throws a few Archers blindly to their deaths. Next turn, you bombard, then strike with Chariot Archers, retreat into your stack (usually on a hill.) The AI (if they still have a decent defensive stack) attacks your position...again with Archers. Now, you go all out, and capture or raize the city.

The AI doesn't fight this way either. Your stack draws them out of their castle...a good tactic for them IF they used the right units!!! But they don't, they use their Archers vs. something else, and end up helping you!!!

All for now, back to work I go...

Seidrik_The_Gray
Aug 09, 2006, 02:25 PM
Forgot to add that prior to 1.94, the AI traded like an idiot. Now, I don't even bother. The AI only makes demands, rarely ever offers a quid pro quo arrangement. Additionally, I haven't had any luck with open borders either.

thamis
Aug 09, 2006, 03:03 PM
Forgot to add that prior to 1.94, the AI traded like an idiot. Now, I don't even bother. The AI only makes demands, rarely ever offers a quid pro quo arrangement. Additionally, I haven't had any luck with open borders either.

I observe the same behaviour. Resource trading is basically non-existent.

Alekhine
Aug 09, 2006, 04:06 PM
I agree with nearly all of kwarriorpoet observations except for the AI behaviour when handling Egypt & Nubia. In the games I've played Nubia always destroys Egypt, usually early in the game. I think this is because of a lack of "hammers" in the general Egyptian settlement area and the fact that the AI in Civ4 dosn't use Pop Rushing at all skillfully (the only way to play Egypt successfully).
I also think that the AI is slightly better with it's battle tactics than has been given credit for, I've had some truly titanic battles, attacking & defending, which could have gone either way, but perhaps that's because I'm no expert at playing the game:blush:

baptiste
Aug 09, 2006, 07:31 PM
I agree with nearly all of kwarriorpoet observations except for the AI behaviour when handling Egypt & Nubia. In the games I've played Nubia always destroys Egypt, usually early in the game.
In my current game, by 200 AD both are at comparable levels (egypt more powerful, nubia more tech advanced) and they very often declare war to the other. Important point : they follow different religions.
I guess that if in many games they stay peaceful between themselves it's mainly because they share religion. Egypt is very religion-oriented and Nubia quite peaceful, so if they share same religion, it's not surprising that they do not fight so much.

One point about trade : the reluctance for doing trade between nations is imo a disadvantage for "ressources-specialized" nations, with a narrow variety of ressources. Such as Persia, Nubia and northern european countries. For example, in a more peaceful game, Persia could make great deals with incense/spices/silk trading, or Nubia with Ivory, Decebal with deers.
As a player, it is not such a problem : you cannot have access to many ressources, but you can sell (and very expensive) your additioinnal ressources and you "manage" more easily than AI this specificity.

Hypnotoad
Aug 10, 2006, 11:47 AM
On the trade front, I've noticed some interesting thing:

I am playing as the Nubians on Immortal (I think -- the second from the hardest). The only time I can get an open border agreement is if I agree to go to war with someone. Interestingly, this has created an incentive for having a couple of remote wars going on and hoping that my new found enemy doesn't send any units my way. Right now I don't have any wars going on and hence no open border agreements, which is hurting my commerce. I'm thinking about manufacturing a war if I can draw in allies so that I can get open border agreements.

I have been able to trade techs once. I am Nubia and I traded with Hiram when we had a common enemy and I had gifted him a number of techs and we were well into the "pleased" diplomatic range.

-- Hypnotoad

Seidrik_The_Gray
Aug 10, 2006, 12:19 PM
I agree with nearly all of kwarriorpoet observations except for the AI behaviour when handling Egypt & Nubia. In the games I've played Nubia always destroys Egypt, usually early in the game. I think this is because of a lack of "hammers" in the general Egyptian settlement area and the fact that the AI in Civ4 dosn't use Pop Rushing at all skillfully (the only way to play Egypt successfully).
I also think that the AI is slightly better with it's battle tactics than has been given credit for, I've had some truly titanic battles, attacking & defending, which could have gone either way, but perhaps that's because I'm no expert at playing the game:blush:

In my games, Thebes is almost always founded by the AI up by the two fish, flax and copper near Phoenecia. This is an excellent shield/hammer location. I think Egypt runs into problems if it tries a more historical settlement pattern, which is a decision it bases completely on Nubia's settlement pattern, since the AI always settles in the "blue" circle/suggested location, which shifts based on distance to other cities and available resources.

It's not a bright way of doing things...works great if no near by civs.

You're right about Pop-Rushing though...this isn't something the AI does well at all.

The Egyptians definitely lack hammer potential early in the game...could be time to put back some flood plains plains???

Seidrik_The_Gray
Aug 10, 2006, 12:22 PM
On the trade front, I've noticed some interesting thing:

I am playing as the Nubians on Immortal (I think -- the second from the hardest). The only time I can get an open border agreement is if I agree to go to war with someone. Interestingly, this has created an incentive for having a couple of remote wars going on and hoping that my new found enemy doesn't send any units my way. Right now I don't have any wars going on and hence no open border agreements, which is hurting my commerce. I'm thinking about manufacturing a war if I can draw in allies so that I can get open border agreements.

I have been able to trade techs once. I am Nubia and I traded with Hiram when we had a common enemy and I had gifted him a number of techs and we were well into the "pleased" diplomatic range.

-- Hypnotoad

This trade issue and open borders issue has been discussed. I think that it's a consequence of making the AI more likely to fight wars, almost as likely now to fight other AIs than the human. Previous versions had very little AI on AI war and easy trading. Now, there is no trading and lots of war...I'm sure balance will be found one day.

Seven05
Aug 12, 2006, 01:42 AM
Hehe, balance :)

Sorry about my unexpected absence, the downside of free labor. Anyway...

Not much I can do right now with regards to the AI's specific tactical descisions. From what I remember checking in the DLL theres is some degree of control for us but I don't think it is so specific as to allows us to give them more "human like" behavior with stacks. For example the AI assigns every unit a mission (normally based on the unit's defined AI type) and then grabs "followers" of an appropriate type to form a stack, if the lead unit get's killed the remaining stack will run back through the mission selection code. Normally this causes them to break up the stack and start pillaging or retreat back to their cities. Sometimes they will continue to attack but it depends on the unit ratio. The AI also knows few basic tactics like prefering to use collateral units to attack enemy stacks outside their cities (the archer issue described above), not a bad tactic in vanilla Civ4 but not always ideal here.

As for the trading that can be tweaked. I'm not suprised there is very little trade going on, especially with techs. The only real problem is that once you figure out how to work it, it is very easy to manipulate the AI. So it's not really much harder than before, just different. I find it pretty easy to get open borders and good trade deals (including techs) but then I have an unfair advantage since I know exactly what each leader likes and dislikes, even those modifiers that aren't visible in the advisor screen. Unfortunately, without getting into some deeper DLL changes we're stuck with small changes making big differences. So if we ease up the open borders by one step it'll be right back to the way it was before. Resources are the same way but we have better control over technologies (with the exception of the old "you're too advanced" modifier).

In a sense only having open borders during a shared war is very appropriate, it's just a shame that trade depends on open borders... I wonder if we can change that to allow foreign trade at a predefined attitude rather than only with open borders.

I have a busy week ahead of me so I'm not sure when I'll have a chance to actually do much here. I will send Thamis some suggestions for adjusting the tech trade issue, that may be enough since trading techs will make them happy enough to open up their borders in most cases.

Seven05
Aug 12, 2006, 01:43 AM
I shoudl re-phrase that, but I'm tired and it's late. Of course the DLL will let us do just about anything we want to the AI, it's just a matter of the value of the return compared to the amount of work required to get it.

baptiste
Aug 13, 2006, 05:01 AM
Seven, something incredible just happened !
Open borders without any gift, without any common war !?!

I traded with Hapshesput, shared her religion, and later on, she offered open borders, i didn't believed it :p

Finally, it just means it can be done with pro-religious leaders.

In some games, the mediterranea makes people crazy : http://img221.imageshack.us/img221/84/dido48adqv3.th.jpg (http://img221.imageshack.us/my.php?image=dido48adqv3.jpg)

And 200 years later, still many wars, many opened borders.
http://img301.imageshack.us/img301/3451/dido260adyv1.th.jpg (http://img301.imageshack.us/my.php?image=dido260adyv1.jpg)

baptiste
Aug 14, 2006, 03:37 PM
Another strange AI behavior with Taharqa. Huge med map.

Background : during the last 50 turns he had been at war with Hiram, Hapshesput and now he is at war with me (Carthage). So he -should- have most of his troops in the northern part of his territory.

He had 5/7 units in most ofhis cities exect one, in wich he had more than 50 units (!), and the weird thing is that it was an isolated city without any real threat (the one with wheat west of capitol, bordering the map, between Nil river and the end of the desert). I can provide save file if needed, but that was totally unrealistic (and stupid from the AI).

much2much
Aug 15, 2006, 05:47 AM
In a sense only having open borders during a shared war is very appropriate, it's just a shame that trade depends on open borders... I wonder if we can change that to allow foreign trade at a predefined attitude rather than only with open borders.

One of the queerer parts of Civ4. Countries you are trading with you should get an idea of their tech level and maybe what kinds of units they have but Open Borders IS a different matter.

Getting trade working without open borders would be awesome.

Seidrik_The_Gray
Aug 15, 2006, 10:16 AM
I don't really care about open borders, but trade based on their attitude would be a huge improvement.

You could allow resource trading if cautious, and restrict tech trading to Friendly or better. That would be fine with me.

One would then definitely want to be with the "in crowd" as far as religion goes.

SrWilliam
Sep 05, 2006, 08:13 AM
I played my first game of Warlords last night. I think the AI attacks and defends a bit better than before, there may be some new code here worth incorporating into TAM.

Hypnotoad
Sep 05, 2006, 07:50 PM
I really like the idea of allowing for trade without open borders. It wouldn't even have to be resource trading -- even just having cities with which you can do generic (city to city) trading would be a great thing.

-- Hypnotoad

Seven05
Sep 06, 2006, 03:27 PM
Ok, time is pretty scarse for me right now but I think I have found a couple of reasonable solutions for trade issues.

1. We can base foreign trade routes on the attitude value, this is a numrical value that influences the text assigned to your relation. For example -3 through +3 is cautious. The easiest option is to simply allow foreign trade routes once the attitude value is greater than X (10 is friendly so I would think pleased would be better so about 6 or 7 would work well). I have the code for this change somewhere and I believe I may have sent it off to either Thamis or Shqype some time ago. A more elegant solution would be to allow X number of foreign trade routes with X being equal to the attitude but this would require some extensive work in how Civ4 choses foreign trade routes per city.

2. The next option would be to allow or prevent foreign trade routes based on "real" trade agreements. This could also be done two ways with the easiest being to grant foreign trade routes once you have a set number of active trades. Likewise it could be setup to grant one trade route with with a specific civ for each active trade with them, again this would require a lot of work with to the existing foreign trade routes.

In both cases you should also be able to grant foreign trade routes with open borders, so in the event you have open borders but no trade routes due to other circumstances you would gain them as long as you maintained open borders. Or not, that part is very easy to control. A possible third option is to simply create a new diplomatic option to allow foreign trade routes without open borders. I haven't lookind into that to see how much work it would be though.

The biggest hurdle is that I can't compile the DLL, I have an active development enviroment setup for "real" projects using two different compilers and I'm not really interested in adding a third. I also currently develop projects using the platform SDK in 64-bit which can create a bit of a mess trying to also impliment portions of it for 32-bit projects such as this. I also have to leave that mess to Thamis to sort out unfortunately since my time is so limited right now.

Hypnotoad
Sep 07, 2006, 10:46 AM
Steven05:

I think any of the easier options would be a significant improvement. I like #1 bettter than #2.

solanacea
Oct 01, 2006, 06:16 AM
I think AI's unwillingness to trade doesn't make any sense in this scenario.
Historically, trade was a huge part of ancient Mediterranean. (I m sure we all know that.) Fair trade is almost always beneficial for both parties and I don't think any historical ruler forbade trade with a foreign empire because he was "cautious" towards them. You don't have to love your neighbour to sell him goods for a fair price.

Having 4-5 extra resources and being unable to trade a single one really spoils the fun big time for me. I think we should put the "fun factor" ahead of "balance" here. You can always play immortal difficulty if you want a challange.