Video information

Added on

Uploaded by

hdggDalton

About this video

I made an expert AI, loaded up a save with a bunch of legionary companions from the "distinguished service" mod with 150-200 melee skill, and entered a tournament in Danustica to see how they performed. To be honest I was blown away by watching the 1v1's of the AI actually blocking and having a swordfight longer than 10 seconds, though it may have been rigged since I ran a mod that increased armor effectiveness.

While the vanilla AI is great for beginners, even the "challenging" AI is pathetic against veteran players. Turns out the AI is severely handicapped; at "normal" difficulty, only 10% of its weapon skill actually counts towards making the AI fight better, increasing to 32% at "veteran" difficulty and 96% at "challenging".

It doesn't sound too bad, but the game divides the AI's weapon skill by 350 to produce a number between 0 to 1, 0 meaning 0 skill and 1 meaning 350 skill, and decimal numbers for everything in between, for example 0.5 meaning 175 skill. In comparison, an Imperial Legionary has 130 one handed skill, which is less than half of that. A Vlandian Banner Knight has 220 one handed skill, which is about 63% of maximum proficiency.

Even worse, some of the AI parameters raise that number I mentioned earlier to a power of greater than 1. Because that number is generally a decimal, multiplying a decimal by itself only makes it smaller, thus making the slope to "actual" maximum combat proficiency even steeper near the end, rather than near the start, where most units have their skill levels at.

Using dnSpy (https://github.com/dnSpy/dnSpy) I found where the game sets AI combat parameters. Use dnSpy to open the TaleWorlds.MountAndBlade DLL file, open it until it gets to a long list of yellow text, open the one named "TaleWorlds.MountAndBlade" then click on the method "AgentStatCalculateModel" and scroll down until you hit something that says "SetAiRelatedProperties". You want to find the parts that say something like "Math.Pow((double)num, 2.0)". Num is the "skill" of the AI ranging from 0 to 1, and the Math.Pow raising it to the 2nd power in this case, multiplying it by itself. Change that 2.0 to 0.5, which will make it so proficiency gains occur at lower skill levels, rather than extremely high skill levels that no units are ever going to reach.

Graph of how weapon skill affects actual combat proficiency depending on how the "Num" is squared: https://www.desmos.com/calculator/c77...

You may want to tinker around a bit with the other numbers and have a look around the other methods that make the game tick. Don't forget to make a backup of the original just in case you want to go back, or something goes wrong. And when you're done, don't forget to click File at the top left and Save All to actually apply the changes. Make sure to set the AI difficulty to "Challenging" so the AI fights at its best. Of course your AI won't be a perfect expert the first time around, neither is mine, you just gotta keep experimenting...

  • Share

0 comments