• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

unmerged(29041)

Amnistiado por viejuno
May 12, 2004
5.496
0
I am half-way towards building a new AI system for AGCEEP based on knowledge gained from Daywalker, Idontlikeforms and latest research done by me. The system borrows from EP, as EP was also based in old AGCEEP. However every single AI file is being reviewed and changed, and many are being eliminated. I will propose this system to HC members and players for evaluation.

I am building a minimalistic system designed to be easily moddable by anybody, that can be perfected constantly based on feedback from users, according to the principles of AGCEEP.

Basic categories of AI files have been established for Small countries, SmallTrader countries, Large countries and LargeTrader countries. With Trader countries defined by ownership of international trading routes and/or Centers of Trade. This should cover about 90% of the countries. Only certain countries will have specific AI files, those are the countries that historically succesfully colonized or those that expanded greatly by conquest.

The change of AI files will be handled by a series of events all placed in the same file. The events can be made active by date, by certain conditions or by a combination. Every event should go through the same submission process as normal events. All transparent, all subject to evaluation.

I hope to have it ready before Christmas. In my opinion, even in the simple form of its first release it should have a huge impact in the game, and in general improve greatly the historic performance of AGCEEP, however I am sure that certain countries will perform worse, and the situation will have to be fine-tuned constantly to achieve a satisfactory result. But the advantage is that anybody will be able to modify it, or propose specific changes to it.

Now to continue with the system, I need 1000 event IDs assigned to the AI. 500 of them will be used to handle the changes of AI files, and another 500 will be for AI specific events, that should all also be in one single file instead of scattered. This should made AI modding much easier.

Once I have it ready, perhaps somebody can turn it into a dowloadable add-on, and testing can begin.

EDIT: Is it OK then if I reserve the ID ranges 500000 to 500999 for the AI?
 
Last edited:
Do you plan to have one AI file for each nation, or just one for each group of nations? Separate files are easier to mod IMO.

A clear and consistent naming system can help in making the system understandable and transparent for future modding.

Merchants
Also, I think we should use this opportunity to look into the traders value. We have already added lot of small states, and will add more. Most of these small states use the default/peaceful AI file, with traders = 100, and will send all their merchants if they can afford it. The historical trading nations, especially early on, have no chance to maintain their historical role as big traders, cause they are swamped with merchants in their trade center. They will, even with low tech, be knocking out the states that really ought to be there.

I think we should differentiate this value much more. Only those nations with a big role in long-distant trade should have traders = 100, other should have lower. Some should have traders = 0. To learn a bit more of what these settings actually give, I have started some testing.

I did a test with the Timbuktu trade center, that start out empty. All seven states that trade there were given 200d, trade 1, very peaceful AI's and 6 merchants. Result:
Code:
traders 	time to full COT
0		never
10		aug 1422
30		dec 1419
50		jun 1419
100		feb 1419

With traders = 10, in May 1420 (the COT is far from full), four of the states had 6 merchants, the two others 5.3 and 4.3.
With traders = 30, in Dec 1420 (the COT now full), the states had: 4.8 1.8 0.3 4.8 6.0 4.3 1.2 merchants left.

It seems values between 0 and 50 can be used to have states that send some, but far from all, their merchants. I'll need to do more tests to actually find out how many merchants are actually wasted, and if the DP's or anything else affect that.
 
The use of AI flags as trigger conditions, as any other trigger condition for a change of AI should pose no problem.
 
Norrefeldt said:
Do you plan to have one AI file for each nation, or just one for each group of nations? Separate files are easier to mod IMO.

A clear and consistent naming system can help in making the system understandable and transparent for future modding.

Merchants
Also, I think we should use this opportunity to look into the traders value.
First let me say that what I am proposing is to give a step in the right direction, not a complete comprehensive system that is beyond my historic knowledge. That should be the community work, and that is why it is important to make it as transparent as possible. This is the draft distribution of nations:

