Colonial AIs are too hard to kill

I wonder if the person who wrote that code did some table calculations on the weightings ...
The balancing between Vanilla and WTP differs so extremely that all calcuations they could have made would be worthless now (15 years later). :)
 
I was actually looking for the weighting in the wrong place ... :(
It is CvPlayerAI::AI_unitAIValueMultipler that should be modified. And there are already three factors influencing the weight (added up):
1) AI_countYieldWaiting()
2) getNumEuropeUnits()
3) something else about population, but in my calculations that part would almost always result in 0
But I'll try changing the weighting of 1) and 2) a bit and see how that works in autoplay ...
 
Did some autoplay testing now with and without changes to the weighting for transport units.
Unfortunately, they did not have any real effect. My suspicion is the following:
- An AI doing well economically (expansion, production, trade, ...) will have no problems with insufficient transport, empty their Europe queue and put all units to work
- An AI having problems economically (e.g. because of problems reaching some of their colonies/landlocked by rivals etc.) will either 1) lack transports and have a long Europe queue or 2) transport their units to a city but not put them to work.

In my autoplays up to turn 400 (both with and without changes to the weightings) there was always one player with only 1 or 2 settlements, this player had only 1 or 2 transport units and either up to 100 colonists just standing around in their main city or a large Europe queue. That player also did not have enough money to purchase units supporting their expansion - apparently it will only send out settlers if it has the military for protecting those settlements.

