-
Diplomacy, I wonder...
I've noticed that at the beginning of the desc_campaing_ai_db.xml file, there is this declaration/explanation of variables :
<trusted_ally_fs_threshold float="0.8"/> // min threshold for how much we like the target faction to consider them a trusted ally
<trusted_ally_target_fs_threshold float="0.8"/> // min threshold for how much does the target faction like us to consider them a trusted ally
<trusted_ally_gs_threshold float="0.2"/> // min threshold for how trustworthy is the target faction to consider them a trusted ally
But in the actual code, these thresholds are all set to 999.0. Yet, the trusted ally status is checked a bunch of times, in triggers such as :
<decision_entry>
<!--
If trusted ally, use defaults
-->
<min_entry trusted_ally="true"/>
<faction_attitude can_force_invade="false"/>
</decision_entry>
If I am correct, I think this means the AI does not care for alliances AT ALL in its invasion decisions, or rather that the triggers checking for trusted alliances are effectively neutered. Which would account for much of the diplo grief and non-sensical aggressions.
Has anyone tried setting these variables to the suggested declaration defaults (0.8, 0.8, 0.2) ?
-
Re: Diplomacy, I wonder...
It seems it isn't used. The only time it appears after the initial commentary it says:
Quote:
// GLOBAL AI PARAMS (currently disabled, i.e. range = [-1.0, 1.0]) //
R'as
-
Re: Diplomacy, I wonder...
I think the "currently disabled" comment is intended to make explicit the fact that 999.0 values disable the variable, not that the variable itself is disabled. There are a number of checks along the lines of "if trusted ally = true then can_force_invasion = false". Maybe the trusted ally part is coded elsewhere, but if it does use the thresholds, then the checks will always come out false because they're set to 999.0 instead of working parameters.
I set them to 0.8 0.8 0.2 in my current campaign, and the game hasn't gone ker-klunk because of it, which tells me it's not an unfinished feature like the armour upgrade is.
I'll see wether my stronger alliances really last this time around. If they do... well then we'll have a very good basis for a CherryVanilla Diplomacy mod, using subtle tweaks here and there instead of Shaba Wangy's ten-ton hammer :yes:.
-
Re: Diplomacy, I wonder...
SUCCESS !!!
Not only are these floats implemented, they do just what they say they do : if you are above the thresholds and allied, AI will not invade, period (exceptions listed below).
Here's how I tested it :
- set the floats to -1 -1 -1. Meaning : whatever relations are, all factions consider everyone as trusted allies.
- start a campaign as the HRE, notorious for being gangbanged very fast.
- Made a lot of diplos, and allied with as many factions as possible ASAP (could probably have modded descr_strat.txt to make me start as allied to everyone right off the bat now that I think about it)
- proceeded to destroy my own faction from within. Turned every single city into castle to ruin economy and pop growth. Destroyed every single unit save for family members, whom I pooled in Nurnberg (furthest from any frontline). Gave all treasury to Pope and neighbours. Destroyed every single troop-producing building. In other words, hoisted a big "I'M WEAK ! CRUSH ME !" flag.
Results :
- I end-turned mindlessly through 72 turns before calling it quits.
- I only suffered 3 total attacks: one from Milan on Staufen, one from Venice on Bologne, one from Hungary on Vienna.
- all these settlements were free of troops, so they took them without a fight, but in 2/3 cases I had a diplomat nearby. Told them I'd give ceasefire+trade for the province back, and since I was trusted they accepted, then re-allied next turn. I don't know what caused these invasions at all but I surmise they were mission-driven, as they all happened in the 30th-32th turn, and I know from the .xml that the AI proper only kicks in at turn 30. I waited a few turns before sending a diplomat to Venice in third case, and my "give bologne + peace + trade" was demanding (not very demanding though - they still trusted me) and they wouldn't give it back. I suppose I could have bought it back, but I was very, very bankrupt at that time.
- In those 3 cases, every single other faction I was allied with instantly DoWed the offender, and the pope insta-excommed them. I was their trusted ally, some bugger attacked me, they attacked it as true allies would. The second I re-allied with them, every single other faction declared cease-fire.
- After that, for the next 40 turns, I was not attacked once, even though I was listed as number 17 in all power curves (my treasury was a whopping -57.000 at one point :laugh4:) and my settlements were all defenseless. The AI did pass armies through my lands without mil rights, but they were only on their way to battle with another faction, they never paid me any attention. Hungary actually chased rebels in my lands.
- Save for diplomatic tangles occuring during said 3 assaults and power blocks forming themselves, AI factions have never betrayed each other. They only DoWed the enemies of their allies.
--------------
So there you have it : to fix diplomacy, all you have to do it twiddle with three integers, no more, no less. All you have to do is, in fact, make it possible to have trusted allies.
A trusted alliance means "we'll help him at any cost, no matter what, and never betray our friendship". This is what we players expect from an alliance, or understand the word "allied" to mean. To the AI, a non-trusted alliance only means "if his borders are lightly guarded and we're not the weakest faction around, no need to garrison either", plus the occasional help, and the overtime boost to relations eventually leading to trusted alliance, but it will still consider its allies lands as possible targets of opportunity in the meantime.
An alliance will be trusted if all three standings are above the floats (global reliability, faction A friendliness to faction B, faction B friendliness to faction A).
I'd say 0.2 for global standing is OK : that stands for "Reliable or better", it takes some work/peacetime to get there, and any betrayal sends you down big time
0.8 for faction standing is perhaps a bit steep - it takes a lot to get relations to Excellent/Perfect, and it also takes some work to keep them there... And while the player could probably get and keep trusted allies through florin and maps, the AI factions wouldn't between themselves, if that is a real concern at all. But then again, AI factions tend to be untrustworthy (on the global standing scale I mean) on the whole, so they probably wouldn't get trusted alliances anyway...
What I do not know is how the player faction is treated regarding faction standing, that is to say : since "trusted ally" checks both "do we like them" and "do they like us", what is the setting for the player, and how does the AI determine wether the player's faction like them or not ?
My uninformed guess would be that in the specific case of the player, then their own like/dislike is mirrored. That's what I would have done in any case, had I written the code. But I don't know if there is a way to make sure of it.
Is there a console command you can input that will return fs values ?
-
Re: Diplomacy, I wonder...
hmmm wonder what this change will do using Shaba's mod
-
Re: Diplomacy, I wonder...
Good research Kobal2fr :2thumbsup:
-
Re: Diplomacy, I wonder...
Very nice find! That opens up some possibilities.
Please keep at it and I hope you didn't take my initial post as discouragement (obviously you didn't ) as I didn't want to sound negative.
:2thumbsup:
R'as
-
Re: Diplomacy, I wonder...
Hmm, this looks interesting. I agree that the less amount of tweaking the better, unless the system is completely borked. I'll take a look at the folder myself but would you happen to know which line(s):
1. Controls the "relations decay automatically on H or VH".
2. Controls how much relations bonus you can gain from giving a gift.
I would like to mod out the decay altogether and also lessen the gift bonus. I play VH/VH and it's an annoyance having to gift my allies $$$ every turn to keep them pally with me.
-
Re: Diplomacy, I wonder...
@Merlin : no offense to her, but her mod is really heavy-handed and clunky.
It basically makes the AI passive until the player attacks it.
It forces it to respect any alliance for 300 turns no matter what the player did or does or the relationships between them, forces it to respect ceasefires for 30 turns no matter what it's best interests are, removes all aggression as long as the AI likes another faction even a teensy tiny bit... and she's added a slew of "more religious war" conditions that either can't work, or would heavily disturb the AI and make it sillier still if they did (which I doubt).
It's not good diplomacy, it's AI passivation.
I rewrote an .xml file from RTW scratch that should :
- make the AI actually defend its cities (for some reason, the guy that copied the AI from rome removed all defense priorities, which means the AI always uses default value (ie : defense minimal),
- make trusted alliances work while keeping untrusted alliance working until there's no common enemy at which point the AI will consider it's ally as just another opportunity target,
- do away with the silly turn 30 diplomatic hiccup,
- make the AI attack rebels smartly,
- remove blockhead 1 turn blockades and 2 unit siege gone next turn,
- make them accept/offer ceasefires when they're run down
and (hopefully, but I doubt the parameters are really implemented)
- remove aggressions between cath factions that are both >5 on the pope-o-meter (unified front against the muslims and excommed pariahs).
I'll try it on for size tonight, see how it fares. If I like what I see, I'll release it.
-
Re: Diplomacy, I wonder...
Quote:
Originally Posted by dopp
Hmm, this looks interesting. I agree that the less amount of tweaking the better, unless the system is completely borked. I'll take a look at the folder myself but would you happen to know which line(s):
1. Controls the "relations decay automatically on H or VH".
2. Controls how much relations bonus you can gain from giving a gift.
I would like to mod out the decay altogether and also lessen the gift bonus. I play VH/VH and it's an annoyance having to gift my allies $$$ every turn to keep them pally with me.
relations decay is in descr_faction_standing.txt
But as far as I know that's the only effect of campaign difficulty, that and agents efficiency. There's nothing in the AI that makes it "better" when on VH, it just attacks the player more.
gift bonus I'm not sure, there is both something about it in the same file that can be modded
But I'm not sure how it really works, because a 1000 gold gift certainly doesn't make your relations go from neutral to perfect...
There's also a modifier for it in descr_diplomacy.xml (give_payment), but I wouldn't touch it there because it would also affect other types of cash negociations (ie trade rights worth etc...)
-
Re: Diplomacy, I wonder...
Hmmm there is weirdness here :
Doesn't this look strange to you ? If I understand it correctly, the TallPoppy2 means a faction will be hated if it has a total score >80%, but isn't 1st, second or third ? Am I correct in thinking all of the FactionScoreRank checks in these triggers are the opposite of what they should be ?!
-
Re: Diplomacy, I wonder...
No, that should mean that you have to be over 80% and MUST be 1st, 2nd, or 3rd.
It seems backwards, but it's looking at the raw number, not the rank. Rank 15th > 2nd, because 15 > 2.
So, Tall Poppy 1 requires 90% and 1st place, Tall Poppy 2 requires 80% and 3rd place or higher, and Tall Poppy 3 requires 70% and 5th place or higher.
Now that I'm done with that, let me say, WOW! Nice work, Kobal2fr! I'd really like to see that file you said you made. Don't forget to release it today, if it's working. ^_^
I hate over-modding, myself. We seem to want the same sorts of things fixed in the same ways. I never played Rome, though, so I'm just learning how to mod for this engine.
Question: You said, "0.8 for faction standing is perhaps a bit steep - it takes a lot to get relations to Excellent/Perfect..." How do you know what numerical value equates to which relation level? Is there a place to look to find out? How about for the global standing levels?
-
Re: Diplomacy, I wonder...
Aaaah, of course. Silly me.
As to your question, well, I don't, but it seems logical.
Faction standing is on a 1.0 to -1.0 scale, 1.0 being ultraperfect and -1.0 being hate_him_and_everyone_who_looks_like_him. So is global standing.
So it would make sense that each different ingame word corresponds to a fs threshold, probably something like -0.8/-0.6/-0.4/-0.2/0/0.2/0.4/0.6/0.6/0.8
I didn't find anything about that in the files, and I don't have any way to know for sure yet though... I really have to lay my hands on a list of all console commands :/
Or try out alpaca's .strings.bin reader to find out what's in the gibberish files...
-
Re: Diplomacy, I wonder...
-
Re: Diplomacy, I wonder...
Thank you, alpaca.
I try to keep my noob questions to a minimum, but now I have one more. ^_^
Lines like <diplomacy_text name="DT_RELATIONS_0"/> are obviously referencing entries in another file that holds the text strings. Which file would that be?
I've been looking for the text string files (like the one with ancillary descriptions, for instance) and haven't had any luck.
-
Re: Diplomacy, I wonder...
Yay. I'm not cool enough to be allowed to edit my posts. -_-
I just realized that "alpaca's .string.bin reader" might be the key to answering my question. Yes?
Now, where to find such a thing...
-
Re: Diplomacy, I wonder...
Aaaah thanks alpaca. I figured those lines were only about using different spoken lines etc..., had missed the thresholds.
Rhedd : the DT_RELATIONS are used in \data\text\diplomacy.txt.strings.bin, and \data\text\diplomacy_speech.txt.strings.bin which tells the game what to say/display in what conditions
-
Re: Diplomacy, I wonder...
Is there anything like a reader for .string files?
Regards
GrandViZ
-
Re: Diplomacy, I wonder...
Quote:
Originally Posted by mesut
Is there anything like a reader for .string files?
Regards
GrandViZ
No reader but a converter: https://forums.totalwar.org/vb/showthread.php?t=75229
-
Re: Diplomacy, I wonder...
Thanks for the info, Kobal. That's exactly what I was looking for.
So... what happened to that .xml file you mentioned back in post #9? ^_^
-
Re: Diplomacy, I wonder...
Erm some more quick questions:
1. What's a shadow faction and why does the code make it never ask for peace or protectorate?
2. What do the AI invasion priorities do?
3. What's the difference between invade_opportunistic and invade_immediate?
4. Looking over SW's mod I noticed that she replaces all these lines:
can_force_invade="false"
With:
can_force_invade="false" invade="invade_none"
What's the difference?
-
Re: Diplomacy, I wonder...
- Not sure 100% what a shadow faction is, but my guess would be "those factions you have to destroy in a short campaign", or perhaps "the factions that need to destroy you to win a short campaign". They don't want peace with you because you're out to get them anyway.
- Invasion priorities do squat per se. It's just higher and higher values so that a given condition overrules other conditions further down the checks, that is to say that when there are two "valid" conditions, but one more threatening that the other, the AI acts only on the threatening one.
- Not sure, again. That's not something you can test as easily. I'd say invade_immediate is "attack with what you got, no matter what", while invade_opportunistic is "attack if you're stronger and he's weak", or "attack if you find yourself in a position to do so right now, without taking long term problems into account", but that's just conjecture at this point.
4 - nothing. Invade=none is the default so you never need to specify it. Well, it should be, only the default is just commented-on empty faction-decision. My guess would be that the AI reverts to invade_none whenever it's not specifically told to do something, but I put invade_none invade_priority=50 in the default, just in case. The default was also clear in RTW.
Rhedd : it's about done, but I'm trying to deal with the naval invasion problem post-patch, as it seems to defy logic a little bit : it invades, but still wants peace because it doesn't share borders. Only when said invasion captures its target does the AI become sensible again, and naval invasions don't seem to be triggered by the same stuff as land ones (ie borderstrength balance etc... don't apply obviously).
Plus the antitrait thing derailed my campaign testing and got me back into modding... again :)
I'll probably end up posting my file and asking you guys to test it for me.
-
Re: Diplomacy, I wonder...
Quote:
Originally Posted by Kobal2fr
Rhedd : it's about done, but I'm trying to deal with the naval invasion problem post-patch, as it seems to defy logic a little bit : it invades, but still wants peace because it doesn't share borders. Only when said invasion captures its target does the AI become sensible again, and naval invasions don't seem to be triggered by the same stuff as land ones (ie borderstrength balance etc... don't apply obviously).
The dangers of wish-fulfillment; we asked to see more of it, CA obliged, but since the original team has most likely been broken up to work on other projects, the integration was not seamless.
EDIT: Maybe this line says something?
can_force_invade="true" :: can naval or forced invasion settings overwrite invade parameters
-
Re: Diplomacy, I wonder...
Quote:
Originally Posted by Kobal2fr
- Not sure 100% what a shadow faction is, but my guess would be "those factions you have to destroy in a short campaign", or perhaps "the factions that need to destroy you to win a short campaign". They don't want peace with you because you're out to get them anyway.
I'm pretty sure a shadow faction is a faction flagged so in descr_sm_factions.txt. If you have BI you could find factions flagged this way like Eastern Empire Rebels and so on. Basically it made a faction acquire every settlement which rebels from the shadowed faction plus other side effects.
-
Re: Diplomacy, I wonder...
Do you think we can download a fixed dipomacy for cherry vanilla like with your Traits file?
:bump:
-
Re: Diplomacy, I wonder...
-
Re: Diplomacy, I wonder...
This sounds like really good stuff - I've been peering around the forums for a week or so now (just recently registered to post though) - trying to make the game run as efficiently as possible.
So, what your saying here is - it sounds like the alliance part of the code was /turned off/ during development (at least effectively turned off) and they forgot to switch it back on?
And all I have to do to fix it is go into the .xml file and change those 9999 values to the reccomended ones? I've been peering around, but I'm not much of a coder type - I just want to make the switch as quickly and easily as possible. I have the xml file opened right now, and I'm looking around but well, once more - not much of a coder type. I see the part at the beginning where...
Actually, as I type this I've figured it out - I think. I'll explain what I'm doing for any other "stupid newbies" like me reading this. I searched through the file and found:
<!--
///////////////////////////////////////////////////////////
// GLOBAL AI PARAMS (currently disabled, i.e. range = [-1.0, 1.0]) //
///////////////////////////////////////////////////////////
-->
<trusted_ally_fs_threshold float="0.8"/>
<trusted_ally_target_fs_threshold float="0.8"/>
<trusted_ally_gs_threshold float="0.2"/>
All of the above were set to 9's, like you mentiond - and like the code notes, the values of 999 effectively disabled them.
So, hopefully my alliances should hold now. I was getting rather annoyed...I had 2 marriage alliances with Byzantium, was assisting them against Venice in a war, and was giving them tribute and they still broke the alliance. I'll see how this goes.
BTW: You guys here are awesome, doing all this research. KUDOS KUDOS KUDOS!!!
-
Re: Diplomacy, I wonder...
Quote:
Originally Posted by Re Berengario I
I'm pretty sure a shadow faction is a faction flagged so in descr_sm_factions.txt. If you have BI you could find factions flagged this way like Eastern Empire Rebels and so on. Basically it made a faction acquire every settlement which rebels from the shadowed faction plus other side effects.
Hmmm, then it's probably just a leftover, because that's the first place I checked and there's no shadow factions defined in there.
Quote:
Originally Posted by Valentine82
Do you think we can download a fixed dipomacy for cherry vanilla like with your Traits file?
My comp's still somewhat on the fritz, so I can't test it yet, but it's in the works !
Quote:
Originally Posted by lastofthelight
So, what your saying here is - it sounds like the alliance part of the code was /turned off/ during development (at least effectively turned off) and they forgot to switch it back on?
Something like that, yes. Or maybe they deliberately turned it off to make the AI more challenging/aggressive/treacherous.
And to answer the question : well, fixing the variables is a big step forward in and of itself, because with it on you can finally expect long standing alliances to mean something, but the AI will still not be all that sensical, which is where my upcoming fix will come in, hopefully.
To make it more clear : with the default values, an alliance will become trusted (that is to say, meaningfull even when not in a common war against a third faction) if your global standing is above 0.2 (which is "Inconstant" in the French version, so probably something like "Wavering" in English); and your relations with said faction are above 0.8, which is between "Very Good" and "Excellent". 0.75 is probably better than 0.8, since it's the "Very Good" threshold, meaning you'll know more precisely when the alliance is trusted or not.
-
Re: Diplomacy, I wonder...
Just a short info: when you set the can_force_invade attribute to false for all invasion decisions, the AI won't do those silly attacks on the player anymore that are dependent on peace time, etc.
You probably already figured that out, but I thought it might help somebody.
-
Re: Diplomacy, I wonder...
What exactly are you talking about?