Author Topic: Improving the auto resolve system  (Read 7595 times)

0 Members and 1 Guest are viewing this topic.

Twan

  • Sergeant Knight
  • *
    • View Profile
    • SoD Auxiliarii Variant
  • Faction: Neutral
Improving the auto resolve system
« on: March 16, 2009, 12:07:21 PM »
I've made this for my Auxilarii variant of Sword of Damocles, but as it may interest other modders to adapt or developp more this system to improve realism, I signal it here.

I've make a script to determine terrain for AI vs AI battles (may need some changes on modded maps with lot of reliefs as my "mountain" terrain is based on the z coordinate and altitude is rather low in Calradia) and return a troop slot number for the appropriate bonus (need of course to add these troops slots in constants, with the good numbers).

Then I've modified the script evaluating strength to make it use this bonus (the bonus being in a troop slot, and the number of this slot being send as a script parameter - also needs to add a call to the determine terrain script and add the terrain parameter to the calls to the "evaluate strength script" in the "event_simulate_battle" one).

The way I've given bonuses to all units isn't perfect as I wanted to make well geared troops as elite in autoresolve as they are in 3d combat, I had to make a long (try_else) script to check each troop id (adapting it need to cut the references to SoD or auxilarii mod specific units), and give a note to their gear myself then formulaes to determine the bonuses on each terrain based on gear. But a more generic system should be easier to do, ie giving the same terrain bonuses to all mounted troops.


--

Other interesting tricks  :
 - changing AI lords optimism (how they evaluate their own strength, key to make them more or less agressive), for that you need to add a multiplier to ":our_strength" everywhere it's used in AI calculations scripts (and the process siege simple trigger), but not in the evaluate strength script (as this strength is stored in the cached_strength party slot and used when a lord evaluate the strength of ennemy lords) ;
 -  an easy to use method for making AI lords troops quality improve other time (need to add factions with different reinforcements templates then you can use a trigger changing the value of  the "troop_original_faction" slot of kingdom heroes to make them get better templates at regular intervals).
« Last Edit: March 16, 2009, 01:33:32 PM by Twan »

kt0

  • Knight
  • *
    • View Profile
  • Faction: Swadian
Re: Improving the auto resolve system
« Reply #1 on: March 16, 2009, 02:34:51 PM »
We had a lively discussion not long ago about this very topic.  If you haven't already done so, you can read all about it here:  http://forums.taleworlds.com/index.php/topic,58962.0.html.

As I spend more time digging through the autoresolve code (in all, what, five of its incarnations?) I'm noticing more and more things that are...questionable.  As a quick for instance, I spent most of Sunday morning debugging why autoresolving a siege battle didn't give the right strength values.  It turns out that this particular function didn't take into account any parties present in the city being sieged when doing strength and "how many defenders are left" calculations.  Curious!  (I'd post details about which function that is specifically but I'm at work waiting on a build and don't have the code with me.)

I have a fix but not a pretty one that I'd be happy to share if people are interested once I get it cleaned up.  This evening I plan on digging through more of the other autoresolve incarnations to see if they share the same deficiencies as the siege one.


Twan

  • Sergeant Knight
  • *
    • View Profile
    • SoD Auxiliarii Variant
  • Faction: Neutral
Re: Improving the auto resolve system
« Reply #2 on: March 16, 2009, 02:57:54 PM »
Thanks, very interesting.

Mordachai

  • Squire
  • *
    • View Profile
  • Faction: Neutral
Re: Improving the auto resolve system
« Reply #3 on: March 16, 2009, 04:21:14 PM »
More and more I'm seeing other modders and myself running up against the module system's biggest limitation: no way to access all of the information present in the various lists.

e.g. you can't evaluate all of the information about an item - most of it is only available to the engine, and it makes no effort to allow the module system access to it.  Same thing for troops & party templates - there are very limited amounts of information one can access - making these ridiculous try/else/end constructs and customizations for every mod out there :(.  Yuk!

I wonder if anyone at TaleWorlds is aware of how limiting this is?

EDIT: Rubik's innovative use of python to generate compile-time scripts to transfer that information into slots is a brilliant, and comprehensive solution to this problem.  We just need to come up with an algorithm that makes better sense, and I'll even volunteer to write the code.
« Last Edit: April 01, 2009, 04:29:40 PM by Mordachai »

Nemeo

  • Sergeant at Arms
  • *
    • View Profile
  • Faction: Neutral
Re: Improving the auto resolve system
« Reply #4 on: April 01, 2009, 01:33:59 PM »
Kt0, your fix would definetely improve the game. I'd be glad if you could share it with us.
Seigneur, s'il y a un seigneur, sauvez mon âme, si j'ai une âme. - Ernest Renan (1823-1892)