So my impression is that essentially AI has a problem if the economy does not work well and this will halt its expansion, accumulating colonists somewhere without equipment and without a useful task.
It might be worth a try to make it emphasize equipping units in Europe (as settlers and as military units) more than just hurrying another unit. (But I'm not sure if their unused colonists come from hurrying or simply from crosses).

If I'm reading it correctly, the problem is that AI will try to get units without a profession - the code checking for a profession to buy is commented out in CvPlayerAI::AI_doEurope.
The only thing it does (lines 8422ff) is equipping pioneers and counter units (what are these?). But there is no code making it equip settlers here - so is it correct that AI only gets settlers by some other mechanism, maybe too late because it has already spent all its money in AI_doEurope?

Well, I think I can't do this on my own. If anyone would be interested in reading the code together to find out what really happens that might help ... :)
 
I strongly believe AI should be very hard to kill completely, requiring tons of time and effort to evict from the New World. I.e. leave everything related as is.
 
I strongly believe AI should be very hard to kill completely, requiring tons of time and effort to evict from the New World. I.e. leave everything related as is.
But would you say you just don't want it to be killed at all? Because we have an XML setting for that, which makes the AI always respawn when it has lost its last settler/transport.
At the moment, it often stays alive, but in a state where it is also not taking part in the game anymore - keeping some units and moving them around, but neither colonising nor fighting anymore. And especially when those units are not on the map (Europe/Africa/Port Royal), there is nothing you can do as a player to change that. This is what I want to avoid, because it is just annoying.
 
Last edited:
But would you say you just don't want it to be killed at all?
No.
At the moment, it often stays alive, but in a state where it is also not taking part in the game anymore - keeping some units and moving them around, but neither colonising nor fighting anymore. And especially when those units are not on the map (Europe/Africa/Port Royal), there is nothing you can do as a player to change that. This is what I want to avoid, because it is just annoying.
AI units not on the map obviously need to be addressed, however I believe every AI unit in the New World should be found and killed to wipe out a nation, like in Civilization with Require Complete Kills setting enabled.
 
AI units not on the map obviously need to be addressed, however I believe every AI unit in the New World should be found and killed to wipe out a nation, like in Civilization with Require Complete Kills setting enabled.
If there are more people having this opinion, we will probably have to make the "minimum units" setting optional (or configurable by XML).

I'd like to mention that Civ4Col is different from Civ in that there are offmap units and units being spawned even if you have no settlements. Civ does neither have Europe, nor missions or trade posts.
 
  • Like
Reactions: nci
The new logic for killing or respawning players is now ready to be merged: https://github.com/We-the-People-civ4col-mod/Mod/pull/717
(please excuse the whitespace changes again, my editor seems to dislike some whitespace at eol and automatically remove them)
I made a pull request again because I'd really like someone (or two) reviewing what I did.

@nci I wouldn't mind if you'd read my implementation and tell me if you would still agree with that change even if right now it is not an XML option. (Because I would have to learn quite a bit more about the code to find out how to do that ...)
 
A follow-up on the topic of Europe queue and weighting of AI purchases:
In my current game (gigantic map, marathon, ~1714) I have just conquered all cities of AI France.
They have 5 transport ships left and a Europe queue of ~200 units waiting with at least 10 settlers (I cannot exactly count as there are so many units on the docks).
With the changes I commited to Europe queue sorting (part 1 and part 2) they will now - hopefully - send their transports back to Europe, load those settlers and then return to the map, taking at least 12 turns. I will have to search for the new settlements they will probably distribute all across the map and send my army there, probably taking at least another 10-20 turns depending on my success discovering them. If they manage to make any profits from any of these settlements, they will probably buy another settler in Europe, so in the moment I conquer all the new settlements, they will again send their transports and take another 12 turns to get that settler.

That is what I meant by "Colonial AIs are hard to kill" (my original complaint that made me start the thread). My personal opinion: I really don't like that mechanism, it is not fun at all, just annoying if I have the aim to eliminate the AI player from the game. It effectively makes an AI player almost unkillable without cheating to find out where their new settlements are (because otherwise that realistically takes even many more turns, enough for them to buy more settlers in Europe). There is no strategy in this, but only hide and seek (or "whack-a-mole") with a lot of randomness.

For me, if we want to keep it like this, it would actually feel more honest if we just admitted we don't want AIs to be killed at all and made that a game rule.
The alternative I am suggesting would be something like a diplomatic offer by the AI "retreat from the new world" together with the peace treaty, which would only be offered after losing all cities, losing many units and having an overwhelming power difference (like e.g. 1:20). (I know that won't be realised for 4.0 - but if some of you agree, we could make it an open task for 4.1 or 4.2)

The other aspect of the situation mentioned above is that somehow the balancing of AI purchases in mid- to endgame seems off. They are apparently focusing far too much on buying units in Europe when they have no use for them and cannot even transport them to the map. And if they can, they will then uselessly wait in their cities because they cannot be put to work.
 
a large number of units in the late game due to the fact that the number of crosses produced in the colonies is very high, and the emigration threshold is 400 points.
and yes, I agree that it is almost impossible to completely defeat the AI, even in the early game.
 
Thanks for all your work on the AI, Jooe!

Your observations on the status of the docks are very useful. Obviously the situation where there are transports available and also (many!) units waiting in Europe should be adjusted.
For me most growth comes from 'investing' in the best opportunities. Buying a unit pays off when he starts working and is generating gold again. Buying a ship pays off when it's used to transport units or goods. Buying good pays off when you use it to construct buildings or trade at the domnestic markets or with natives. Having units idling does not generate money and is (in nearly all cases) a waste of growth potential. So that certainly has to be improved in the AI.

On the colonial AI's to be killed: I agree that it should be possible.
It makes sense from both a historical (some countries stopped their ambitions for colonization) and a gameplay perspective (FFs becoming available again).

Especially when a nation is nearly 'killed' on the map, it should send in units that it has with available transport to the new world.
As long as a nation has a colony or is able to start one (ship + settler, or the gold to in fact buy those), it could remain in the game. After all, a player that is not able to build a colony will practically have no chance in winning the game.

I don't really see it as a problem that you would need to hunt for the location of the city (or units) on the map. That's simply a consequence of the fog of war and also we cannot assume that a nation would tell where it is located to an enemy. :)
But they should be on the new world map, not being stuck in Europe.

To conclude, with the necessary changes to the AI so that it doesn't pile up units in Europe, the rules that you and Ray have thought about probably will work fine!
 
I actually thought that with the new system the FF would become available.
When the setting would be enabled, the old system would be used and the FF would not become available. That's at least what the tooltip says. Perhaps the main issue first is to destroy the other nation. :lol:
 
I actually thought that with the new system the FF would become available.
That is correct. :)