1) Small countries that did not expand historically by gaining provinces represented in AGCEEP at war or colonization, were not counterreformed, and did not own trade routes.
File: Small.ai
List of countries: MIN KLE HAN HEL HES IRA KOL LOR MLO MOL OHI PAR PFA SAC SIB TOS TUN WAL WUR SPR NAP KAL NAV GEO SHL PSK BRI NOR PRO GRA MEC BRE POM GEL FRI MAG OLD MAI MUN ORL BOU LUX HAU AUV RYA TVE PRM MAN PIS BYZ RAG SER BOS ALB ARM AMI TRE CYP HUR CHE DEL ZAP BEN DAH ASH KOR AYU MYA TAU ARK KHM CAM ATJ ATH KAR DUL CAN TEK XHO ZUL MLW GUJ JAI CHA PEG ORI STR BEI MKS BAS COI CON FAT JUT LEI LIV MES MST NAF SEV STT SWA SYR TAN THE TYR ULS U00 U04 U05 U06 U07 U08 U09 U15 U16 U17 U18 U19 U20 U21 U22 U24 U26 PRU

2) Small countries that did not expand historically by gaining provinces represented in AGCEEP at war or colonization, were not counterreformed, and did own trade routes.
File: SmallTrader.ai
List of countries: ADE GEN SUD MLC U23

3) Small countries that did not expand historically by gaining provinces represented in AGCEEP at war or colonization, were counterreformed, and did not own trade routes.
File: SmallCRC.ai
List of countries: KNI PAP BAY

4) Large countries that did not expand historically by gaining provinces represented in AGCEEP at war or colonization, were not counterreformed, did not own trade routes, and do not contain revolters.
File: Large.ai
List of countries: SWE POL BOH CYR HUN SCO STE NIP CAS LIT UZB TIM QAR CHM ETH KON ZIM MAL TIB VIJ ASS DLH CHG MTR LAT ARG

5) Large countries that did not expand historically by gaining provinces represented in AGCEEP at war or colonization, were not counterreformed, did own trade routes, and do not contain revolters.
File: LargeTrader.ai
List of countries: VEN MAM NVG ZAN BGL

6) Countries that have their own AI or AIs during part of the GC.
List of countries: ENG FRA HAB POR TUR DAN MOR SAV CHI AZT INC BRA BUR MOS AKK HOL SPA RUS DAU MOG OMA PER SON U11 U12 U13 U14 MCH

Obviously this list contains mistakes. Do not jump at me because of them. Point them to me with the reasons why they should be changed. At any time that a nation is decided that it needs a specific AI, it would be a simple task to create one and to add a couple of events to have it running and shut it down. But in my opinion the simpler the system, the better it will function, and we should be quite stringent about who needs a specific AI. I would go as far as to say that only great conquerors (Russia, OE), nations that contain revolters and colonizers do really require one for the mod to perform.

Regarding names of AI files, I am also trying to move towards a standard.
Country AI specific files start with the tag followed by a descriptive name, something like:
SPA_Bourbons.ai
This fits well with the naming scheme of IDLF in EP. I am trying to avoid dates in the name, but so far I lack good names for some of them.

Regarding trade, I had reached the same conclusion than you. Trade is very damaging to the AI (wasted money). But I had not done any testing on it, so I welcome your tests. Before knowing about them I had assigned a trade value of 20 to non traders and 100 to traders. Colonizers see their trade reduced also during periods of colonization to have more money available for colonization. Let me know what are your suggested values for trade if they are different to those.
 
That looks like a good start!
May I suggest names based on the name in game, or would that be too long? I'm quite good at tag<->names connections, but with all those new and the U tags, there are plenty of tags I don't know the state of.

5) Large countries that did not expand historically by gaining provinces represented in AGCEEP at war or colonization, were not counterreformed, did own trade routes, and do not contain revolters.
File: LargeTrader.ai
List of countries: VEN MAM NVG ZAN BGL
What do you mean by "do not contain revolters"?

