Logo Platform
logo amplifiers simplified

(even more) AI modding

Reply
Copied to clipboard!
12 years ago
Sep 13, 2012, 10:27:57 AM
In fact, by default, the priority is the military power, but if you force a priority, it will use it. That is not true for the weapon and defense module in the current version, but in the next one, they will act as the support module one. So if you want to change manually their priority but unchanged the military you would be able to.



Yeap, add a ship type modifier could be an improvement... But perhaps you could add it to the ship template...
0Send private message
12 years ago
Sep 7, 2012, 12:18:37 PM
For the support module, this should be based on a "Priority" flag, but I don't see it in the xml... So... hum... well...



I will bind it on the military power by default for the next build, but for now you could just add an attribute "Priority" on the xml module description and normally this will design which module to prefer on each category.



Does it seams clear?
0Send private message
12 years ago
Sep 7, 2012, 1:13:27 PM
It's not big enough of a deal that I consider doing it now when you say you will be changing how it works in the next build anyways. smiley: wink



Don't want to implement all sorts of workarounds for stuff that I know is going to be fixed anyways.



But still nice to know how it should work and how it will work after the patch. That shall allow to make some really, really good ship-designs for the AI.



Another thing that bothers me would be how the AI decides which weapon they use when designing ships.



It seemed pretty random during war but during the long peace-time every single design of both remaining AIs in my last big test-game wielded Missiles where I had expected it to be a little more random. (That of course was with templates that only had 1 weapon-type)
0Send private message
12 years ago
Sep 7, 2012, 2:05:27 PM
Ail wrote:
It's not big enough of a deal that I consider doing it now when you say you will be changing how it works in the next build anyways. smiley: wink



Don't want to implement all sorts of workarounds for stuff that I know is going to be fixed anyways.


Yeah that's a good point...



Ail wrote:


Another thing that bothers me would be how the AI decides which weapon they use when designing ships.



It seemed pretty random during war but during the long peace-time every single design of both remaining AIs in my last big test-game wielded Missiles where I had expected it to be a little more random. (That of course was with templates that only had 1 weapon-type)




Module choice is "more or less" based on enemy design. When the AI had a battle with some other fleets, it will remembers its weapon and defense effectiveness and try to privilegiate the more effective weapon and defense for its own ships. If the ai spot that you don't have any defense in kinetic, it will choose this weapon for the future ships. When the AI compute that the missile are pointless because you have many defenses, it will choose any other weapon as better. etc.



When at peace, the AI will simply choose the weapon with the most military power.

I think that missile must have the bigger ones, so when you have same level of kinetic, laser and missile, the AI will choose the missile one... But I am not sure about that last point.
0Send private message
12 years ago
Sep 7, 2012, 2:23:55 PM
So the AI actually does take into account what it had encountered!



That's a point we've been wondering about since ages! So that's really great to hear!



I think this will make the ... let me call it Iblise-Template-idea a very good option for the AI.



The basic idea is to have all types of defenses but not at an equal level but at a 3:2:1 ratio. And then have one template with 1 weapon-type and another template with 2 weapon types and a 3:2 or 2:1 ratio of them.



Now when we know that the AI actually does react to designs, this approach will warant way more diversity than the plain and simple 1:1:1-Omni-Defense without having the same weakspots as the original designs (which is Omni-Weapon because it will always leave at least one weakness in its designs).
0Send private message
12 years ago
Sep 7, 2012, 6:18:53 PM
Haha



Actually I did know that the AI ship design reacted based on enemy ship design to min max weapon design. I'm not sure how it handles multiple fronts at war though. Enemy 1 has lasers and no flak. Enemy 2 has kinetics and no shields. Does missiles and lasers with shields and deflectors or just choose either enemy 1 or 2?
0Send private message
12 years ago
Sep 7, 2012, 11:51:25 PM
Even better would be if the Defense Minister above could push to the Economy Minister specific designs to specific systems to counter the race that system cluster had a frontier with...
0Send private message
12 years ago
Sep 10, 2012, 7:55:52 AM
Yeah that is the "next big improvement" we could do on the Military front. For now, the ship design are managed as a whole and not based on each war front.



We could also destroy the "Colonizer" ship design in a latter game as it will not be used anymore... So you can have another slot for war purpose.



In fact, I think that the military minister (or defense minister as you prefer ^^) need to handle some "Armada" principle which is not the case for the moment. So you can design up to 3 or 4 ship for each armada and create fleets based on these ship designs. With this solution you can assign the armada to an enemy empire and adapt your ship to it.



But well, I am afraid that will take a little time to be done and I am not sure this is really high priority for now... I will try to push it up... We will see ^^
0Send private message
12 years ago
Sep 11, 2012, 9:27:32 PM
ThorTillas wrote:
For the support module, this should be based on a "Priority" flag, but I don't see it in the xml... So... hum... well...



