DARTHMOD 1.4D Battle AI Add on
My Sith follower, Xeryx, has summoned me to help him, in these troubling times, concerning the AI modification he has created. As I have retired from modding, I could not be more tempted because I have retired in a moment I had new things to give. I decided to give them to myself for some time, playing very few times my own mod. But now it is time to release these new things I wanted to share with all of you:
-I offer this battle addon mostly for all the players of my mod (It is in the 5th place of the most popular downloads of TW center… so there must be a lot around concerning the many thousand other downloads around the web).
-Secondly, these 2 files can help all other modders who reaserch on this matter to compare them with their own, maybe to see some ideas or extra code I have.
-I will also offer a small tutorial of these changes. I will try to offer some more tutorials for various other portion of AI code I should have given before. I cannot promise anything though.
The changes that commenced concerning the previous files of DarthMod 1.4D: The last Episode are the following:
battle_config.xml
<combat-balancing>
<missile-target-accuracy>
<infantry>0.75</infantry>
<cavalry>0.95</cavalry>
<elephants>0.95</elephants>
</missile-target-accuracy>
<melee-hit-rate>0.55</melee-hit-rate>
I increased the missile cavalry hit rate from 0,9 to 0,95. Small change, but it creates the exact impact I wanted to have, concerning my other battle stats.
THIS IS EXTRA DARTH CODE ADDED
<melee-hit-rate>
<infantry>22.0</infantry>
<cavalry>3.50</cavalry>
<elephants>1.5</elephants>
</melee-hit-rate>
</combat-balancing>
THIS IS EXTRA DARTH CODE ADDED
During my creation of DarthMod, I risked to add these lines in order to control the melee hit rate individually for each weapon arm. It has worked!
I increased the number of Infantry to 22.0. This creates much more effective infantry melees and more endurance against cavalry. Of course do not expect much against a super charge of heavy Knights.
config_ai_battle.xml
This is the range which the AI sees other units and interacts. I made it very large and I created a very good effect of proper AI reaction and defence preparation. I have not tested much, but this, together with some other aspects below, corrects a lot of Siege AI problems. Modders should try this idea. Together with the below:<melee-manager>
<attack-dist-multiplier>10.0</attack-dist-multiplier>
If you notice the values you will notice the following:<open>
<infantry>
<max-engage-dist>
<easy>1</easy>
<medium>1</medium>
<hard>1</hard>
<very_hard>1</very_hard>
</max-engage-dist>
</infantry>
<missile>
<max-engage-dist>
<easy>125</easy>
<medium>125</medium>
<hard>125</hard>
<very_hard>125</very_hard>
</max-engage-dist>
</missile>
<cavalry>
<max-engage-dist>
<easy>360</easy>
<medium>450</medium>
<hard>900</hard>
<very_hard>900</very_hard>
</max-engage-dist>
</cavalry>
THIS IS EXTRA DARTH CODE ADDED
<general_unit>
<max-engage-dist>
<easy>5</easy>
<medium>5</medium>
<hard>5</hard>
<very_hard>5</very_hard>
</max-engage-dist>
</general_unit>
THIS IS EXTRA DARTH CODE ADDED
</open>
<settlement>
<infantry>
<max-engage-dist>
<easy>10</easy>
<medium>10</medium>
<hard>10</hard>
<very_hard>10</very_hard>
</max-engage-dist>
</infantry>
<missile>
<max-engage-dist>
<easy>125</easy>
<medium>125</medium>
<hard>125</hard>
<very_hard>125</very_hard>
</max-engage-dist>
</missile>
<cavalry>
<max-engage-dist>
<easy>900</easy>
<medium>900</medium>
<hard>900</hard>
<very_hard>900</very_hard>
</max-engage-dist>
</cavalry>
</settlement>
-Infantry has a too small value, maybe the minimum possible for the effect.
-Missile has much bigger values.
-Cavalry has enormously bigger values
-I created an extra general_unit behaviour AI slot code, to help him last longer. It works!
The engage distance is the distance in which the AI will actually start to engage the target. So, by also increasing much more the AI visual attack scanner, I create the effect of AI to anticipate the target and attack on time than react as idle or in very small radius as before. (For example it will deploy the troop line that is not engaging with the correct facing opposite to human missile attacks coming from afar and not just stand there...)Cavalry is the military arm which will decide the battle at all situations if it is plenty and… heavy!
Researching many years in Military History as a hobby and now as a part time job I know of the following: Military tactics of the Medieval Era were simple but involved careful examination of the ground in order to use the Heavy Cavalry properly and the usage of many types of infantry troops operating en mass. This is the effect I wanted to give and this is what you will get if you play some battles with DarthMod 1.4D 1.3 patch and this addon. The infantry will stay together as a solid heavy mass, seldomly separating in a lot of single blocks (typical vanilla setting) and the Cavalry will move around it to flank or support the attack. Battles will gain a character you have never withessed so far.
AI will examine much better the situations and use his army like a true Medieval force. This is also enhanced by these new addons:
I feel that this code affects the battle reaction time in a large proportion. It seems that it works as a “bar” which fills as the units engages and moves around and toggles after it finishes the distance and waits for the time interval. So by using a large distance you create a determination of frontal assault as they attack and by lowering the time intervals you give them fast pace reactions. Small values of distance especially with long intervals, create “scattering” (the common idiotic bug of vanilla).<attack-brace>
<distance>50.0</distance>
<time-to-change-formation>0.1</time-to-change-formation>
<time-to-phalanx>0.1</time-to-phalanx>
<time-to-schiltrom>0.1</time-to-schiltrom>
</attack-brace>
THIS IS EXTRA DARTH CODE ADDED
<defend-brace>
<distance>100.0</distance>
<time-to-change-formation>0.1</time-to-change-formation>
<time-to-phalanx>0.1</time-to-phalanx>
<time-to-schiltrom>0.1</time-to-schiltrom>
</defend-brace>
THIS IS EXTRA DARTH CODE ADDED
I added the extra code of defend-brace which adds to the melee mechanics as counter ratio of moves (as I feel it). I have added it in old versions of DarthMod, removed it from DarthMod 1.4D but use it now again, as I feel that it works perfectly!
I remind that the above are alterations involving my own mod. Some negative values introduced in the previous version are abandoned here because they do not create so good effects although they can be used but create a more “layed back” stance of the troops. DarthMod uses many other innovations, not explained here, cooperating with the above. I tested the new effects only in my own mod and I recommend everybody who plays with it to add it, just for his own satisfaction.
Expert modders should be able to read the above mentioned and adapt these ideas separately to their mods or try new values working better to them. I have been summoned with Xeryx’s spell, which will last for some time. So I will be around for conversation if you wish to.
Installation Instructions:
Simply unzip and copy these files (battle_config.xml, config_ai_battle.xml) to replace these of DarthMod. (I offer the typical file structure of a Mod-Switch version).
@Xeryx
I will be able to discuss in any matter for some time. I just cannot beta test on any other mod at the moment because I do not have Kingdoms expansion nor I want to play the idiotic vanilla or start fully remodding just to play my style.
In DarthMod I have:
Quote:
<retreat-analyser>
<retreat-counter>
<easy>150</easy>
<medium>130</medium>
<hard>120</hard>
<very_hard>100</very_hard>
</retreat-counter>
<retreat-point>
<default>
<distance>30</distance>
</default>
<cavalry>
<multiplier>1.5</multiplier>
</cavalry>
</retreat-point>
</retreat-analyser>
A lot has been said about this AI code. Here is my explaination which may all help you (As I remember when I modded it):
This code handles the way that units receive morale penalties making them to rout or ... vice versa morale benefits to make them rally.
I repeat.... 1 stat for 2 Opposite Factors.
In plain words:
The <retreat-counter> is the "Acceleration Bar" which gives the 0-100% morale strength of each unit.
The <retreat-point> is something like a point which handles the Line of Battle. AI units will try to form around it as it seems and rally while trying to do fake attacks from this base.
Also each unit has its own morale stats which work as the base to all this.
The bigger is the acceleration bar, the more time it takes to rout and.... rally.(Small values create the back and forth retreat-rally, Big values give more rout endurance but will not rally easily... probably retreat for ever.)
The bigger it is the retreat point, so much away from the heat of battle is set the rally point which AI struggles to maintain... it affects AI behaviour as I have seen)
In DarthMod I use a default retreat point, same to Human and AI (?).
In XAI I noticed there is extra code, distinguishing difficulty levels.
First of all Bravo to Xeryx for being valiant to test extra code, secondly I feel that it should work but I cannot verify for the time being.
Quote:
<retreat-analyser>
<retreat-counter>
<default>
<easy>60</easy>
<medium>75</medium>
<hard>115</hard>
<very_hard>130</very_hard>
</default>
</retreat-counter>
<retreat-point>
<default>
<distance>
<easy>50</easy>
<medium>45</medium>
<hard>40</hard>
<very_hard>35</very_hard>
</distance>
</default>
<cavalry>
<multiplier>2.5</multiplier>
</cavalry>
</retreat-point>
</retreat-analyser>
Now for my proposal:
Quote:
<retreat-analyser>
<retreat-counter>
<easy>150</easy>
<medium>130</medium>
<hard>120</hard>
<very_hard>100</very_hard>
</retreat-counter>
<retreat-point>
<default>
<distance>5</distance>
</default>
<infantry>
<multiplier>0.0</multiplier>
</infantry>
<general_unit>
<multiplier>1.0</multiplier>
</general_unit>
<cavalry>
<multiplier>5.0</multiplier>
</cavalry>
<missile>
<multiplier>20.0</multiplier>
</missile>
</retreat-point>
</retreat-analyser>
<outflank-analyser>
<unit-priority>
<cavalry-vs-phalanx>10</cavalry-vs-phalanx>
<vs-infantry>90.0</vs-infantry>
<vs-routers>2.0</vs-routers>
<behind-stakes>0.0</behind-stakes>
</unit-priority>
</outflank-analyser>
These are the new settings I am currently testing and work tremendously great to DarthMod 1.4D. (I will make available soon for the public)
I have put much smaller distance and a special infantry multiplier for compensation because I increased too much the Cavalry multiplier.
This causes the effect of the AI battle line to be thin around the player and the cavalry to have the special freedom.
Watch the new settings of the outflank analyser... just copy paste them to any mod...they work brilliantly because they create the effect of:
1)Stakes avoid (as much as possible)
2)Whole AI army tries to flank the main infantry body of the Human player
3)AI Heavy Cavalry and Infantry now advances together and the missiles are a free body because are not mentioned in the code.
The proportions I use are easy to understand for a Mod creator but I will explain later if I can.
Try them in your mods and tell me.
This setting is causing very cautious AI envelopment in my opinion
I used the xeryx gta code, I am not sure if it is the vanilla code but I trusted it worked OK after the Siths have tested so much.
Next I tested the extra code in outflank analyser....they are not placebo effect. They work very very well and once again bravo to the Darth Team. I tested the code to my mod and they certainly had an impact. So I cannot understand why some have not seen that until now.
But...
I think that the infantry lines must be dropped because they cause infantry to lose the en mass capability and try to attack like maniples which is not historically correct and also break the infantry to small pieces trying to flank or chase cavalry.
I propose this code:
<outflank-analyser>
<unit-priority>
<general_unit-vs-general_unit>10.0</general_unit-vs-general_unit>
<general_unit-vs-heavy-cavalry>40.0</general_unit-vs-heavy-cavalry>
<general_unit-vs-light-cavalry>30.0</general_unit-vs-light-cavalry>
<general_unit-vs-missile-cavalry>40.0</general_unit-vs-missile-cavalry>
<general_unit-vs-heavy-infantry>60.0</general_unit-vs-heavy-infantry>
<general_unit-vs-light-infantry>20.0</general_unit-vs-light-infantry>
<general_unit-vs-missile-infantry>10.0</general_unit-vs-missile-infantry>
<general_unit-vs-spearmen>75.0</general_unit-vs-spearmen>
<general_unit-vs-phalanx>90.0</general_unit-vs-phalanx>
<general_unit-vs-schiltrom>65.0</general_unit-vs-schiltrom>
<general_unit-vs-shield_wall>80.0</general_unit-vs-shield_wall>
<heavy-cavalry-vs-heavy-cavalry>30.0</heavy-cavalry-vs-heavy-cavalry>
<heavy-cavalry-vs-light-cavalry>35.0</heavy-cavalry-vs-light-cavalry>
<heavy-cavalry-vs-missile-cavalry>30.0</heavy-cavalry-vs-missile-cavalry>
<heavy-cavalry-vs-heavy-infantry>45.0</heavy-cavalry-vs-heavy-infantry>
<heavy-cavalry-vs-light-infantry>55.0</heavy-cavalry-vs-light-infantry>
<heavy-cavalry-vs-missile-infantry>10.0</heavy-cavalry-vs-missile-infantry>
<heavy-cavalry-vs-spearmen>70.0</heavy-cavalry-vs-spearmen>
<heavy-cavalry-vs-phalanx>65.0</heavy-cavalry-vs-phalanx>
<heavy-cavalry-vs-schiltrom>70.0</heavy-cavalry-vs-schiltrom>
<heavy-cavalry-vs-shield_wall>80.0</heavy-cavalry-vs-shield_wall>
<light-cavalry-vs-heavy-cavalry>70.0</light-cavalry-vs-heavy-cavalry>
<light-cavalry-vs-light-cavalry>10.0</light-cavalry-vs-light-cavalry>
<light-cavalry-vs-missile-cavalry>35.0</light-cavalry-vs-missile-cavalry>
<light-cavalry-vs-heavy-infantry>65.0</light-cavalry-vs-heavy-infantry>
<light-cavalry-vs-light-infantry>20.0</light-cavalry-vs-light-infantry>
<light-cavalry-vs-missile-infantry>10.0</light-cavalry-vs-missile-infantry>
<light-cavalry-vs-spearmen>80.0</light-cavalry-vs-spearmen>
<light-cavalry-vs-phalanx>85.0</light-cavalry-vs-phalanx>
<light-cavalry-vs-schiltrom>80.0</light-cavalry-vs-schiltrom>
<light-cavalry-vs-shield_wall>80.0</light-cavalry-vs-shield_wall>
<missile-cavalry-vs-heavy-cavalry>80.0</missile-cavalry-vs-heavy-cavalry>
<missile-cavalry-vs-light-cavalry>20.0</missile-cavalry-vs-light-cavalry>
<missile-cavalry-vs-missile-cavalry>25.0</missile-cavalry-vs-missile-cavalry>
<missile-cavalry-vs-heavy-infantry>60.0</missile-cavalry-vs-heavy-infantry>
<missile-cavalry-vs-light-infantry>30.0</missile-cavalry-vs-light-infantry>
<missile-cavalry-vs-missile-infantry>10.0</missile-cavalry-vs-missile-infantry>
<missile-cavalry-vs-spearmen>70.0</missile-cavalry-vs-spearmen>
<missile-cavalry-vs-phalanx>90.0</missile-cavalry-vs-phalanx>
<missile-cavalry-vs-schiltrom>90.0</missile-cavalry-vs-schiltrom>
<missile-cavalry-vs-shield_wall>90.0</missile-cavalry-vs-shield_wall>
<behind-stakes>80.0</behind-stakes>
<vs-heavy-infantry>55.0</vs-heavy-infantry>
<vs-light-infantry>30.0</vs-light-infantry>
<vs-missile-infantry>20.0</vs-missile-infantry>
<vs-spearmen>65.0</vs-spearmen>
<vs-routers>20.0</vs-routers>
I just removed the special lines of infantry and together with my proposal of retreat analyser code they create (in my mod) a very solid mass of infantry and excellent cavalry and missile support, not seen before as I can remember.
It depends from the mod of course.
I will make available the 2 seperate codes as addons to my mod with the Modded Xeryx Envelopement to have the top priority to download as best all purpose AI response proposal of mine
Installation Instructions:
Simply unzip and copy these files (battle_config.xml, config_ai_battle.xml) to replace these of DarthMod. (I offer the typical file structure of a Mod-Switch version).