Logo Platform
logo amplifiers simplified

AI parameters need some Help

Reply
Copied to clipboard!
9 years ago
Nov 27, 2015, 9:26:27 AM
Hello,



I will need some help about AI parameters.

Some points I need to understand to "unlock" me, and permit me to do it by myself.



Beginning by some asks about military AI parameters.



After to read this in game files :

[CODE]



$(Input) * 4 * $SumProperty(ClassEmpire/ClassCity/Garrison/ClassUnit:AttributeAttack)

[/CODE]



I need to make a parameters giving "flat" bonus. Let's say, I don't want to give +10% attack, but give attack +8.

After reading some files of AIparameters food, industry, etc, I saw that "percent" parameters use "$SumProperty", and flat use "$Count".

I did this :



[CODE]



$(Input) * 4 * $Count(ClassEmpire/Garrison/ClassUnit)

[/CODE]



Is it good ? if yes, I will decline it for others attributes.





More tricky, I've made many combinations in my improvement, and can't make AI parameters for all the stuff.

My goal here, is too make formulas and calculations in the AI technology file, rather in the AI converter file.



So first, I've made a generic AI converter :

[CODE]



$(Input)

[/CODE]



in Simulation\SimulationDescriptors[Technology].xml, my tech do that :



[CODE][/CODE]



It just tell : all my Infantery units get a Intiative percent bonus equal to their own Vision Range.



So in my @path=AI\AIParameters[Technology_Era1].xml, i did this :

[CODE]





[/CODE]



Why 5 ? Because in converters files, attack/defense is 4, damage is 6, and I think Initiative is a good attribute, better than attack but weaker than damage.



I'm not sure this formula work well. First the "ClassUnit,UnitClassInfantry:VisionRange" , I hope the filter is well write.

Second, I've put another $SumProperty on vision, I'm not sure it's the good way. Maybe I should take something like "average vision of all infantery units", but don't know how to do this if it's what it should be done.



I will probably post new questions abouts AI parameters, but for now, solving these 2 cases can really help me, because I've a lot of tech/improvement it will use this kind of stuff.



Thanks, cheers!
0Send private message
9 years ago
Dec 2, 2015, 1:30:36 PM
Enchanteur wrote:
Hello,



I need to make a parameters giving "flat" bonus. Let's say, I don't want to give +10% attack, but give attack +8.

After reading some files of AIparameters food, industry, etc, I saw that "percent" parameters use "$SumProperty", and flat use "$Count".

I did this :



[CODE]



$(Input) * 4 * $Count(ClassEmpire/Garrison/ClassUnit)

[/CODE]



Is it good ? if yes, I will decline it for others attributes.



Yeah, that makes sense. The estimation in the original AI parameter is that 1 attack is worth 4 military power, so adding 4 attack to each unit in the empire means an increase in empire military power of 4 times the number of units.





Enchanteur wrote:


More tricky, I've made many combinations in my improvement, and can't make AI parameters for all the stuff.

My goal here, is too make formulas and calculations in the AI technology file, rather in the AI converter file.



So first, I've made a generic AI converter :

[CODE]



$(Input)

[/CODE]



in Simulation\SimulationDescriptors[Technology].xml, my tech do that :



[CODE][/CODE]



It just tell : all my Infantery units get a Intiative percent bonus equal to their own Vision Range.



So in my @path=AI\AIParameters[Technology_Era1].xml, i did this :

[CODE]





[/CODE]



Why 5 ? Because in converters files, attack/defense is 4, damage is 6, and I think Initiative is a good attribute, better than attack but weaker than damage.



I'm not sure this formula work well. First the "ClassUnit,UnitClassInfantry:VisionRange" , I hope the filter is well write.

Second, I've put another $SumProperty on vision, I'm not sure it's the good way. Maybe I should take something like "average vision of all infantery units", but don't know how to do this if it's what it should be done.




Well if it's giving you one initiative per 100 vision, and if one initiative is worth 5 military power (seems about right, military power is just an abstract indicator for the AI anyway not a "real" value) then it should be:

[CODE]





[/CODE]



Note that it's ClassEmpire or EmpireTypeMajor, not ClassCity, for technology.



I'm not sure many units will have sufficient vision to really benefit from this though...
0Send private message
9 years ago
Dec 2, 2015, 7:42:07 PM
Hi, thanks for the aswer.



Since , I worked a little more on this.



I saw in vanilla AIparameters this :

[CODE]

$(Input) * 4 * $SumProperty(ClassEmpire/ClassCity/Garrison/ClassUnit:AttributeAttack)

[/CODE]

It's a "normal" converter for a +ATT%. example : ATT + 10%



Translated to Initiative, it give this :

[CODE]

$(Input) * 5 * $SumProperty(ClassEmpire/ClassCity/Garrison/ClassUnit:AttributeInitiative)

[/CODE]



Logicaly, I need now to give it the right input value. But my value is relative to vision. I can't use a hard value like INI +10%

My reasonement was to find, how many % the ability give.

My conclusion, it's the average Vision of all army infantery troops.

Let's say, I have 3 UnitInfantery, with vision = 6, another one vision = 8, another one vision = 7.

(6+8+7)/3 = 7.

(Or 0.07 as an input percent value).

Then the good value should be INI +7% in this case.



So, in formula, input is :

[CODE]0.01 * $SumProperty(ClassEmpire/Garrison/ClassUnit,UnitTypeInfantery:VisionRange) / $Count(ClassEmpire/Garrison/ClassUnit,UnitTypeInfantery)[/CODE]



and final formula :

[CODE] [/CODE]



Now I start to understand more how AIparameters works. I think it should be possible for me to make alls difficults relatives parameters I need to do, because there is always an exploitable example to start from, in your AI files.

But it's a very big work. I just finished many techs, and give them very aproximatives AIparameters (still work, the AI is ok for schearching my new techs and build improvements). But I want the AI do rights choice, so I will slowly make these parameters one after one.

Sometime, a tech give 4 improvements but only one buildable. Here it will be quite difficult to say AI how it work. At least, I could make an AI parameters for each one, but divise value by 4, the AI will get a global value on tech. After AI will choose best improvement to build because each improvement will have a parameter well made.



In these case, I have another problem : AI build one improvement. There is prerequisite inverted discard on it but also on others improvements when building one of them. So AI should not be able to build them. As player, it work well, after building one, the others diseapers from the list. But for a strange reason, AI try to build them. Maybe AI put all builds on the stack. And after the first one, other can't be completed. They stay on the stack (but AI can still launch anothers builds), resources are spendt and not "remboursables". I will show more on this after a alpha release or demo of the mod, with code example, it's maybe quite difficult to understand what I mean here.



Thanks
0Send private message
9 years ago
Dec 4, 2015, 9:24:04 AM
Remember that you're able to write new converters too if you need them, it's just that you can only have one layer of conversion (you can't convert something that is then converted into something else).



For for example this would be one possibility:



[CODE]



[/CODE]

[CODE]



$(Input) * 5 * $SumProperty(ClassEmpire/Garrison/ClassUnit:VisionRange)



[/CODE]



This would be another:

[CODE]



[/CODE]

[CODE]



$(Input) * 5



[/CODE]
0Send private message
9 years ago
Dec 7, 2015, 12:05:20 PM
Hi, Thanks

Yes, I know how to use it like that. There is some freedom here, because It's possible to choose how many formula to put in a converter, and how many in the AIParameter.
0Send private message
?

Click here to login

Reply
Comment