Did the Mamelukes control as much trade as did for example Venice? All these states have COT's, but should that automatically put them in this group?
In category 1, I think a further division could be considered. Some small Italian states did get a lot of their income from trade, even if they don'e own a COT. They could have trade = 50, the main group 20, as you suggest, and some backwards coutries with no long distant trade at all 0 (Khanates, Golden Horde, Abkhasia, Theodoros, Georgian kingdoms, Irish minors for example).
 
Norrefeldt said:
That looks like a good start!
May I suggest names based on the name in game, or would that be too long? I'm quite good at tag<->names connections, but with all those new and the U tags, there are plenty of tags I don't know the state of.
Same with me. I have to look them up. But if you are going to mod the AI of a country you should at least know its tag.

Norrefeldt said:
What do you mean by "do not contain revolters"?
Sorry, copy-paste mistake, some in that group do contain revolters, like MAM.

Norrefeldt said:
Did the Mamelukes control as much trade as did for example Venice? All these states have COT's, but should that automatically put them in this group?
In category 1, I think a further division could be considered. Some small Italian states did get a lot of their income from trade, even if they don'e own a COT. They could have trade = 50, the main group 20, as you suggest, and some backwards coutries with no long distant trade at all 0 (Khanates, Golden Horde, Abkhasia, Theodoros, Georgian kingdoms, Irish minors for example).
I think you have it backwards. Trade is a huge waste of money for the AI even for nations with decent trade level. For TOS having a higher trade value means that it will waste more money sending merchants and so it will actually be poorer. I don't think the AI can make any money out of trade before level 4 unless it owns a CoT. Reducing a trade value to zero will make that nation have more money than its neighbours.
 
Fodoron said:
I think you have it backwards. Trade is a huge waste of money for the AI even for nations with decent trade level.
That's true, right now. But it wont be if they don't have to replace their merchants that often. Right now it's a big waste, since the AI is sending away every last merchant.

Fodoron said:
For TOS having a higher trade value means that it will waste more money sending merchants and so it will actually be poorer. I don't think the AI can make any money out of trade before level 4 unless it owns a CoT. Reducing a trade value to zero will make that nation have more money than its neighbours.
What if the overall number of merchants is reduced by, say 50%? If we lower competition, at some point the income from trade is larger than the cost for replacing merchants. We also need to have some competition for the player left. That competition won't be much easier if the merchants of high efficiency isn't randomly knocked out by the flood of low efficiency merchants. The ratio of high efficiency merchants in every COT would then be larger.
 
Norrefeldt said:
What if the overall number of merchants is reduced by, say 50%? If we lower competition, at some point the income from trade is larger than the cost for replacing merchants. We also need to have some competition for the player left. That competition won't be much easier if the merchants of high efficiency isn't randomly knocked out by the flood of low efficiency merchants. The ratio of high efficiency merchants in every COT would then be larger.
Let's work a little over your data. Timbuktu at trade = 10 was filled in Aug 1422, that is 44 months. Each country sends 20/7 = 3 merchants in 44 months, or 1 merchant every 14 months. At trade = 30, the same calculation gives us 3 merchants in 11 months, or 1 merchant every 4 months. At trade = 50 it works about 3 merchants in 5 months. At trade = 100 we are saturated so no information is obtained.
So trade = 10 appears to be roughly equivalent to 1 merchant/year and trade = 30 roughly 3 merchants/year, while trade = 50 is at 6 merchants/year. We are talking about success rate more than actual sending, so perhaps we would be closer to actual sending rates if we increase those numbers.
So we can conclude that trade = 50 is already well over saturation levels for all except some exotic CoT's.
Let's look for example at Zapatecas, where a group of 4 nations equally divides the CoT. Even at trade = 10 they are wasting all the money they put into merchants, and make all nations in the area waste money replacing lost merchants.

I am still not convinced that AI nations can actually make money out of trade before trade level 4. Obviusly, as you say, decreasing the flow improves the situation meaning they waste less money. Same happens when you load a game, trade situation is awful until everybody sends all available merchants, and then the rate of loss goes down.

