| AI's skill priorities | This thread is pages long: 1 2 3 · «PREV |
|
AlexSpl

   
    
Responsible
Supreme Hero
|
posted May 03, 2020 06:31 PM |
|
Edited by AlexSpl at 09:23, 04 May 2020.
|
Corrected coefficients for Archery and Scholar (thanks to Ben80).
1. Archery
Value = [(500 + Ranged_Units_Power) * k / 100], where
k = 16, for Basic Archery;
k = 7, for Advanced Archery;
k = 11, for Expert Archery.
18. Scholar
Value = [the_strongest_spell_efficiency_delta(1, 1, 0, 0, 0, 0, 0) * Spell_Power * 1/10],
if a hero has Wisdom, otherwise 0;
|
|
BigPig2

 
 
Adventuring Hero
|
posted April 14, 2026 06:49 PM |
|
Edited by BigPig2 at 23:27, 14 Apr 2026.
|
So I'm gonna go ahead and necro this 8yrs old thread because what I have found is highly relevant and I believe the OP is still looking for answers about this.
Using the IDA Free tool to explore the code sections that AlexSpl pointed out I can elaborate on some of his comments and add a couple of my own.
There is a table of 28 pointers (addresses) in SoD + HD exe starting at 125184 with 19 4C 52 00 (124C19 in the exe) for Pathfinding (skill number 0). You can see some of them will repeat as per AlexSpl's list of formulas on page 1 in this thread. Notably, Tactics (skill 19) and Armorer (23) have their own (identical, although in the latter case with order of 2 instructions switched - I can't tell if this might have consequences) formulas written out under separate addresses from their counterparts on the list, providing space for potential new, easy to use formulas. Also, if you want to assign your chosen skill one of the other existing formulas it is as simple as switching the value assigned to it on this list to the one assigned to your target other skill, in fact, you can even assign the exact same formula to all 28 of them, please report your observations if you do, I am very curious what happens.
All or most formulas of the form: Value = [(1000 + Army_Power) * Constant/10^n can be relatively easily adjusted in certain ways. Majority of them use an "shr/sar" operation as part of their optimised division by 10 or 100, an operation which is essentially a division by a power of 2. Reducing the argument by 1 results in value doubling, increasing it by 1 results in the value halving etc, for example the code for Ballistics, (formula: Value = [(1000 + Army_Power) * 1/8]), starting at 124D73:
mov eax, edi
pop edi
cdq
and edx, 7
pop esi
add eax, edx
sar eax, 3 (C1 F8 03 at 124D7D-F in SoD + HD exe)
mov esp, ebp
pop ebp
retn 4
can be changed to 1/4 by changing the 3 to 2 or to 1/16 by changing it to 4 (I think, back up before trying!). U get the point. This isn't the only but by far the easiest way to adjust these values. If this is confirmed to work I can write up where this instruction (and the other similar one: SHR) occurs for each skill I find it in. There is more ways to change these values by messing with the values used for the division by 10/20/50/100 but I am still figuring it out.
The 1/2 in Widsom's formula is, as far as I can understand, the D1 F8 at 124D01-2 and 124CE6-7 (this appears to be a shorter, optimised version of C1 F8 01, the formula is fragmented into multiple cases, that's why this happens in at least these two spots) so if you NOP it out (put 90 90 in its place, or, to double it once again: D1 E0) your AI value for Wisdom should immediately double (again, I THINK, no promises at this point). Alternatively, it should be easy to give Wisdom doubled or even quadrupled Ballistics value for example (by changing the C5 4C 52 00 into 73 4D 52 00 at 1251A0 and adjusting as per above), that should settle it for good..
|
| |
|
|