Thunderbrd
C2C War Dog
I have a number of projects regarding AI to flesh out the combat mod in preparation for eventual full use. I was thinking about how to go about some of these and realized I should probably bring each up here and let us discuss the best ways to implement them.
Not wanting to address everything at once, I figure its a good idea to keep focused on one issue at a time.
So to get started, I'm thinking the first issue to address is Equipment.
In review:
Currently Equipments are delivered to qualifying (usually by combat class) units by buildings when tech and resource requirements are met. If such a unit is built from a city or moves into a city offering a particular Equipment promo, the unit will automatically pick up the Equipment.
Equipments work along Promotion Lines. Equipments of higher Line Priorities than what exists on a local unit will automatically replace the Equipments those units have in the same Promotion Line. (assuming qualified to receive the better promo.)
I've just finished including a feature that allows us to have multiple Equipment Promotions on the same Promotion Line rating at the same Line Priority (representing promotions that are filling the same kind of slot, for example, arrows, but are equivalent to each other, not better or worse but different in effective benefits/penalties.)
Lateral Equipment choices like this allow a unit with an Equipment Promotion that exists in a city that offers such an equivalent (and equally qualified for) selection to choose to switch promotions. Thus, for example, a Unit that has Steel Arrows (Arrow Promotion Line) can switch to Flaming Steel Arrows (Arrow Promotion line with the same Line Priority as Steel Arrows) if its in a city that offers Flaming Steel Arrows, and toggle back to Steel Arrows as well if the city also offers Steel Arrows.
I've also designed a method by which we can allow units to NOT automatically update to an alternative style in the same line.
A tag for Equipment Promos:<NoAutoEquiptoCombatClassTypes> allows us to define combat classes that, while they may be able to qualify for this equipment promotion, they do not automatically TAKE this promotion if its available, instead requiring a Re-Equip action to select this promotion instead.
Thus we make, say, Flaming Steel Arrows give the SubCombatClass 'Flame Wielders' and give all other arrow types the tag NoAutoEquiptoCombatClassTypes a definition for Flame Wielders so that once an Archery unit selects any Flaming Arrow type Equipment it will wait for an equivalent Flaming Arrow style Equipment without jumping to upgrade as soon as the next basic Arrow equipment level has become available in the city its in.
So.... where's the AI here? There's a few things to consider.
The first AI task that needs to be developed is to get the AI units to recognize when, if those units are not in a city that has just achieved a better equipment than they currently possess and that they can qualify for, it becomes appropriate for them to move to that city for an upgrade. (It seems they need to be in the city at the end of a turn to pick up the upgrade at the beginning of the next turn.)
Then of course, once they recognize that the time is appropriate for them to do so, they need to move to that city for the upgrade and return to whatever they were doing before once they have it.
Now, generally I would assume that most of the time an Equipment upgrade is earliest to be reached along the basic Equipment line path and any alternative equivalent options will either be reached at the same point OR still have something yet to develop thereafter (a building to give access, or a tech still to reach.) Thus, Steel Arrows would probably be available at a particular tech with a fletcher in the city while Flaming Steel Arrows would only be available with an additional prerequisite of a tar pit in the city or access to oil... perhaps even an additional tech, even though you may already have access to Flaming Iron Arrows. Therefore, I would think units that have taken alternative equipments along the same line should only be looking to go out of their way to upgrade along the same type they have now. But at some point they'd still find it worth taking a more advanced alternative option if that's all that's available.
But that's not what I wanted to fully focus on here. No... I first just want to establish WHAT exactly makes it worth pulling the unit out of doing whatever its doing to go out of its way for an upgrade. From what I understand, units begin to act as one larger entity when they are formed into stacks. At what point should the stack act to go get its units upgrades? Obviously the situation the nation is in and the missions the units are on should have a lot to do with it.
So we have a growing positive value, countered by a resistance value (the 'its just not worth it at the moment' value) and a threshold of positive value that must be reached to trigger the unit/stack to move towards available upgrades.
And how do we define it all? In process at least? And I wouldn't mind getting some advice from Koshling here on how to best interface with the current AI structure when applying these evaluations and action commands as well.
Anyhow, ideas and guidance are welcome.
Not wanting to address everything at once, I figure its a good idea to keep focused on one issue at a time.
So to get started, I'm thinking the first issue to address is Equipment.
In review:
Currently Equipments are delivered to qualifying (usually by combat class) units by buildings when tech and resource requirements are met. If such a unit is built from a city or moves into a city offering a particular Equipment promo, the unit will automatically pick up the Equipment.
Equipments work along Promotion Lines. Equipments of higher Line Priorities than what exists on a local unit will automatically replace the Equipments those units have in the same Promotion Line. (assuming qualified to receive the better promo.)
I've just finished including a feature that allows us to have multiple Equipment Promotions on the same Promotion Line rating at the same Line Priority (representing promotions that are filling the same kind of slot, for example, arrows, but are equivalent to each other, not better or worse but different in effective benefits/penalties.)
Lateral Equipment choices like this allow a unit with an Equipment Promotion that exists in a city that offers such an equivalent (and equally qualified for) selection to choose to switch promotions. Thus, for example, a Unit that has Steel Arrows (Arrow Promotion Line) can switch to Flaming Steel Arrows (Arrow Promotion line with the same Line Priority as Steel Arrows) if its in a city that offers Flaming Steel Arrows, and toggle back to Steel Arrows as well if the city also offers Steel Arrows.
I've also designed a method by which we can allow units to NOT automatically update to an alternative style in the same line.
A tag for Equipment Promos:<NoAutoEquiptoCombatClassTypes> allows us to define combat classes that, while they may be able to qualify for this equipment promotion, they do not automatically TAKE this promotion if its available, instead requiring a Re-Equip action to select this promotion instead.
Thus we make, say, Flaming Steel Arrows give the SubCombatClass 'Flame Wielders' and give all other arrow types the tag NoAutoEquiptoCombatClassTypes a definition for Flame Wielders so that once an Archery unit selects any Flaming Arrow type Equipment it will wait for an equivalent Flaming Arrow style Equipment without jumping to upgrade as soon as the next basic Arrow equipment level has become available in the city its in.
So.... where's the AI here? There's a few things to consider.
The first AI task that needs to be developed is to get the AI units to recognize when, if those units are not in a city that has just achieved a better equipment than they currently possess and that they can qualify for, it becomes appropriate for them to move to that city for an upgrade. (It seems they need to be in the city at the end of a turn to pick up the upgrade at the beginning of the next turn.)
Then of course, once they recognize that the time is appropriate for them to do so, they need to move to that city for the upgrade and return to whatever they were doing before once they have it.
Now, generally I would assume that most of the time an Equipment upgrade is earliest to be reached along the basic Equipment line path and any alternative equivalent options will either be reached at the same point OR still have something yet to develop thereafter (a building to give access, or a tech still to reach.) Thus, Steel Arrows would probably be available at a particular tech with a fletcher in the city while Flaming Steel Arrows would only be available with an additional prerequisite of a tar pit in the city or access to oil... perhaps even an additional tech, even though you may already have access to Flaming Iron Arrows. Therefore, I would think units that have taken alternative equipments along the same line should only be looking to go out of their way to upgrade along the same type they have now. But at some point they'd still find it worth taking a more advanced alternative option if that's all that's available.
But that's not what I wanted to fully focus on here. No... I first just want to establish WHAT exactly makes it worth pulling the unit out of doing whatever its doing to go out of its way for an upgrade. From what I understand, units begin to act as one larger entity when they are formed into stacks. At what point should the stack act to go get its units upgrades? Obviously the situation the nation is in and the missions the units are on should have a lot to do with it.
So we have a growing positive value, countered by a resistance value (the 'its just not worth it at the moment' value) and a threshold of positive value that must be reached to trigger the unit/stack to move towards available upgrades.
And how do we define it all? In process at least? And I wouldn't mind getting some advice from Koshling here on how to best interface with the current AI structure when applying these evaluations and action commands as well.
Anyhow, ideas and guidance are welcome.