Unofficialcrusaderpatch: Values for AI Iron Mine Count

Created on 25 Mar 2019  路  3Comments  路  Source: Sh0wdown/UnofficialCrusaderPatch

[Help Wanted]

The AI has a variable that describes how many iron mines it builds. But it is weird.
It is not the maximum amount it should build.
Here a list of all AI chars and their value:
Sultan: 0
Rat: 0
Snake: 0
Abbot: 10
Caliph: 12
Emir: 10
Frederick: 10
Marshal: 7
Nizar: 10
Philipp: 7
Pig: 10
Richard: 10
Saladin: 12
Sheriff: 12
Wazir: 12
Wolf: 13

How do these values represent the iron mine count?

I know they do, because when I change the 0 of the rat to a 1 or 2 or 10, he builds one iron mine.

Most helpful comment

The resource buildings depend on two parameters

  1. PopulationPer"ResourceBuilding"
  2. Max"ResourceBuilding"s

So the AI builds one resource building for each population amount of "PopulationPerResourceBuilding".

PopulationPerQuarry = 9
MaxQuarries = 6

Wolf builds 6 quarries total for each 9 peasants. So he theoretically builds his maximum amount when he reaches a total population of 6*9 = 54.

PopulationPerQuarry = 0
MaxQuarries = 1

If "PopulationPerQuarry" is set to zero, no buildings of that type are built. That's why Philipp builds no quarries.
https://github.com/Sh0wdown/UnofficialCrusaderPatch/commit/29f248d70a01b6adc25b060869bc9a65e19fec94

All 3 comments

As you stated it's obviously not the maximum number of iron mines and also not an indirect value for that (like # of workers rounded down or something along those lines).

This is the AIs sorted by the amount of maximum iron mines and their respective value from your variable:

(0) Sultan; Snake; Rat all -> 0
(1) Caliph -> 12
(2) Abbot -> 10; Nizar -> 10
(3) Marshal -> 7; Phillip -> 7; Pig -> 10; Wolf -> 13; Wazir -> 12; Emir -> 10
(4) Richard -> 10; Saladin -> 12
(5) Frederick -> 10
(6) Sheriff -> 12

The first thing I thought about could be some sort of "stocking behaviour" but that doesn't make sense at least for abbot that doesn't store any iron but has a value of 10.

The second and maybe more accurate idea could be the building priority for iron mines with a lower number being a higher priority to build them (e.g. Philipp having the lowest value while Wazir; Emir and Saladin have high values for a low priority. Wolf having maybe a low priority on iron but a higher priority on stone to finish his castle).

Can you test what happens if you set the value to like 100 for certain AIs or does that not work as [7][10][12][13] are some fixed values of the games script?

No, different values do work. I had tested with values from 1 to 13 for the rat, and each did result in a single iron mine.

Another thing: Quarries do work like you would think. Wolf has a "6" there, and builds 6. Rat has 1 there and builds 1. The snake has 2 there and builds 2, etc. EXCEPT for King Philipp. He has a 1 there but does not build one.

When I am home I could test with values like 100.

The resource buildings depend on two parameters

  1. PopulationPer"ResourceBuilding"
  2. Max"ResourceBuilding"s

So the AI builds one resource building for each population amount of "PopulationPerResourceBuilding".

PopulationPerQuarry = 9
MaxQuarries = 6

Wolf builds 6 quarries total for each 9 peasants. So he theoretically builds his maximum amount when he reaches a total population of 6*9 = 54.

PopulationPerQuarry = 0
MaxQuarries = 1

If "PopulationPerQuarry" is set to zero, no buildings of that type are built. That's why Philipp builds no quarries.
https://github.com/Sh0wdown/UnofficialCrusaderPatch/commit/29f248d70a01b6adc25b060869bc9a65e19fec94

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Monsterfisch picture Monsterfisch  路  3Comments

Heroesflorian picture Heroesflorian  路  4Comments

Ralf-Schmidt picture Ralf-Schmidt  路  4Comments

mceast picture mceast  路  3Comments

Udoachim picture Udoachim  路  3Comments