We must also be aware that trade = 50 does not mean that the AI will send half the amount of merchants it would at trade = 100. Depending on the number of merchants that nation recibes, it could still send them all at trade = 50.
 
Fodoron said:
Let's work a little over your data. Timbuktu at trade = 10 was filled in Aug 1422, that is 44 months. Each country sends 20/7 = 3 merchants in 44 months, or 1 merchant every 14 months. At trade = 30, the same calculation gives us 3 merchants in 11 months, or 1 merchant every 4 months. At trade = 50 it works about 3 merchants in 5 months. At trade = 100 we are saturated so no information is obtained.
So trade = 10 appears to be roughly equivalent to 1 merchant/year and trade = 30 roughly 3 merchants/year, while trade = 50 is at 6 merchants/year. We are talking about success rate more than actual sending, so perhaps we would be closer to actual sending rates if we increase those numbers.
So we can conclude that trade = 50 is already well over saturation levels for all except some exotic CoT's.
Let's look for example at Zapatecas, where a group of 4 nations equally divides the CoT. Even at trade = 10 they are wasting all the money they put into merchants, and make all nations in the area waste money replacing lost merchants.

I am still not convinced that AI nations can actually make money out of trade before trade level 4. Obviusly, as you say, decreasing the flow improves the situation meaning they waste less money. Same happens when you load a game, trade situation is awful until everybody sends all available merchants, and then the rate of loss goes down.
Your calculations seem to be OK, from the meager tests done so far.
The empty slot success rate is:
Empty slot merchant placement success% =
(Constant base 50%) +
(5% * stability) +
(3% * ADM) +
(5% if the CoT is owned by merchant sender)
They are done with the beta, not 1.09, and two things have been changed since then. I will upgrade to 1.09 and do the testing with that from now on.
- The effect off trade efficiency on merchant placement is now gradually applied instead of just a 50% bonus.
- Lowered base chance for merchant placement form 50% to 35%.
We are assuming the AI continues to send merchants to already full COTs. I think that assumption is right, but I will test that.

In the example of Zapatecas, if it's the natives spending their money be continuously sending merchants, I see no big problem with them wasting their money. It will keep the COT alive, otherwise it will start jumping around. I do think they should have a rather low traders setting though. That COT is also a special case, since an equilibrium can occur. In most places this is not the case, and as long as a newly placed merchant is left in long enough to repay, it will benefit the sender.

For Timbuktu for example, the nations there, at least some of them, should be slowly sending merchants even to the full COT, to keep it alive, and apply some pressure on foreigners coming there. That pressure should however be less than today.

We must also be aware that trade = 50 does not mean that the AI will send half the amount of merchants it would at trade = 100. Depending on the number of merchants that nation recibes, it could still send them all at trade = 50.
AFAIK, this is not known. I will test it. From the very few tests done so far, there's difference in how many merchants that are sent, and I'll be looking for the reasons for behind that. We need to figure out how many merchants that are actually wasted, and if they are actually wasting them or just sending more slowly.
 
Last edited:
Do the AI waste merchants, and can trade competition be low enough to render a profit for the AI?

I loaded up a prepared game in 1.09 as well, with all eight west african states with trade 1, stab 3, 6 merchants and 200d. The AI files had traders = 10.
I wrote they were seven before, but I was wrong, there's eight (Mossi, Oyo, Benin, Hausa, Dahomey, Mali, Songhai, Ashanti). None of them had armies to maintain.

Just before the end of december 1419 I had a look at the save, to see what money had been spent. They couldn't send diplomatic gifts, since they didn't have diplomats. Benin and Dahomey started to build fleets, Mali converted, so I didn't look into their spendings. No one built troops.
In the trade center, there was now four merchants. For Mossi and Hausa, it could be seen that they had sent one each, and they recieved 3.4 and 3.8 merchants yearly.
Conclusion: the AI do waste merchants at low value for traders.

