jdog5000
Revolutionary
(**Mild spoilers**: This thread describes a new system for having the AI play to win the game and which AI personalities will be more likely to try for certain victory types. Any detailed info I post about specific triggers or strategies the AI uses will be wrapped in spoiler tags)
The new playing to win system is rounding into form and will be a part of releases 0.90 and higher. With this system, the AI will (finally) have two new fundamental abilities:
1) A strategy to aim for one or more of the available victory types.
2) An awareness of whether the other players around it are close to winning in a particular way.
There have been patchwork pieces of this before, but now it will be much more thorough and really influence the actions the AI takes from the mid-game on. Of course there will be XML options to turn this off, but in my mind it's one of the biggest possible steps forward for the AI in terms of making the game more exciting and strategic.
The AI will have strategies to go for Conquest, Domination, Culture, Space, and Diplomatic victories. Each of these victory strategies is modeled off of how Blake set up the Cultural victory strategy in the Warlords Better AI project (which was eventually folded in to BTS). For each victory strategy the AI will have 4 levels measuring how committed they are to the strategy.
- The first two levels of each strategy (ie, Conquest1 and Conquest2) are for somewhat randomized tendencies for the AI leader. Since this is new, there are going to be new variables in XML to control how likely an AI is to try the early levels of these strategies (and you can help pick them!).
- The upper two levels (ie, Conquest3 and Conquest4) measure when a player is closing in on a particular victory condition. They do not require the AI to have run a lower level strategy, but the lower levels are designed to put an AI in a position to adopt the higher level one. These levels also have no random component and no AI personality component, but instead are based on in past game actions and measurables like power or culture. An AI will only run one level 4 strategy at a time.
Here's how I'm planning to have the randomized tendencies work for the first level of each victory strategy:
iValue = Leader personality value for victory type from 0 to 100
iValue += Random dice roll from 0 to 99
if( iValue >= 100 )
. AI starts level 1 for this victory strategy
So, if the AI tendency value is 0 then it will never adopt it, if it's 100 then it will in 100% of games. The random dice roll is done in a very particular way. A random number between 1000 and 10,000 is drawn once for each player per game and saved. Then the five dice rolls are set up so that the AI will have a spectrum of random values:
Culture dice roll = (strategy rand + 10) % 100
Conquest dice roll = (strategy rand + 30) % 100
Space dice roll = (strategy rand + 50) % 100
Domination dice roll = (strategy rand + 70) % 100
Diplomacy dice roll = (strategy rand + 90) % 100
where % is the modulus, ie the remainder after division by in this case 100. So, an AI might get 90 from the random roll for domination, 10 for diplomacy, 30 for culture, 50 for conquest, and 70 for space, but whatever the specifics it will always have one strategy with a random 80+, one with <20, and the rest in between. The reasoning behind this is that each AI should start at least one of these first level victory strategies from the beginning of the game, and maybe two strategies.
There are a couple adjustments for special game options, like Aggressive AI means AIs are more likely to adopt militaristic strategies (+30), while always peace rules out militaristic ones and boosts culture and space (+40).
Picking values for a leader
So, for each leader we need to pick 5 numbers to set their natural affinity for each victory type. Here's how the distribution of tendencies should work:
- 0 is an extreme value, meaning the AI will never do a strategy in a normal game. These should be very rare.
- 30 is a good middle for the distribution and represents an average affinity for the victory type.
- 70 is also an extreme value for a normal game, they should be very rare.
- Each leaders 5 values should add up to 150, so that on average they start a game adopting 1.5 victory strategies at level 1.
As for what makes sense for a particular AI, Civ4 been around long enough for the community to know which leaders are good/decent/bad for different game styles. Having traits which play into a particular strategy certainly helps as do other AI characteristics like their odds for war and building units. Historical actions by the leaders may also be relevant.
The new playing to win system is rounding into form and will be a part of releases 0.90 and higher. With this system, the AI will (finally) have two new fundamental abilities:
1) A strategy to aim for one or more of the available victory types.
2) An awareness of whether the other players around it are close to winning in a particular way.
There have been patchwork pieces of this before, but now it will be much more thorough and really influence the actions the AI takes from the mid-game on. Of course there will be XML options to turn this off, but in my mind it's one of the biggest possible steps forward for the AI in terms of making the game more exciting and strategic.
The AI will have strategies to go for Conquest, Domination, Culture, Space, and Diplomatic victories. Each of these victory strategies is modeled off of how Blake set up the Cultural victory strategy in the Warlords Better AI project (which was eventually folded in to BTS). For each victory strategy the AI will have 4 levels measuring how committed they are to the strategy.
- The first two levels of each strategy (ie, Conquest1 and Conquest2) are for somewhat randomized tendencies for the AI leader. Since this is new, there are going to be new variables in XML to control how likely an AI is to try the early levels of these strategies (and you can help pick them!).
- The upper two levels (ie, Conquest3 and Conquest4) measure when a player is closing in on a particular victory condition. They do not require the AI to have run a lower level strategy, but the lower levels are designed to put an AI in a position to adopt the higher level one. These levels also have no random component and no AI personality component, but instead are based on in past game actions and measurables like power or culture. An AI will only run one level 4 strategy at a time.
Here's how I'm planning to have the randomized tendencies work for the first level of each victory strategy:
iValue = Leader personality value for victory type from 0 to 100
iValue += Random dice roll from 0 to 99
if( iValue >= 100 )
. AI starts level 1 for this victory strategy
So, if the AI tendency value is 0 then it will never adopt it, if it's 100 then it will in 100% of games. The random dice roll is done in a very particular way. A random number between 1000 and 10,000 is drawn once for each player per game and saved. Then the five dice rolls are set up so that the AI will have a spectrum of random values:
Culture dice roll = (strategy rand + 10) % 100
Conquest dice roll = (strategy rand + 30) % 100
Space dice roll = (strategy rand + 50) % 100
Domination dice roll = (strategy rand + 70) % 100
Diplomacy dice roll = (strategy rand + 90) % 100
where % is the modulus, ie the remainder after division by in this case 100. So, an AI might get 90 from the random roll for domination, 10 for diplomacy, 30 for culture, 50 for conquest, and 70 for space, but whatever the specifics it will always have one strategy with a random 80+, one with <20, and the rest in between. The reasoning behind this is that each AI should start at least one of these first level victory strategies from the beginning of the game, and maybe two strategies.
There are a couple adjustments for special game options, like Aggressive AI means AIs are more likely to adopt militaristic strategies (+30), while always peace rules out militaristic ones and boosts culture and space (+40).
Picking values for a leader
So, for each leader we need to pick 5 numbers to set their natural affinity for each victory type. Here's how the distribution of tendencies should work:
- 0 is an extreme value, meaning the AI will never do a strategy in a normal game. These should be very rare.
- 30 is a good middle for the distribution and represents an average affinity for the victory type.
- 70 is also an extreme value for a normal game, they should be very rare.
- Each leaders 5 values should add up to 150, so that on average they start a game adopting 1.5 victory strategies at level 1.
As for what makes sense for a particular AI, Civ4 been around long enough for the community to know which leaders are good/decent/bad for different game styles. Having traits which play into a particular strategy certainly helps as do other AI characteristics like their odds for war and building units. Historical actions by the leaders may also be relevant.