I will bind it on the military power by default for the next build, but for now you could just add an attribute "Priority" on the xml module description and normally this will design which module to prefer on each category.



Does it seams clear?


After adding them like this:




SupportCategory="Armor">



it worked. Important to notice: Higher priority will be used first. (I first did it wrong and it used the weakest armor on all ships)
0Send private message
12 years ago
Sep 13, 2012, 7:42:22 AM
Yes you are right... Sorry to not mentioned that earlier...



This is due to the military power priority... As you have to choose the module with more military power first, I reverse the normal "priority" sorting...
0Send private message
12 years ago
Sep 13, 2012, 9:13:37 AM
ThorTillas wrote:
Yes you are right... Sorry to not mentioned that earlier...



This is due to the military power priority... As you have to choose the module with more military power first, I reverse the normal "priority" sorting...


Now that I see how this works I'd actually argue against changing it to sort by military power.

Making this variable visible in the XML so every modder can see it without having to have read this thread would probably be better.



It would be even better to have a priority per ship-type because on a destroyer with bonus on weapon-mods a power-support that increases damage would make more sense than on a medium-ship with a bonus on defense-slots.
0Send private message
12 years ago
Sep 7, 2012, 9:29:02 AM
Hi there!



I'll try to ask another question right here...



How does the AI decide what modules it uses when it can select from a number of them?

In my mod I assigned 20% or so of the tonnage to be used by Armor-Modules.



This works but the AI won't use the best ones nor the 2nd best ones.



I've tried increasing the MP-in order to deceive them to using the better ones. Did not work.



Now I think that they might actually make a price:effect calculation to decide what to use.



And if that is the case, they appearantly take the unmodified price.



The best armor-module needs Adamantium. So it gets cheaper by up to 60% with 4 or more stacks of Adamantium.

Granted the AI in question has like 8 of them, they receive the full bonus making it almost as cheap as the way weaker but 2 generations lower 3rd best armor-module.



In my opionion they should not care about the price at all. Tonnage-efficiency should be the deciding factor here.

And 220 HP + 11% HP on 25 Tons certainly beats 110 HP + 5% HP on 18 Tons all the time.





For the power-modules I'd also like to specify the priority which one they use same for the repair-modules. Is there a way to do that by messing around with the MP-values or so?
0Send private message
12 years ago
Sep 13, 2012, 7:51:38 PM
So you can and still will be able to "override" the MP-Default with the priorities, if you so desire?
0Send private message
12 years ago
Sep 14, 2012, 7:52:33 AM
correct !



(and now I need to fill the post to be able to post it... damned security...)
0Send private message
12 years ago
Sep 15, 2012, 1:34:33 PM
Could you please explain in detail how the values in DiplomaticAttitudeModifier.xml work?



Let's take one example:



Here's what I think what the parameters do:

Value: As soon as a Modifier triggers this is the starting value.

ValueRange: Lowest possible value:Highest possible value for any given modifier

Trend: This is added to Value every turn

TrendRange: Limits in which the trend can be... Here I would be really interested what actually affects this.

TrendWeightingCoef: Don't really know

ValueWeightingCoef: Don't really know either



And in Personality.xml there's stuff like that:





Sound like multipliers for the things in the above xml. I suppose a "0" here will cause them to ignore a Trigger for a specific Modifier.



My basic goal why I ask is that I want to make the AI more aggressive but without taking away the racial characteristic or going too far. I already had experimented with this but it did not feel really good.



Here's a specific example:

I want the Relationship-Bonus for common enemies to start high but go down over time.

So I changed:





I was expecting that to cause the Value to slowly go down. But it doesn't. What am I missing?



Edit: Apparently it does get reduce over time but much slower than I expected.



Edit2: Apparently it decays while the Empire in question is still alive but stops decaying when it is dead... that is very illogical. :\
0Send private message
12 years ago
Sep 15, 2012, 7:07:53 PM
Now I managed to completely cripple the AI by messing around with this:



[code]



0.5



1.1



0.7





1



1



1

[/code]

They made so many ships that they could not pay the maintainance anymore, increased their tax to 90%-100% and then hat Revolts all over the place.

The original Intention was to get them to make more ships in the lategame when there's nothing left to be build and they have plenty of Dust anyways.



If I'd be asked to word an algorithm about how they should actually behave it would be:



[code]

if(EmpireApproval>=80)

{

MilitaryShipPriority=DevelopmentPercent/2;

}

else if(EmpireApproval>=20)

{

MilitaryShipPriority=DevelopmentPercent/4;

}

else

{

MilitaryShipPriority=0;

}

[/code]

