XAI 2.16 - The Dark Saga continues!
"Lord Vader!! the Rebel Alliance is being crushed by Knight Xeryx's Android Intelligence as we speak.."
First of all, I want to thank the Open Beta Testers of V2.12 for your help, it was invaluable. With that help, I was able to target and eliminate many inconsistencies in performance. credits at the bottom.
INTRODUCTION:
I wanted to be challenged in the campaign, so I took a different approach to making a completely new AI. Frankly, I was surprised that it even worked as well as it did during the first open beta. In fact had I used the XML cook top we would have had a working AI many months ago, because it has a good self checker. I have never used xml, until this game, so I am learning. I am not claiming to better than any of the other modders either.Be careful modders when using this program though it has caused me setbacks, by using old templates it ruined 2 versions and about 20hrs worth of work.
As you all know, one of the major areas that needed improvement in Medieval 2 is the Campaign AI. My goal is to improve the AI so we do not have to keep handy-capping the Human player. This single file controls or influences diplomatic relations , defense and attack decisions and can also be tuned for specific behaviors for factions and religions. It is a very powerful file when put in the hands of a creative war monger!! So, I decided to take on the daunting task of re-writing it. This is the fruition of my work, and I don't expect it to be perfect. This is not an open beta it is a release candidate, barring any major bugs. I want your opinions and ideas, so we can make a much better AI and keep improving it, in the end. This version is fully operational, there will be more tweaking as reports come in.
It took me a few months of working with the AI to understand how it worked; this effort has finally paid off. I kept things as simple as possible, but expanded the AI significantly. This mod as far as I am concerned is still in a beta state, and will require extensive testing to balance and make sure it works completely. So this will continue to be a work in progress. This XAI is actually more complex than you may think, even the order in which decisions are placed, matter. So I highly recommend that you keep this XAI intact and whole.
CA said themselves that the Campaign AI and the Diplomatic AI work against each other, however I disagree. The campaign AI was just very, very poorly written (just stating the obvious) and broken. It was definitely not written by anyone who understands strategy games and by that I mean they did not know what is strategically and tactically important. Which brings up the next question, if it took me a matter of months to write an AI that might actually work, why did CA not put forth the effort for the 1.2 or Kingdoms release? CA had plenty of time to fix this al the way from RTW. This is honest criticism, and when you play this XAI, CA you will understand why! I can take this staunch stand and why the Dark side is so powerful!! For all the people that use this mod, take time and send CA a note in their forums
To fellow Modders; This mod is designed to be used with any mod, just please follow my simple directions Please be aware that other files will need modded for re-balance and compliance, because of the now working AI. These files include the; desc_faction_standings, the desc_strat file, desc_diplomacy,desc_sm_factions file. These files all work together with the XAI file and are very important to achieving a "Balance" that you desire for any mod. So, I recommend that you have to have an understanding of these files before attempting to blame the "XAI"!
I want you to understand now, that this mod has only been tested with Darth mod 1.4D, NOT OTHER MODS!! If you want to use it with other mods, feel free, but you will definitely find balancing issues with them and I won't support it until I have the time.
If you play and you find that you love the mod and think that it should be an integral part of your favorite mod, then you need to POLITELY ask the developer of the mod to evaluate this mod, then they may include it in the next release. I will not be responsible for how it interacts with other mods! I have designed this mod to easily be integrated into other mods, there are no special "Darth mod" commands. but minor file modification will be necassary in order to activate all android AI's.
Some things you need to understand, about the AI, there are a number of other files that affect the AI directly. I cannot be responsible for how they are modded, in either Darth mod or other mods.
1) The auto_resolve dramatically affects expansion of factions.
2) The Rebel garrisons dramatically affect expansion
3) The Production AI "balanced smith" dramatically affects expansion.
4) The Amount of religion in your starting provinces affects expansion, and also new territories.
5) Starting available troops vs garrisoned troops
With that said this AI will expand, and will make smarter decisions about the places it expands to. I have seen many naval invasions to settlements and many sieges that fail, because of the Auto-resolve and Map's garrisons. So, you need to pay attention with the toggle_fow of what the AI is doing, before complaining.
SPECIFICATIONS OF CHANGES:
This mod is completely new. There are only a few of the necessary original commands left in the AI. There is now an AI for the following factions or religions “catholic_faction”, “orthodox_faction”, “papal_faction”, “islam_faction” and of course “default”. The XAI is much bigger but very efficient. Each AI has the same basic default XAI “MATRIX”. There are however many religion specific commands that allow the different factions to work properly. I increased the “default” AI by over three times. I have majorly increased the decision power of the AI.
The MATRIX:
Let me first explain how the Vanilla and most other AI's work.
The AI consists of many "conditions", as it goes through the list and if a condition is met, then the analysis stops and that decision is used. The decisions have 2 areas, Defense first, then Offense. These are sub divided up into 3 areas; diplomatic decisions, @war decisions, and finally Neutral decisions.
The XAI Matrix is a system of early out first then cumulative decisions. Having the early out diplomatic decisions is good for allies and such, that way it takes less time for the computer to take it's turn. XAI Matrix uses some diplomatic or religious rules of engagement to continue evaluating potential threats, so the order in which you place these decisions is vital. The "MATRIX" is specifically designed to work together with other decisions to determine your threat level, this allows the AI to keep it's territories defended, and react swiftly if attacked , say buy an ally. I have been playing strategy games for over 25 years, I know what is important for a successful attack and defense on both the Tactical and in this case the Strategic level. As long as the values used actually do what they should within the CA programming, then the defense and offense of the AI should be significantly better. You will be challenged by the XAI like never before!!
No other CAI mod that I have seen uses this system of cumulative decision making, or a complex process of commands working together. That is the "Matrix" because it is a matrix of decisions, not just one line commands. That my friends is what makes this mod REVOLUTIONARY!!
Major accomplishments of this mod!
The default AI, which is the basis of all the AI's, is over 4x as big. I have tried to use the "Kiss" methodology and use as simplified models as possible. However, it was necessary to increase the diplomatic and religious decisions for the AI's in order to get the correct flavor of the game. This is not a finished work, it is only a core mod. This was just the first step in getting medieval 2 to work properly. It is also the most importand step to enjoying Medieval 2 again, as it could have after patch 1.2. You will see many things happen you haven't seen in a long time!! I really hope you have fun now, as I knew the game could be great!! This mod will breathe new life into the Med2 community!!
1)I have completely re-written the Papal states AI, it will attack when @war (crusades or you are excommunicated) It can and will defend itself if you invade its territories. The Papal States may attack Islamic and Orthodox states in certain times, but overall should be passive. I recommend not taking them lightly, and I wouldn't get excommunicated either. You need to respect the POPES authority now!! They will also expand to rebel settlements after turn 20.
2)There are now seperate religion AI's, papal, catholic, orthodox, and islam. They all have different relationships with each other, giving a religious flavor...this may need tweaking
3)Vassalage is now rewritten and is considered a last attempt at survival as no independent nation wants to be under rule of another country unless they have no other choice. If you are powerful enough, you can get vassels. I may, in the future restrict vassalage to the religious faction.
4) Naval invasion is going to happen be prepared for it!!
5) The Xai will put up a ferocious fight!! it won't be easy any more!!
6) There is much more but I want you to experience the Darkside!!
7) Alliance's happen more naturally (But keep in mind this can be heavily influenced by your diplomacy file)
8) Many large stacks of troops
9) You will see stacks guarding key crossing points.
10) Troops react to boarder build-up, and or troops move to intercept crossing stacks.
11) Bordering nations will declare war on common enemies, and the will ally with you.
12) The desc_fact file works properly when setting up pre-determined wars
13) AI will first convert provinces to thier religion, before conquering
14) AI uses ambuses galore, be careful
13) AI will shift it troops to the battlefront!! Via Land and Sea!!
14 ) Signifigant improvement in the time turns take!!!
15)because of exclusive use of the Priority system instead of the random system, the AI will hold true to it's objectives and will agrressively pursue them and you!!
The rest is up to you to see!!
This new AI also makes the Description Strat file much more important for setting up the starting standings between factions. MANY commands in the “Vanilla” AI overrode these standings, making them handicapped. Also the production AI's are much more impotant to the faction, because of the passiveness, that some of these can cause.
Change-log from 2.1 to 2.11
1)General AI; I fixed the few instances of forced invasion, these include Alliance backstabbing, Ceasefires, Allies protectorate, and Allies Vassal in all AI's
2)General AI; Nations attacking slaves is a higher priority, it is a forced invasion item ATM, however I may change this later to a priority system.
3)Invasion AI; Removed all instances of "invade_raid" and replaced with "invade_opportunistic" Should work much better, and keep stacks larger.
4)Defense AI: Removed all instances of defend_raid and replaced it with appropriate defenses.
5)Neutral Invasion AI; Value in an opportunistic invasion was incorrect.
6)Decided to try something, and moved special rules for factions to the Top part of the section.
7)Papal AI; Added a minimum value for them to be able to attack, we'll see how this works. It should make them much more passive towards Catholics and Orthodox
9)Orthodox, Islam, and Catholics had incorrect values in their special rules for attacking other religions.
10)Re-wrote rule for Catholics attacking the Papacy.
11)Added a rule for the Catholics when dealing with the Orthodox (must have got deleted originally)
12) Changed the Values for the bonuses or penalties for the religious rules for the different religions (AI's)
13)Religious difference rule will most likely only work with 1.3 versions of Med 2 or if you have Kingdoms (you are good to go!!)
14)There were a few other minor changes but not worth mentioning.
CHANGE-LOG 2.12
1)Found duplicate entries for the Orthodox faction; removed (hopefully this will fix the inactive behavior of the Orthodox AI)
2)Increased priority "chance" for dealing with rebels by 10%
Change-Log for 2.14
1) Added difficulty rules for human players (HMMM)
2) Added Vassalage rules.
3) Re-worked the "matrix" rules of production to be more reliable
4) Re-ordered many of the rules for their importance.
5) Fixed-many texts errors (probably have more too)
6) Added in is_neigbour commands to front line rules, so ships do not mess up calculations.
7) Re-adjusted Invade_priorities for balance. This accounts for the weight of the decisions and adjusted levels for @war and neutral
8) Adjusted many religious specific rules.
9) Added faction standings adjustment to certain rules, where applicable
10) Lowered the wanting alliances values dramatically
Change-log for 2.16
1) Fixed the whole entire file again..damn templates!!
2) Enlisted Naimad for error checking!! HUGE HELP for balancing the Diplomacy!!
3) put continue commands in many more enteries, as the Ai was not evaluating all decisions
4) Reordered many more command, and moved some commands back to proper sections.
5) Balancing of alliances, reduced to fractional values as they are all cumulative
6) Introduced new Priority system for attacking rebels!! This fixes pre-defined wars
7)adjusted Rebel attack priority
8) Moved Difficulty rules so they are always read.
9) Added separate religious rules for humans.
10) restricted the Pope from expansion for 20 turns, vs 10 of other nations
11) adjusted auto resolve to be more inline with what a good human opponent can do.(file included)
DIRECTIONS FOR USE:
USE WITH DM1.4C it has been leveled for that!! use in other mods is upto you, but you will be responsible for balancing not me!! Unless you have a Major mod, and need help go read the modding forums like I had to!! I'm not trying to be mean, I just really do not have the time right now.
Files included; I am including DM1.4D files!! You can use to compare the changes you need to make to your own files!! The fixed DM1.4c (desc_strat.txt) file to go in your campaign map directory it has the factions already edited and the Madeburg fix. Modded (desc_sm_factions.txt) and the (desc_campaign_db.xml) and the most important file the XAI (desc_campaign_ai_db.xml). Later after more balancing I will include my diplomacy file and my faction standing file!! That will make my work complete as DXAI a DM1.4D mod.
1)Please backup any files before overwriting existing ones, Simply unzip this file, then copy to the desired MED2\DATA (these files must be added; (desc_sm_factions.txt) (desc_campaign_db.xml) (desc_campaign_ai_db.xml))
2)Manual editing of the desc_strat file: You will then need to open up; my particular directory medieval ii total war\MOD\Data\world\maps\campaign\imperial_campaign\(descr_strat.txt file) or use the file provided
3)Then manually edit the AI label for the different factions.
Use the Find command to find the ai_label, for example.
“ai_label(tab)catholic” {gets changed to} "ai_label (tab)catholic_faction"
These are the available AI’s
papal_faction (Bact to original)
orthodox_faction
catholic_faction
islam_faction
default
slave_faction
You must start a new campaign to see the full effects of the XAI and it will be immediate trust me!!
And enjoy!!
Lastly if you use the XAI for a mod, you must give credit to Xeryx and Niamad. For as much time we put into it, that is a very small reward. You do not need permission to use, as we did this mod for everyone!!
TESTING METHODOLOGY:
Play on any level, I recommend AUTO-RESOLVE (This is to make for speedy gameplay) play as any faction you like. I want you to try and break it. Depending on the mod you may get different results for diplomacy, and how frequently wars break out. You can use the toggle_fow command in the console to see the rest of the world.
Things I am particularly interested in in your reports. Crusade's and if the Pope gets involved? Are Jihads being called against Catholics and Orthodox? Naval ship usage, are there naval battles. Also is the AI using ships properly? (Please look closely for the looping diplomats, princess' and such, this is when they get on and off ships repeatedly) I want to know if the AI engages in diplomatic actions often after the first turns? Also what kind of things they are asking for, not how easy they are to get? I want to know if the separate religions are making allies with one another, and war against different religions? Is the AI using enough troops to take their objectives? Are ceasefires working? etc. etc.etc.
REPORTING:
Please keep a log of significant things and keep playing; I want you to play at least 20 turns before reporting. Diplomatic activity is fine to report. Just not how easy it may be. I need your reports to be very detailed so that I can track bugs or make adjustments. If you give me a generic report, I will give you a generic answer. You MUST include, what mod you are playing with (should be Darth mod), what faction (very important) and what difficulty. You may post screen shots if you wish.
PLEASE REMEMBER
This is still BETA and really my first mod for Medieval 2, so there may be issues that I haven’t seen, and we will correct them as we go. I am easy going. Just remember , I do have a life outside of modding and playing computer games. So, I will not always be around but will hopefully be able to respond in a timely manner. Otherwise my second in charge Naimad will help you, if possible.
THREAD/FORUM RULES
You will need to be respectful in the thread, I have no qualms about squashing trolls or people that are not here to help, but only cause trouble. I will not tolerate childish behavior in this thread, so be warned!
Special thanks to Niamad for error checking my work and getting the levels adjusted, for with out it we never would have made the release date of today. You definately deserve a promotion!!
Thank you to my 2.12 beta testers, for your help, it was invaluable. With that help, I was able to target and eliminate many inconsistencies in performance. A personal thank you for 2.12 beta testers; Naimad, The Border Reiver, Glabro, Moretz, gogis, alpaca, HistoryProf, Darviathar, tonedog, Raum ul Amon Santini, Haqiq, uk_john