You know where it says that a special case exists in code to force an attack on the player if he is at peace with everybody? That's what I'm talking about.
@alpaca : if I understand the code correctly, if you set "can_force_invade = false" in all invasion decisions, then the AI won't invade, period. Ever. Doesn't it ?
As to the special case for attacking if at peace thingy, I'm convinced it's nonexistent, it's just the original coder saying "if you want to do this, this is the place in the file to do it so that it'll work". The phrase itself is commented, and there's no actual code to go with it, while for instance the "Special case exists here in code for not allowing invasion of trusted allies" which existed in the "mapping of old AI params" at the end of the file was replaced in the actual code by a line doing just that. I believe those are instructions about how to do something specific, rather than descriptions of stuff happening elsewhere or somehow hardcoded.
Anything wrong ? Blame it on me. I'm the French.
No, it invades. The invade decisions like invade_immediate still work.Originally Posted by Kobal2fr
And the code does exist. I have repeatedly been attacked for no reason at all by the AI and a lot of these attacks didn't even make sense - more often than not the AI even sued for peace a few turns after when I asked them.
This stopped after I changed the code to stop forced invasions. However, I think that naval invasions stopped again, too. But that's not a huge issue for me, if I want them I can script them - those the AI did were often not sensible anyways.
Agreed - aside from anything else, everyone is permanently at war with the rebels, so a faction entirely at peace never exists?Originally Posted by Kobal2fr
PS I've also played lategame campaigns where I'm by far the most powerful, everyone else is allied or neutral to me, and nobody ever attacks, so it is possible.
Regarding the descr_diplomacy file, it seems to be kind of screwy.
Has anyone been able to decipher what all the cost modifier values mean or determine? Seems they are all set to 1.0 and none negative.
I noticed almost all of them are set to the same cost modifier value for both offers and demands. I assume that the faction and global standing tags are the increase of that standing if the offer is accepted though?
OffersSpoiler Alert, click show to read:
DemandsSpoiler Alert, click show to read:
Then of course the area of whether or not the AI will accept. Seems a few threshold values are there and some are missing.
Spoiler Alert, click show to read:
Might explain why the AI never accepts anything most all of the time during diplomacy. I would like to know what all the values do though if anyone has toyed around with them.
Everyone is permanently at war with the rebels... but the various checks for how many enemies a potential target of attack already has take this into account. I just read one in the file that sets up conditions for immediate invasion based on:Originally Posted by Sarastro
- The target faction being at war with us
- We have at least 2x his frontline strength
- He outproduces us
- He is at war with more than one faction
The code is this:
As you can readily see, target_num_enemies="3" is in the min_entry line, indicating that the target faction must have at least 3 enemies in order to be considered being at war with "more than one faction." Clearly this indicates that war with rebels + this faction is not enough to be considered multiple faction enemies, and the trend seems to continue through the file. So, it seems safe to say that constant war with rebels is already accounted for in the code, and conditions based on peace will likely ignore your rebel enemies.Code:<decision_entry> <!-- if we're at war && we've more than twice his frontline strength && he outproduces us && he is at war with more than one faction, then >>> invade immediate --> <min_entry stance="AtWar" frontline_balance="2.0" target_num_enemies="3"/> <max_entry production_balance="1.0"/> <faction_attitude invade="invade_immediate" invade_priority="750"/> </decision_entry>
That being said, I would point out that the "attack the guy just because he's been at peace too long" code in fact is not implemented in the file. It looks like this in the file:
There is no min_entry or max_entry, and the entire decision entry is commented out. This actually happens several other places in the file, and is a very common development technique. The idea is you lay the file out in descriptive text to begin with, and then go back and fill in the actual code to accomplish that text as you get to it. You can see everything that isn't implemented in the file because it is ALL CAPS with commented out decision_entry tags, where the actually implemented items have only their text descriptions comments out, and those descriptions are converted to normal lower-case text. This fact means that some code to force invade the player just because he has been at peace in fact does NOT exist, and the attacks we witness must be due to the AI not trusting our alliance (this is a duh if you have left the default AI params disabled as they came) and triggering one of its normal attack schemes because it is threatened by us or perceives itself to have an edge against the given faction.Code:<!-- <decision_entry> SPECIAL CASE EXISTS HERE IN CODE FOR FORCING ATTACK ON HUMAN IF AT PEACE WITH EVERYONE FOR TOO LONG (hard = 4 turns, normal = 10 turns, easy = 20 turns) </decision_entry> -->
Also, there are for instance the following other unfinished things in the file:
This is yet another fact that points to how hurried this release was, as the dev team clearly was not even able to implement everything they had intended to in this file. Frankly I think it's amazing that they got the game working to the extent that they even have...Code:<!-- NEW PARAMETERS TO CREATE AND USE: papal_standing :: our standing with the papal states target_papal_standing :: targets standing with the papal states rand :: a random number excommunicated :: is this faction excommunicated target_difficulty :: what campaign difficulty has the target chosen --> <!-- <decision_entry> SPECIAL CASE EXISTS HERE IN CODE FOR 'CAN_ATTACK_FACTION', NO INVASION IF SO </decision_entry> --> <!-- <decision_entry> SPECIAL CASE EXISTS HERE IN CODE FOR FORCING want_peace WITH A FACTION UNDER CERTAIN CONDITIONS. CONTINUES CHECKS FOR SUBSEQUENT DECISIONS </decision_entry> -->
<!--
NEW PARAMETERS TO CREATE AND USE:
papal_standing :: our standing with the papal states
target_papal_standing :: targets standing with the papal states
rand :: a random number
excommunicated :: is this faction excommunicated
target_difficulty :: what campaign difficulty has the target chosen
-->
this bit is just more of the documentation before the start of the file I believe.
SPECIAL CASE EXISTS HERE IN CODE FOR FORCING want_peace WITH A FACTION UNDER CERTAIN CONDITIONS. CONTINUES CHECKS FOR SUBSEQUENT DECISIONS
this one may be the missing, we have 1 territory left, maybe we should give up warring on them.
EDIT: maybe not, I think this is the the give up although thats only if you aren't a neighbour.
decision_entry
<!--
if not our neighbour, and we have any settlements, and we are at war, and they are not a trusted allies enemy, use defaults + want peace
-->
min_entry num_settlements="1" stance="AtWar"
max_entry is_neighbour="false" trusted_ally_enemy="false"
faction_attitude want_peace="true"
decision_entry
Last edited by Durallan; 01-15-2007 at 14:28.
I play Custom Campaign Mod with 1.2!
My guide on the Family Tree - https://forums.totalwar.org/vb/showthread.php?t=87794
Kobal2fr's guides on training chars to be
Governors - https://forums.totalwar.org/vb/showthread.php?t=86130
Generals - https://forums.totalwar.org/vb/showthread.php?t=87740
Blue's guide to char development - https://forums.totalwar.org/vb/showthread.php?t=87579
Not the case. Search the file for them: they're not used anywhere except right there where they are commented. Again, it's commented out ideas intended to be replaced with code and implemented, but never gotten to. I'm not saying it's horrible or anything that it is the case, as the campaign AI is actually pretty good once the variables are re-enabled, just wanted to point out to people that the programmers clearly didn't get to everything they wanted to.Originally Posted by Durallan
As an additional note, the code that would've forced attacks on the player after a noted amount of peacetime depending on difficulty is probably not implemented due to the target_difficulty variable not being implemented, as the conditions could not be checked without target_difficulty to tell you what difficulty the player was playing on (lower difficulties would've allowed longer stretches of peace). I actually kinda like the idea, as this is still total war... so it makes sense that peacetime should be quickly interrupted by war. I wonder if we'll see it implemented in a future patch. I hope so.
Play a game on VH vanilla. Then implement can_force_invade="false" in every invasion decision. Play a game with the modded file.Originally Posted by the_foz_4
Then come back and tell me again that there is no force invade code...
There is at the very least the naval invasion code.
I wasn't saying that can_force_invade is not implemented, or that there is no code in the game that forces invasions on the player. You can see that it's in the code. I said there is no code that forces invasions on the player based on his difficulty level, as a comment in the file specifically says there should be. The code that should do it simply is not there.
As for the can_force_invasion thing... it's kind of a DUH. You can see that it defaults to true, and only gets set to false in a very limited set of conditions, which hilariously enough mostly don't trigger with the trusted alliance variables disabled. Even with them enabled, can_force_invasion=false applies in a very limited set of circumstances, meaning that most of the time any given faction can force invade you (whatever a forced invasion means in actuality).
I'd like some guidelines to implement the diplo-mod (or a link to download from...). It sounds very promising!
What file needs to be modded? Can it be modded with notepad?
What are the suggested entries (0.75 and 0.2?)?
How can we tell from the diplo screen if an alliance is trusted or not (english word plz)?
Is there more than one threshold ?-0.2-0.75-?
Can a trusted ally still betray you - at all?
I wonder if the game becomes too passive if you implement these changes, but I suspect not. On harder difficulties you'd have to pay a lot of florins to ensure the alliance holds.
Last edited by Magraev; 01-19-2007 at 10:22.
Nope - no sig what so ever.
Ha. Too passive. That's a laugh. Nooooo... the game remains plenty aggressive. I'm currently playing with the changes suggested here in an English campaign, and at war with the remnants of France, Milan, and Portugal which is mostly blockading and dropping small landing parties on mainland Britain. I started none of those wars. Of course France and Milan had good reason to try to take me down, as I was building up forces to swing through West and South France, mashing both of them between myself and my HRE allies to their East.Originally Posted by Magraev
Getting more to your questions, the modification is quite easy to accomplish yourself. You'll need to mod descr_campaign_ai_db.xml and yes, you can accomplish it with a simple text editor like notepad. If you're not experienced at all with modding this game, it's unlikely you've unpacked the game files or configured a bat file to run the game from said unpacked files. If that is the case you can stop reading right now and go read up on the unpacker instead, as you'll need to unpack the game files and set the game up to look for modded files in order to do this mod.
Having unpacked the files and found the one in question (in the data folder), you'll need to find the section of the code that looks like this:
It's pretty close to the top of the file. Make sure you have the stuff about GLOBAL AI PARAMS above the variables, as the variables are mentioned first in the file in a comment that describes their use... and modding that would be worthless, lol. The three variables in the unmodded file will be set to "9.0" each IIRC.Code:<!-- /////////////////////////////////////////////////////////// // GLOBAL AI PARAMS (currently disabled, i.e. range = [-1.0, 1.0]) // /////////////////////////////////////////////////////////// --> <trusted_ally_fs_threshold float="0.75"/> <trusted_ally_target_fs_threshold float="0.75"/> <trusted_ally_gs_threshold float="0.2"/>
The game code suggests the first two be set to 0.80 and the last to 0.2, but consensus is that it's nicer to set the first two to 0.75 so you can actually tell when the alliance will be trusted, as 0.75 is the threshold for "Very Good" relations, while 0.2 global standing is a minimum rating of "Reliable." If that's what you want to use too, then all you need do is make that part of the file identical to the code above by setting the first two variables to 0.75 and the last to 0.2. Save the changes, and then run your batch file with the io_first switch in it, and you're good to go. You'll know an alliance is trusted when your relations with the faction are at least Very Good, and your global standing is at least Reliable.
I hope this modification has not been abandoned. All the diplomacy mods I have tried so far seem to have issues of their own, and I was looking forward to trying this one.
Some people get by with a little understanding
Some people get by with a whole lot more - A. Eldritch
what's the location for this file? I'm having trouble finding it
If you have unpacked your files it should be in your /data directory.
If not then go to this thread and you can download
a subset of the /data directory files that includes the file
you're interested it.
https://forums.totalwar.org/vb/showthread.php?t=73971
can_force_invade is the command whic enable/disable "missions" for the Ai which are the same missions the player usually get from the council.Originally Posted by alpaca
You know the silly conquer rebel settlement, port blockade, etc? If you pay attention to it you could recognize the same patterns in the AI behaviour.
Disabling it completely also lead to problems though when two factions share multiple borders (for example with the rebels) because the various frontline comparisons take in account the WHOLE border (to have a quick test just play a bit with the values and see how AI Russia behave towards rebels as they have huge shared borders).
So it's as always a hit and miss procedure, what is good for a faction isn't good for another and some silly AI behaviour is always to be tolerated unless you singularly write an AI for every faction and use it together with scripted invasions and defences.
Man I must've been blind. tyOriginally Posted by KnightErrant
Really? How'd you draw that conclusion? I'm not trying to say it isn't so, but I didn't see anything that indicated it was related to missions, and am curious how you found this out.Originally Posted by Re Berengario I
Try to enable hotseat mode and take control of some factions controlled by AI. You'll find out that they have missions the same as player has, the rebels also.Originally Posted by Foz
Further on you can observe how the AI faction usually goes for the same objectives (and port blockades, etc) that you'll get as missions if you play that faction (within the same situation and timeframe of course).
If you insert the "can_force_invade = false" then you'll see that the AI won't follow aymore the previous objectives, it doesn't attack neighbour rebels, unless the conditions you specified elsewhere are reached, it doesn't block ports, etc
Goes off to examine the file and think about it a while...
Combing the file for it, I found only these basic cases where can_force_invade is set to false (it defaults true the rest of the time):
The 2nd and 3rd are to give a grace period where forced invasions can't happen if we recently declared an alliance or a ceasefire. The first applies generally when there's a trusted alliance, which also makes sense.Code:<decision_entry> <!-- If trusted ally, use defaults --> <min_entry trusted_ally="true"/> <faction_attitude can_force_invade="false"/> </decision_entry> <decision_entry> <!-- If we are allied and have only been allied for a short duration, no invasion set up, cannot force invade --> <max_entry num_turns_allied="3" stance="Allied"/> <faction_attitude can_force_invade="false"/> </decision_entry> <decision_entry> <!-- If we have agreed to a ceasefire only a short time ago, no invasion set up, cannot force invade --> <min_entry num_turns_ceasfire="0" stance="Neutral"/> <max_entry num_turns_ceasfire="3" stance="Neutral"/> <faction_attitude can_force_invade="false"/> </decision_entry>
It also makes sense conceptually that missions would be the things that cause "forced invasions." The file doesn't mention anything about them, but does go on to setup the various conditions that trigger all sorts of AI attacks. This implies that a forced invasion is something that doesn't rely on any of the usual decision parameters, and probably comes from a different source entirely - so while it certainly isn't conclusive, I'm inclined to believe it triggers from AI missions as that makes the most sense as a secondary source of attack directives.
This looks awesome guys, but I was wondering if this is approaching anything like a mod that the retarded computer user (i.e. me) could use without mucking around in files that can screw up your game. Improved diplomacy would be a wonder though, and no more random attacks would be nice.
Modding the strategic AI
Only got the game recently and a bit rusty so some questions if anyone knows:
1) I want faction-specific AI. What I was thinking was editing the attack decisions to be weighted more to faction standing than military strength and having something like,
With one of these for each region france wants so that over time france would have a weighted tendency to dislike more those factions that owned regions it wanted. But i'm not sure of settlement ownership conditions.Code:Trigger France_Caen WhenToTest FactionTurnStart Condition not TargetFactionType france and << this faction owns Caen >> FactionStanding france -0.01
2) Is the base global standing moddable? I'd like it to start at reliable for same religion.
3) Anyone know what this does?
~~~Code:relations_improved_thresholds { -0.1 0.5 0.9 } relations_worsened_thresholds { -0.9 -0.5 0.1 }
Ty in advance.
It's not a map.
1) I_SettlementOwner <faction>
2) Well you can always make some triggers for it that trigger only on turn one or so.
3) I think this determines when you will get a popup message that your relations have improved or worsened (e.g. if it gets below 0.1 you'll get a popup that it worsened)
Ah, ty.
Code:Trigger france_caen_england WhenToTest FactionTurnEnd Condition FactionType england and I_SettlementOwner Caen = england FactionStanding factions { france } -0.02
looks like i'm going to need one trigger per region a faction wants for each of the other factions...ouch
It's not a map.
Very interesting idea Nikolai but you have then to setup the diplomacy xml file to make the bad relationships to have a substantial effect. And you'd have als to tune down (or to eliminate like I did) the end turn normalization wich with high difficulty campaign setting makes the relationships worsen at every turn regardless.
If I can give you an advice is to start from a blank descr_campaign_ai_db.xml, tune the base aggressivity of AI to your tastes (I prefer an AI which builds up its forces enjoying peace until it's ready to strike, others prefers the vanilla bloodshed) and then starts playing with triggers to link the the basic AI behaviour to the campaign happenings.
Yup. Was looking at the things you can test for and faction and global standing was there just the vanilla AI is far more interested in military strength. I'm going to change it all round so the AI reasoning revolves around how much they like you and how much they like you being largely determined by whether you have some region(s) they want. Should be able to make it act more realistically I think. Will take a lot of typing though.but you have then to setup the diplomacy xml file to make the bad relationships to have a substantial effect
Yeah i deleted that too. No wonder the AI factions in RTW seemed so crazy.And you'd have als to tune down (or to eliminate like I did) the end turn normalization wich with high difficulty campaign setting makes the relationships worsen at every turn regardless.
Good advice. I did this and created a mini AI profile that limits the AI factions to attacking rebels. Currently running the game with all the factions set to that profile so I can see where there are map path-finding problems.If I can give you an advice is to start from a blank descr_campaign_ai_db.xml
Interestingly with isneighbour=true set in the profile you still get some naval landings, just less than when it is removed.
Just realized my trigger was the wrong way round.
Trigger france_caen_england
WhenToTest FactionTurnEnd
Condition FactionType france
and I_SettlementOwner Caen = england
FactionStanding factions { england } -0.02
Last edited by nikolai1962; 03-17-2007 at 05:53.
It's not a map.
I've just gone ahead and changed the value in the descr_campaign_ai_db fire,now what's this about running a batch fire with the io_first switch to implement it? Can't I just run the game normally and load my saved game?Forgive me I don't usually mod games but the AI diplomancy or lack of is driving me insane..
Bookmarks