This shall allow the AI to produce a lot of ships when it's doing well and completely halt ship production (and thus allow Ind=>Dust) when the taxes are too high.

A fully developed System should have a Priority of 0.5 which shall always beat Ind=>Dust but usually shall not beat regular buildings.

This is basically the same thing that I do. When I can't increase tax any further because it would reduce Approval too much, I build Ind=>Dust and no more ships.



Edit: Another idea... I could massively crank up the value for Ind=>Dust and give it an AIPathPrerequisite that prevents it from being build when the Approval is okay! If this works it would fix the bankrupcy/revolt problem and still allow the AI to build all the ships they can maintain. This is assuming the AI will automatically reduce the Tax-rate once it has enough income from Ind=>Dust.
0Send private message
12 years ago
Sep 16, 2012, 12:36:56 AM
It seems to work!



[CODE]



[/CODE]

+

[CODE]

StarSystemConversionIndustryToDust



$(../ClassEmpire:Approval) le 60 or $(../ClassEmpire:MoneyNet) lt 0[/CODE]

+

[CODE]

0.5



1.1



0.7





1



1



1[/CODE]

=

AI builds tons of ships without going bankrupt/into revolt!

Now I just need to see if it really plays out like I want in a complete game.
0Send private message
12 years ago
Sep 17, 2012, 10:34:50 AM
Ail wrote:
Could you please explain in detail how the values in DiplomaticAttitudeModifier.xml work?



Let's take one example:



Here's what I think what the parameters do:

Value: As soon as a Modifier triggers this is the starting value.

ValueRange: Lowest possible value:Highest possible value for any given modifier

Trend: This is added to Value every turn

TrendRange: Limits in which the trend can be... Here I would be really interested what actually affects this.

TrendWeightingCoef: Don't really know

ValueWeightingCoef: Don't really know either




When a trigger is activated, a new modifier is created with "Value" as starting value. Each turn "Trend" is added to this value. But the sum of all modifier of a same type is clamped between "ValueRange" (same thing for TrendRange).



For example :





4 exchanges finished at the same turn, 4 modifiers of type "DiplomaticAttitudeModifierPastExchanges" are created with value 15. So the sum of all DiplomaticAttitudeModifierPastExchanges is 60, this value is clamped to 50.

Next turn, all this modifiers must be decreased of 0.5 (total -2) but there is a TrendRange of -1. The trend is distributed to all modifiers (-1 / 4 = -0.25), so the value of each modifiers at this turn is 14.75, for a sum of 59 clamped to 50.



TrendWeightingCoef and ValueWeightingCoef are here for some specific cases. Some modifiers use a specific formula.

For example :



the final value of the modifier is : FinalValue = Value + (number of turns since the start of term) * ValueWeightingCoef.

All this formulas are wrote in the xml comment.



It's also possible to create curve with all modifiers except those who have TrendWeightingCoef and ValueWeightingCoef.



Example :













Ail wrote:


And in Personality.xml there's stuff like that:





Sound like multipliers for the things in the above xml. I suppose a "0" here will cause them to ignore a Trigger for a specific Modifier.





This coefs are multipliers of the original values so you're right, "0" will ignore an attitude modifier.



I hope my explanations will help you smiley: smile
0Send private message
12 years ago
Sep 17, 2012, 2:25:49 PM
Yes, this explains why in some cases the number for "common-enemy" would not drop. They probably were 4 in reality and 4x30 exceeds the 90. So it would only drop below 90 once the "real" number also dropped below 90.



About the other issue I brought up: I think I just found out that my whole changes will become pretty pointless with the new maintainance-costs. Having a big standing army then will never be too good.
0Send private message
12 years ago
Dec 3, 2012, 9:38:45 PM
Since I've seen more occurances of the Rebellion/Bankrupcy/Starvation-Issue even now in 1.0.38 where the AI will stop making ships if their Approval drops to low, I started to think what else can cause it...

The result of this though-process was pretty easily forseeable: The ships they already had!



The issue has changed a bit. The AIs didn't knock them out completely so hard anymore. Less were affected and those sometimes showed signs of recovery but then dropping back to the crisis.



Now I've found a new approach to fight this issue.



There is a file in the Public-Folder that has received little attention thus far.

I'm talking about BailiffDistrainee.xml.



The purpose of this file is to define the order of scrapping stuff. Unfortunately it isn't documented in the slightest so I could only guess what it does.

Didn't prevent me from playing around with it.



And that's where you come into play. I'd like everyone to just try out the modded version of the file. Purpose is: "Scrap Military before buildings."

My first test looks promising. But I want to gather more data more quickly.



So here's the one-file mod. Feel free to merge it with other mods (should be doable in any case since I highly doubt any other mod has done something with that strangely-named file).
Bailiff.zip
0Send private message
?

Click here to login

Reply
Comment