With 1.09, or just because of change of luck, it took until jan 1424 for the AI to fill up the COT. In october the same year, the first change was seen, as one merchant was being knocked out.
I looked into several later saves, and could see treasuries remaining untouched from january to december during later years as well. During 1425, there were no changes at all in the COT, and from the six nations not building or maintaining ships, only one merchant was sent. A state with three merchants placed earned 5.6d during that year, enough to place between one or two merchants.
At this level of competition I believe the AI makes money from trading, even if I should have studied an untypical year.

EDIT: For the actual traders values for this region, it could be differentiated a bit, with the states closer to Timbuktu having slightly higher, and those far away even lower. Some of the states here are not very long lasting. If we make the COT go away and a nw spawn in some coastal colony, that COT could become very valuable for the European owning it, since they could rather easily get a monopoly, as they should.
 
Last edited:
Fodoron said:
Same with me. I have to look them up. But if you are going to mod the AI of a country you should at least know its tag.
Sure, but sometimes one just wants to check out the AI file of a country. I find the extended event file names very helpful.
 
Fodoron said:
First let me say that what I am proposing is to give a step in the right direction, not a complete comprehensive system that is beyond my historic knowledge. That should be the community work, and that is why it is important to make it as transparent as possible. This is the draft distribution of nations:

1) Small countries that did not expand historically by gaining provinces represented in AGCEEP at war or colonization, were not counterreformed, and did not own trade routes.
File: Small.ai
List of countries: MIN KLE HAN HEL HES IRA KOL LOR MLO MOL OHI PAR PFA SAC SIB TOS TUN WAL WUR SPR NAP KAL NAV GEO SHL PSK BRI NOR PRO GRA MEC BRE POM GEL FRI MAG OLD MAI MUN ORL BOU LUX HAU AUV RYA TVE PRM MAN PIS BYZ RAG SER BOS ALB ARM AMI TRE CYP HUR CHE DEL ZAP BEN DAH ASH KOR AYU MYA TAU ARK KHM CAM ATJ ATH KAR DUL CAN TEK XHO ZUL MLW GUJ JAI CHA PEG ORI STR BEI MKS BAS COI CON FAT JUT LEI LIV MES MST NAF SEV STT SWA SYR TAN THE TYR ULS U00 U04 U05 U06 U07 U08 U09 U15 U16 U17 U18 U19 U20 U21 U22 U24 U26 PRU
As said, they did vassalise. And they did make some land conquests. Malwar and Gunjarat provinces would be the ones (the latter which does have a CoT). Especially the vassalization is important to note as that's how they got their wealth and power and why they were the most powerful nation at the arrival of the Mughuls. Can't represent that with a peaceful ai and two provinces.
Fodoron said:
4) Large countries that did not expand historically by gaining provinces represented in AGCEEP at war or colonization, were not counterreformed, did not own trade routes, and do not contain revolters.
File: Large.ai
List of countries: SWE POL BOH CYR HUN SCO STE NIP CAS LIT UZB TIM QAR CHM ETH KON ZIM MAL TIB VIJ ASS DLH CHG MTR LAT ARG
...um Kyushu?

And no...i'm not jumping at you here.
 
.... Sweden certainly did gain provinces.
 
Jinnai said:
As said, they did vassalise. And they did make some land conquests. Malwar and Gunjarat provinces would be the ones (the latter which does have a CoT). Especially the vassalization is important to note as that's how they got their wealth and power and why they were the most powerful nation at the arrival of the Mughuls. Can't represent that with a peaceful ai and two provinces.

As its been pointed out before, it'd be better to have them be peaceful then be war-like seeing as how there is no possibility that they will do what they historically did.
 
Garbon said:
As its been pointed out before, it'd be better to have them be peaceful then be war-like seeing as how there is no possibility that they will do what they historically did.
Again, border changes, except for some specific provinces such as Constantinople, are not akin to a god we have to please. Rajputana isn't going to be a the historically most powerful nation until the arrival of the Mughuls in india if they have small.ai.