---> New System: FFs can become available again if their owner Nation dies. <--- RaR / WTP
---> Old System: FFs are forever gone once another Nation got them. <--- Vanilla
 
Last edited:
Last edited:
The alternative I am suggesting would be something like a diplomatic offer by the AI "retreat from the new world" together with the peace treaty, which would only be offered after losing all cities, losing many units and having an overwhelming power difference (like e.g. 1:20)
As I said, that would be a nice feature if the weakest AI in that case would give all its Assets to the second weakest AI. :thumbsup:
You could then simply trigger a meassage (or popup) on the Screen explaining about some "Treaty" or such.

So at some point in the future that small "immersion addon" could be added to the "kill AI logic". :)
But for immersion purposes it should happen only once a game (otherwise it loses all its flair).
 
Last edited:
They are apparently focusing far too much on buying units in Europe
They are not just buying Units. There is normally really no problem that they are wasting money.
They get Units by immigration and I think there is also an AI cheat somewhere to give them additional Units in Europe.

Edit:
Probably the AI cheat for spawning Units in Europe should be deactivated once there are already more than 10 Units on the docks. :think:

Edit 2:
It is to be found here:
// PatchMod: AI immigration boost START
// TAC - AI More Immigrants START
void CvPlayer::doAIImmigrant(int iIndex)

@jooe:
This should really not trigger anymore once already 10 Units wait on the dock.
Do you also want to adjust this in your patch?
(So no additional spawnign if already 10 Units or more waiting in Europe.)

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

Edit 3:
I also checked the balancing of that AI Immigration cheat.
It was a bit messed up in my opinion ... :undecide:

The balancing in "HandicapInfos" was fine. (Once every 10 turns in average for GameSpeed "Normal".)
The balancing in "WorldInfos" was messed up. (Doubling the rate on e.g. Mapsize "Gigantic".)

Thus in average for MapSize Gigantic they got a free Colonist every 5 turns.
(For every Handicap beyond Exporer that is.)

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

Edit 4:
I changed the XML again, so it is at in average just every 10 turns. (For GameSpeed Normal.)
That is cheating enough for me ... a free colonist every 5 turns (for larger Maps) was just too much.

In other words:
The "doubling" of Immigration Cheat from MapSize was removed.
(It is just 100% again and not 200% as it used to be.)

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

@jooe:
I think that was the whole problem.
The AI immigration cheat from TAC was out of control.
(It did not really match to the new balancing of WTP anymore.)
 
Last edited:
Thanks for explaining this about the AI cheat, I understand now that it is not about a wrong AI focus :)

Still makes killing AI harder though if those free units are counted towards the min units in the kill player logic. Because there is no way to kill them while they are on the docks. So in the end we are back to the first two conditions (no settler || no transport left) and the third will probably rarely activate in a real playthrough.
 
As I said, that would be a nice feature if the weakest AI in that case would give all its Assets to the second weakest AI. :thumbsup:
You could then simply trigger a meassage (or popup) on the Screen explaining about some "Treaty" or such.

So at some point in the future that small "immersion addon" could be added to the "kill AI logic". :)
But for immersion purposes it should happen only once a game (otherwise it loses all its flair).
If this only happens once in a game (I understand your immersion argument) it won't help with getting the founding fathers though. Because atm, if one AI player A is killed and there is still another AI player B with enough FF point accumulated, B will get all the free FF before the human player's turn.
 
Top Bottom