DMcain

  • Veteran
  • *
    • View Profile
  • Faction: Neutral
  • M&BWB
Re: Improving the auto resolve system
« Reply #5 on: April 01, 2009, 03:03:50 PM »
Auto-Resolve?  pfft.  I quit using that useless 'feature' when 6 looters killed 7 of my 42 swadian knights.

kt0

  • Knight
  • *
    • View Profile
  • Faction: Swadian
Re: Improving the auto resolve system
« Reply #6 on: April 01, 2009, 04:01:37 PM »
Sadly, I haven't gotten back to it in a while.  The biggest issue is that there are six (!) places where autoresolve is done.  Fixing all of them and more importantly testing all of them is difficult at best.  It's on my list but I don't know when I'll get to it.

Frodogorn

  • Recruit
  • *
  • Permanently Banned
    • View Profile
  • Faction: Neutral
Re: Improving the auto resolve system
« Reply #7 on: April 01, 2009, 04:20:04 PM »
Only cowards and whoremongers use autoresolve! The mighty Frodogorn commands this heresy to cease!

MartinF

  • Squire
  • *
  • Down Under
    • View Profile
  • Faction: Neutral
Re: Improving the auto resolve system
« Reply #8 on: April 01, 2009, 04:38:37 PM »
Only cowards and whoremongers use autoresolve! The mighty Frodogorn commands this heresy to cease!

Actually the game also uses it to resolve all AI vs AI fights.. ;)

But on a more serious note, I think now that we have code (thanks to Rubik, fisheye and Mordachai) that allows us some more information about units, there's a lot more to work with to make a proper auto-resolver.

+Knight

  • Regular
  • *
    • View Profile
  • Faction: Neutral
Re: Improving the auto resolve system
« Reply #9 on: April 01, 2009, 05:10:50 PM »
And where can I find that awesome piece of code?
NOT PEACE BUT A SWORD

Mordachai

  • Squire
  • *
    • View Profile
  • Faction: Neutral
Re: Improving the auto resolve system
« Reply #10 on: April 01, 2009, 06:22:57 PM »
And where can I find that awesome piece of code?
Someone needs to put all of these ideas together... that's not been done yet.

Step 1: folks complain about auto-resolve (it sucks).
Step 2: folks think about how to improve it and quickly hit wall realizing that most of the important information such a function needs is not in MS - no way to know armor value of armor, or weapon damage values of weapons, so hard to write anything that takes these into account
Step 3: Rubik solves for how to bring this info into MS using Python & slots trick.
Step 4: <- You are here...

 8-)

+Knight

  • Regular
  • *
    • View Profile
  • Faction: Neutral
Re: Improving the auto resolve system
« Reply #11 on: April 01, 2009, 06:51:04 PM »
Seriously looking to move past Step 4 8-)
NOT PEACE BUT A SWORD

Nemeo

  • Sergeant at Arms
  • *
    • View Profile
  • Faction: Neutral
Re: Improving the auto resolve system
« Reply #12 on: April 01, 2009, 09:03:38 PM »
I think that one of you might help me. I've redirected the "inflict_casualties_to_party_group" operation to the "inflict_casualties_to_party" script.

The first time AI heroes never died during AI vs AI battle.

I found the problem: a line in "party_count_fit_regulars" prevented heroes from taking damage. I changed it and it worked: AI lord eventually got 0% hp but now I have another problem. Parties never disband! In fact there is always a unit alive in the party. Always.

Did you experience this as well, or do you know what the problem is ?
« Last Edit: April 01, 2009, 09:07:25 PM by Nemeo »
Seigneur, s'il y a un seigneur, sauvez mon âme, si j'ai une âme. - Ernest Renan (1823-1892)

Mordachai

  • Squire
  • *
    • View Profile
  • Faction: Neutral
Re: Improving the auto resolve system
« Reply #13 on: April 01, 2009, 09:09:12 PM »
Nemo - I'm just thinking out loud here, but I would expect that you have to actually remove that troop from the party, and then delete the party to actually get it to disband.

If you look around - I'm sure that there is code that handles killing a party.  But only causing damage to a party isn't going to disband it.  The game doesn't have a sweeper function that finds parties and kills them - its up to your code to explicitly do so.

Nemeo

  • Sergeant at Arms
  • *
    • View Profile
  • Faction: Neutral
Re: Improving the auto resolve system
« Reply #14 on: April 01, 2009, 09:12:48 PM »
interesting. thanks.

Does the game automatically respawn lords? (I remember reading somewhere that it does every 48h)

However I would have to rewrite the capturing lord thing and I don't feel like it.
« Last Edit: April 01, 2009, 09:15:30 PM by Nemeo »
Seigneur, s'il y a un seigneur, sauvez mon âme, si j'ai une âme. - Ernest Renan (1823-1892)