View Full Version : A.i.
Thalassicus Oct 06, 2011, 03:45 PM Well, this explains a lot.
<Row>
<AIMilitaryStrategyType>MILITARYAISTRATEGY_AT_WAR</AIMilitaryStrategyType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>-20</Flavor>
</Row>
<Row>
<AIMilitaryStrategyType>MILITARYAISTRATEGY_WAR_MOBILIZATION</AIMilitaryStrategyType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>-50</Flavor>
</Row>
I've been focusing a lot on improving the AI in recent weeks, and recently discovered this surprise! It basically blocks AIs at war from training settlers, and discourages use of Liberty and Order policies.
I do get what the programmer was trying to accomplish here. They were likely thinking... the AI should focus on one thing at a time, so if at war focus entirely on winning the war, not building new cities. The problem is if a human declares war on an AI, the human can just sit there doing nothing with an endless war while the AI cripples its own expansion. Or an AI might end up shuffling from one war to the next and never get any cities built. It really explains some behavior I've seen where militaristic AIs get "stuck" with just one or two cities if they go to war too early. I'm messing around with the values in the AI files a lot lately and doing extensive testing, so hopefully we can see it make better decisions in the next beta cycle.
glider1 Oct 06, 2011, 07:04 PM Wow had not thought of that. Was thinking the AI is getting stuck because of some computation bug in choosing expansion sites. Here are other references to FLAVOR_EXPANSION to get a feel for the scale of the iValue weights:
CIV5AIStrategies:
<Row>
<AICityStrategyType>AICITYSTRATEGY_TINY_CITY</AICityStrategyType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>-100</Flavor>
</Row>
<Row>
<AICityStrategyType>AICITYSTRATEGY_HAVE_TRAINING_FACILITY</AICityStrategyType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>-3</Flavor>
</Row>
<Row>
<AICityStrategyType>AICITYSTRATEGY_CAPITAL_NEED_SETTLER</AICityStrategyType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>250</Flavor>
</Row>
<Row>
<AICityStrategyType>AICITYSTRATEGY_CAPITAL_UNDER_THREAT</AICityStrategyType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>-25</Flavor>
</Row>
<Row>
<AICityStrategyType>AICITYSTRATEGY_MEDIUM_CITY_HIGH_DIFFICULTY</AICityStrategyType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>10</Flavor>
</Row>
Standout values:
AICITYSTRATEGY_CAPITAL_NEED_SETTLER! (iValue=250)
AICITYSTRATEGY_CAPITAL_UNDER_THREAT (iValue=-25)
AICITYSTRATEGY_MEDIUM_CITY_HIGH_DIFFICULTY (iValue=10)
glider1 Oct 06, 2011, 08:02 PM <Row>
<AIEconomicStrategyType>ECONOMICAISTRATEGY_EARLY_EXPANSION</AIEconomicStrategyType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>75</Flavor>
</Row>
<Row>
<AIEconomicStrategyType>ECONOMICAISTRATEGY_ENOUGH_EXPANSION</AIEconomicStrategyType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>-30</Flavor>
</Row>
<Row>
<AIEconomicStrategyType>ECONOMICAISTRATEGY_NEED_HAPPINESS</AIEconomicStrategyType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>-10</Flavor>
</Row>
<Row>
<AIEconomicStrategyType>ECONOMICAISTRATEGY_NEED_HAPPINESS_CRITICAL</AIEconomicStrategyType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>-100</Flavor>
</Row>
<Row>
<AIEconomicStrategyType>ECONOMICAISTRATEGY_EXPAND_TO_OTHER_CONTINENTS</AIEconomicStrategyType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>50</Flavor>
</Row>
<Row>
<AIEconomicStrategyType>ECONOMICAISTRATEGY_EXPAND_LIKE_CRAZY</AIEconomicStrategyType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>10</Flavor>
</Row>
<Row>
<AIEconomicStrategyType>ECONOMICAISTRATEGY_GS_CULTURE</AIEconomicStrategyType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>-10</Flavor>
</Row>
<Row>
<AIEconomicStrategyType>ECONOMICAISTRATEGY_GS_SPACESHIP</AIEconomicStrategyType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>20</Flavor>
</Row>
<Row>
<AIEconomicStrategyType>ECONOMICAISTRATEGY_NAVAL_MAP</AIEconomicStrategyType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>10</Flavor>
</Row>
Standout values:
ECONOMICAISTRATEGY_EARLY_EXPANSION (iValue=75)
ECONOMICAISTRATEGY_NEED_HAPPINESS_CRITICAL (iValue=-100)
glider1 Oct 06, 2011, 08:05 PM <Row>
<AIGrandStrategyType>AIGRANDSTRATEGY_CONQUEST</AIGrandStrategyType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>1</Flavor>
</Row>
<Row>
<AIGrandStrategyType>AIGRANDSTRATEGY_CULTURE</AIGrandStrategyType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>-2</Flavor>
</Row>
<Row>
<AIGrandStrategyType>AIGRANDSTRATEGY_SPACESHIP</AIGrandStrategyType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>1</Flavor>
</Row>
The values are very small!
glider1 Oct 06, 2011, 08:09 PM <Row>
<AIMilitaryStrategyType>MILITARYAISTRATEGY_EMPIRE_DEFENSE</AIMilitaryStrategyType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>-10</Flavor>
</Row>
<Row>
<AIMilitaryStrategyType>MILITARYAISTRATEGY_EMPIRE_DEFENSE_CRITICAL</AIMilitaryStrategyType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>-20</Flavor>
</Row>
<Row>
<AIMilitaryStrategyType>MILITARYAISTRATEGY_AT_WAR</AIMilitaryStrategyType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>-20</Flavor>
</Row>
<Row>
<AIMilitaryStrategyType>MILITARYAISTRATEGY_WAR_MOBILIZATION</AIMilitaryStrategyType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>-50</Flavor>
</Row>
<Row>
<AIMilitaryStrategyType>MILITARYAISTRATEGY_LOSING_WARS</AIMilitaryStrategyType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>-50</Flavor>
</Row>
Values as per the first post ranging -50 to -10 for military strategies
glider1 Oct 06, 2011, 08:12 PM <Row>
<CitySpecializationType>CITYSPECIALIZATION_SETTLER_PUMP</CitySpecializationType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>30</Flavor>
</Row>
<Row>
<CitySpecializationType>CITYSPECIALIZATION_MILITARY_TRAINING</CitySpecializationType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>-4</Flavor>
</Row>
<Row>
<CitySpecializationType>CITYSPECIALIZATION_EMERGENCY_UNITS</CitySpecializationType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>-4</Flavor>
</Row>
<Row>
<CitySpecializationType>CITYSPECIALIZATION_MILITARY_NAVAL</CitySpecializationType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>-4</Flavor>
</Row>
<Row>
<CitySpecializationType>CITYSPECIALIZATION_PRODUCTION_WONDER</CitySpecializationType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>-4</Flavor>
</Row>
<Row>
<CitySpecializationType>CITYSPECIALIZATION_PRODUCTION_SPACESHIP</CitySpecializationType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>-4</Flavor>
</Row>
<Row>
<CitySpecializationType>CITYSPECIALIZATION_COMMERCE</CitySpecializationType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>-4</Flavor>
</Row>
<Row>
<CitySpecializationType>CITYSPECIALIZATION_SCIENCE</CitySpecializationType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>-4</Flavor>
</Row>
<Row>
<CitySpecializationType>CITYSPECIALIZATION_GENERAL_ECONOMIC</CitySpecializationType>
<FlavorType>FLAVOR_EXPANSION</FlavorType>
<Flavor>-4</Flavor>
</Row>
Standout values:
CITYSPECIALIZATION_SETTLER_PUMP (iValue=30)
all the rest simply -4!
glider1 Oct 06, 2011, 08:23 PM The assumption is that all the values above are part of the same algorithm in the core that does the maths on the weights in one place? Issues are:
-> It's really hard without being able to see the code
-> Does the core add multipliers to the XML weights that are hard coded and skew the XML?
-> Is it possible to adjust some of these weights in Lua dynamically? (that would be nice)
So summary appears to be that the range for FLAVOR_EXPANSION is {-100, +250}. There are other references to flavor_expansion for each leader, for policies, buildings, technologies and for city states. There do seem a lot of values that haven't actually even been adjusted because of side effects that the developers were conservative about for good reason.
If the weighting cannot be adjusted dynamically in Lua, it might be possible to isolate a case that covers Japan's situation in the last GotVEM somehow where the poor civ might have had a lot of confounding problems. Did Japan need happiness badly while simultaneously being at war but also wanting to expand rapidly? But did it also have a particular building or policy that was holding it back at the same time?
Cheers
NOTE: As a side line, notice that city states can be encouraged to expand in the XML?
Thalassicus Oct 06, 2011, 08:24 PM The values are stored in the main database, which cannot be altered ingame. Only the c++ game core can interact with or change those values ingame. Outside of the game however, I've altered some of these in the past, and am testing out a few new changes for the next beta.
glider1 Oct 06, 2011, 10:00 PM What would FLAVOR_EXPANSION be weighted against is another question. I guess that depends on what the other FLAVOR'S are. FLAVOR_CITY_DEFENSE is an interesting one. Maybe when the AI is in multiple wars issues as it was in GotVEM #2, that the weighting for city_defense is swamped by some other need? Is the FLAVOR_CITY_DEFENSE the weighting that affects whether walls get built? (Doesn't matter, just thinking out loud)
<Row>
<AIMilitaryStrategyType>MILITARYAISTRATEGY_AT_WAR</AIMilitaryStrategyType>
<FlavorType>FLAVOR_CITY_DEFENSE</FlavorType>
<Flavor>20</Flavor>
</Row>
Cheers
Thalassicus Oct 07, 2011, 02:04 AM Yes, the only thing with a flavor_city_defense are walls/castle/etc. One thing I've been pondering recently is if it's possible to add new flavors without core access... the tools seem to be here. I plan to try making a flavor_siege for catapults/trebs/etc. There's a big difference between this and flavor_ranged! Archers are good on either offense or defense... while in VEM, siege units are primarily for offense.
Ahriman Oct 07, 2011, 08:29 AM It seems like the problem is that the expansion flavor reduction triggers mainly from while being at a state of war, rather than when actually engaged in warfare.
In a perfect world, what we would do would be to change the trigger to something based on some kind of proxy for a "real" war as opposed to phony war; ranged attacks or melee attacks happening in recent turns, enemy land units present in your territory, units being lost, AI units being present in enemy territory, etc.
Its a fine line to walk. We wouldn't want the AI to keep trying to expand normally during warfare, because it needs the happiness for any cities it conquers, and we don't want it building settlers instead of military units.
GamerKG Oct 07, 2011, 01:06 PM It seems like the problem is that the expansion flavor reduction triggers mainly from while being at a state of war, rather than when actually engaged in warfare.
In a perfect world, what we would do would be to change the trigger to something based on some kind of proxy for a "real" war as opposed to phony war; ranged attacks or melee attacks happening in recent turns, enemy land units present in your territory, units being lost, AI units being present in enemy territory, etc.
Its a fine line to walk. We wouldn't want the AI to keep trying to expand normally during warfare, because it needs the happiness for any cities it conquers, and we don't want it building settlers instead of military units.
Why not use flavor values of leaders for this? If they are more militaristic, then winning that war is more important to them and their strategy so they should want that, and if it is a defensive peaceful civ then perhaps they are willing to forgo building more units and instead continue peacefully?
And set a threshold (with flavor) for how many units is "enough". Probably use enemies in sight, production capabilities, and whatever else AI normally uses when making its decisions (policies, techs, money, etc)
glider1 Oct 07, 2011, 04:15 PM That is pretty powerful that you can add your own flavors. I guess the issue is that the game will slow down because it has to consult Lua to use new flavors? Perhaps the developers were thinking of the kinds of flavors that modders would use for the occasional new unit type, rather than for the commonly found units in the game. Maybe the slowdown would not be significant?
Cheers
Thalassicus Oct 07, 2011, 04:17 PM @Ahriman
There's multiple sets of military strategies, including:
Preparing for war.
At war.
Winning wars.
Losing wars.
In addition there are "low happiness" and "critical happiness" AI strategies. We have a lot of flexibility here, so we should be able to find a combination that handles expansion well.
@GamerKG
Militaristic leaders can better defend their new holdings than peaceful leaders. If a peaceful leader with a small army overexpands and provokes a war, they will lose the cities, and suffer diplomatic penalties with other leaders ("you're building cities too fast!"). The goal of a militaristic leader is to take the map through military or other means, so it seems appropriate for them to expand aggressively.
With the four personality types (http://forums.civfanatics.com/showthread.php?p=10166244#post10166244):
http://forums.civfanatics.com/attachment.php?attachmentid=292499&stc=1&d=1307825035
Essentially the leaders get cities in different ways, self-founded vs citystates. Conquerors and Expansionists spend more on expansion, while Cultural and Coalition leaders spend on citystates.
The expansion flavors in order of personality type are: 7, 6, 4, 5 (flavor 5 is the average default).
GamerKG Oct 07, 2011, 04:44 PM Well I don't know if all militaristic leaders should try to take the WHOLE map through conquest (aka Domination), perhaps there should be a flavor threshold for that as well.
|
|