Heroes of Might and Magic Community
visiting hero! Register | Today's Posts | Games | Search! | FAQ/Rules | AvatarList | MemberList | Profile


Age of Heroes Headlines:  
5 Oct 2016: Heroes VII development comes to an end.. - read more
6 Aug 2016: Troubled Heroes VII Expansion Release - read more
26 Apr 2016: Heroes VII XPack - Trial by Fire - Coming out in June! - read more
17 Apr 2016: Global Alternative Creatures MOD for H7 after 1.8 Patch! - read more
7 Mar 2016: Romero launches a Piano Sonata Album Kickstarter! - read more
19 Feb 2016: Heroes 5.5 RC6, Heroes VII patch 1.7 are out! - read more
13 Jan 2016: Horn of the Abyss 1.4 Available for Download! - read more
17 Dec 2015: Heroes 5.5 update, 1.6 out for H7 - read more
23 Nov 2015: H7 1.4 & 1.5 patches Released - read more
31 Oct 2015: First H7 patches are out, End of DoC development - read more
5 Oct 2016: Heroes VII development comes to an end.. - read more
[X] Remove Ads
LOGIN:     Username:     Password:         [ Register ]
HOMM1: info forum | HOMM2: info forum | HOMM3: info mods forum | HOMM4: info CTG forum | HOMM5: info mods forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Library of Enlightenment > Thread: Diplomacy internals
Thread: Diplomacy internals This thread is 3 pages long: 1 2 3 · NEXT»
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted December 12, 2008 07:55 AM bonus applied by angelito on 12 Dec 2008.
Edited by AlexSpl at 07:27, 17 Dec 2008.

Diplomacy internals

Diplomacy internals (for HoMM III 3.2 and 4.0)

1. [Hero_Power]
Hero_Power = sqrt((1 + 0.05 * Attack) * (1 + 0.05 * Defense));

2. [Total_Army_Power]
Total_Army_Power = floor(Hero_Power * Army_Power);

3. [k]
k = Total_Army_Power / Neutrals_Power;

Note: neutrals number cannot exceed 4000. Have you ever seen more?

4. [Power_Factor] (fixed)
Power_Factor = 11 if k >= 7;
Power_Factor = floor(2*(k - 1)) if 1 <= k < 7;
Power_Factor = -1 if 0.5 < k < 1;
Power_Factor = -2 if 0.333 < k <= 0.5;
Power_Factor = -3 if k <= 0.333;

Note: 0.333 means 333/1000, not 1/3!
Now I am sure


5. [Sympathy]
Sympathy = 0 if there are no creatures of the same kind as neutrals in hero's army;
Sympathy = 1 if there is at least one creature (or upgrade/downgrade) of the same kind as neutrals in hero's army;
Sympathy = 2 if total number of creatures (or their upgrades/downgrades) of the same kind as neutrals in hero's army are strictly bigger than number of all the other beings in the army;

The notes below are for join calculations only!
Note: earth, water and fire elementals don't have upgrades while air ones do!
Note: magma, ice and energy elementals don't have downgrades while storm ones do!


6. [Charisma (Ch)]
Ch = Power_Factor + Diplomacy_Level + Sympathy;

7. [Aggression (X)]
X = -4 (always) for compliant neutrals;
X = 10 (always) for savage neutrals;
X = 1..7 for friendly neutrals;
X = 1..10! for aggressive neutrals;
X = 4..10! for hostile neutrals;

Note: for friendly, aggressive and hostile neutrals Õ is a pseudo-random value which is generated at creation of new game. You can see it when using LM Oracle 3.72 program.

8. if Ch < X neutrals will fight;

9. if Ch >= X there are two cases:
a) if Sympathy + Diplomacy_Level + 1 >= X neutrals will join for free;
b) Only if the first condition is false: if Sympathy + 2 * Diplomacy_Level + 1 >= X neutrals will join for gold provided you have enough money to buy them all (no resources are needed).

Note: if you reject an offer to join monsters:
a) flee (if Ch > X and they CAN flee i.e. they are not set to never flee);
b) take offence and attack (if Ch = X).


Note: on Easy difficult all heroes have a hidden Diplomacy level which is used for join calculations (only?). For example, if your hero has Basic Diplomacy then Diplomacy_Level is two instead of one. Nevertheless, Diplomacy_Level cannot exceed three

-----
2Rainalcar:
In your case Ch = 0 + 3 + 2 = 5 (Power_Factor = 0, Diplomacy_Level = 3, Sympathy = 2).

Sympathy + Diplomacy_Level + 1 = 2 + 3 + 1 = 6.
Sympathy + 2 * Diplomacy_Level + 1 = 2 + 6 + 1 = 9.

So, you couldn't join neutrals with X > 5 (they fight you).
if X <= 5 AA's always join for free because 6 >= X is true in this case.

There are the next cases for hostile neutrals:
a) X = 6, 7, 8, 9, 10 out of X = 4, 5, 6, 7, 8, 9, 10 => fight (in your case)/flee probability is 5/7 = 71%;
b) X = 4, 5 out of X = 4, 5, 6, 7, 8, 9, 10 => free join probability is 2/7 = 29%.

Now try to make the same test with 20 AA's of yours vs 10 AA's!
Power_Factor = 2, Ch = 2 + 3 + 2 = 7.
In this case you will never join neutrals with X > 7.
If X = 7, for example, you will never join them for free as well (6 >= 7 is false) but you easily join them for gold (9 >= 7 is true)!

For hostile neutrals in this case:
a) X = 8, 9, 10 out of X = 4..10 => fight/flee probability is 3/7 = 43%;
b) X = 7 out of X = 4..10 => money join probability is 1/7 = 14%;
c) X = 4, 5, 6 out of X = 4..10 => free join probability is 3/7 = 43%.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
friendofgunnar
friendofgunnar


Honorable
Legendary Hero
able to speed up time
posted December 12, 2008 08:08 AM

I always wondered about this.  How did you find all this out?

 Send Instant Message | Send E-Mail | View Profile | PP | Quote Reply | Link
Xarfax111
Xarfax111


Bad-mannered
Supreme Hero
The last hero standing
posted December 12, 2008 02:45 PM

Hi Alex,

thanks for those infos!

There is lot of maths ...maybe can you explain it in easy words for me ?

Xarfax1
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
rainalcar
rainalcar


Promising
Famous Hero
Heroji su zakon
posted December 12, 2008 03:03 PM

Ch can exceed 10 as it can be seen, but I presume that neutrals with X 10 will still never join? I have never seen that in all of my tests.

I figured "random" numbers for hostile etc. creatures correctly . They also mean that the average mood of Friendly creatures is 4, Aggressive 5,5, Hostile 7.

Quote:
8. if Ch < X neutrals will fight or try to flee (this depends on Power_Factor)


Could you explain when will they flee and when will they fight exactly, what is the break point?

Quote:

Note: if you reject an offer to join monsters may take offence and attack (this also depends on Power_Factor)


Same as above.


Quite incredible how complicated they made diplomacy in this game, and still made it so horribly unbalanced

Oh yes, a must QP, brilliant stuff. I'm on my way to include it all in the manual .



____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted December 12, 2008 04:06 PM

2Rainalcar: Yes, Ch may exceed 10 (max Ch = 11 + 3 + 2 = 16)
Nevertheless, you still can't join monsters with X = 10 as max[Sympathy + 2*Diplomacy_Level + 1] = 2 + 2*3 + 1 = 9 < 10!

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
rainalcar
rainalcar


Promising
Famous Hero
Heroji su zakon
posted December 12, 2008 04:14 PM

Yes, I noticed afterwards

And the flee/fight thingie? There is one question too in Admiral Hat thread
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted December 13, 2008 07:32 PM

I've just updated my post #1. Enjoy!

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Xarfax111
Xarfax111


Bad-mannered
Supreme Hero
The last hero standing
posted December 16, 2008 10:12 PM

Thats what i posted last year Damnit where is my Quality point?

I really like angelitos personal dislike



posted October 10, 2007 06:57 PM  

--------------------------------------------------------------------------------
quote:
--------------------------------------------------------------------------------
float heroStrength = sqrt ( (attack * 0.05 + 1)*(defence * 0.05 + 1) );
float k = heroStrength * heroArmy / monsterArmy;

int v;
if (k >= 7.0) v = 11;
else if (k >= 1.0) v = (k - 1) *2;
else if (k >= 0.5) v = -1;
else if (k >= 0.333) v = -2;
else v = -3;

if ( aggression > v + diplomacy + oneUnitBonus) Attack();
else if ( aggression <= diplomacy + oneUnitBonus + 1) Join();
else if ( agression <= 2*diplomacy + oneUnitBonus + 1) MoneyJoin();
else Flee();


Monster aggression can be set from 0 to 10 in the editor.
--------------------------------------------------------------------------------



Interesting:

First the Heroes Strengh will be Calculated. Primary Skills Attack and Defense do have a slight influence to the outcome (While people thought Diplomancy on a MAIN hero is a lost skill, let a scout do it).

The Calculated Heroes Strengh raise the Army Strength. The Army Strengh will be compared with Monster Army Strengh by dividing it.

The Comparison will leed to penalties:

50% =-1 33%=-2 even weaker -3

I assume that diplomcy skill is plus 2 per level. I assume that The UniteBonus (for the same alignment) is plus 1.

The if else routine shows the decision calculation. If the agression setting is higher then AmryStrenghPenalty + Diplo +Alignment the result is Join().

Other options are Attack, MoneyJoin or Flee.

The creatures can be set from 0 to 10. I assume that the creature settings can vary between two points (like 2 or 3).
____________


--------------------------------------------------------------------------------
Send Instant Message | Send E-Mail | View Profile | Edit Post | Quote Reply  

Xarfax111



Bad-mannered
Supreme Hero
The last hero standing
 posted October 11, 2007 04:41 PM  Edited by Xarfax111 at 16:45, 11 Oct 2007.

--------------------------------------------------------------------------------
...well its an "unconfirmed information from an unknown source"...thats why i put it in question marks - open for discussion.

If you go through the lines it looks all logic and suits to game experiences.

I thought it would be interesting, thats why i posted it here.

Xarfax1

Maybe the aggression level vary between two number per level on a random basis. Like 0-1 2-3 4-5 5-6 7-8 9-10. Plus if aggression is 0, it wont be calculated = always join.

According to the formel there are the following influences:

- Hero Attack and Defense
- Army Strengh
- Diplomancy Level
- Creatures Alighnment

Which other influences do you think are involved? Maybe we can test that.

@Dimis: Thanks for your comment, wouldve been nice to see results of a hardcore tester. You are one of the few peeps -like Maretti, Binabik and Angelito -why im still visiting this site.

@Demarest: There is a txt-file for AI calculations extracted from the lod files of H3. There is a list of all creature points. When i remember correct its called CreatureTraits.txt. Maybe someone can publish it here. Would be cool to see some testings from you.

Xarfax1  


____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted December 17, 2008 07:31 AM

Quote:
float heroStrength = sqrt ( (attack * 0.05 + 1)*(defence * 0.05 + 1) );
float k = heroStrength * heroArmy / monsterArmy;

int v;
if (k >= 7.0) v = 11;
else if (k >= 1.0) v = (k - 1) *2;
else if (k >= 0.5) v = -1;
else if (k >= 0.333) v = -2;
else v = -3;

if ( aggression > v + diplomacy + oneUnitBonus) Attack();
else if ( aggression <= diplomacy + oneUnitBonus + 1) Join();
else if ( agression <= 2*diplomacy + oneUnitBonus + 1) MoneyJoin();
else Flee();



This is not quite accurate because, for example, if k = 0.5 then v = -2 not -1!

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
demarest
demarest


Known Hero
posted October 25, 2013 09:12 AM

AlexSpl said:
2. [Total_Army_Power]
Total_Army_Power = floor(Hero_Power * Army_Power);

3. [k]
k = Total_Army_Power / Neutrals_Power

I don't follow. I seems to me that here, both Army_Power and Neutrals_Power are undefined. Can anybody elaborate? Were these considered givens due to common knowledge back in 2008?

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
hippox89
hippox89


Famous Hero
posted October 25, 2013 01:21 PM
Edited by hippox89 at 13:26, 25 Oct 2013.

In practical terms, at least, the stronger and more creatures in your army and in the wandering stack is used to determine whether or not a stack will flee or not.

I'm not sure how exactly this strength is determined, but it must be factors like attack/defence of the individual creature.

I'm sure AlexSpl knows for sure, of course.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted October 30, 2013 01:24 AM

You can find those values there.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Maurice
Maurice

Hero of Order
Part of the furniture
posted February 28, 2014 01:33 PM

I just came across this post after following a link provided by Hippox89, but the link in the post just above this one, by AlexSpl, is dead. Is the info still available somewhere?

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Vampire_Rush
Vampire_Rush


Adventuring Hero
posted October 15, 2014 12:59 PM

I have the same question as stated above.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
kicferk
kicferk


Known Hero
posted October 15, 2014 02:42 PM

Your best bet would be tribute to strategies:
Tribute to strategies

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted October 15, 2014 10:30 PM

If you are interested in diplomacy internal, you might also like this program (x64 only).

Start the HoMM III (3.2, 4.0 and HotA 1.3.3 are supported so far), load a savegame or start a new game. Start the program, choose your game version (Options -> Version), press the "Start" button, right-click on the grid and add some heroes. Double-click on a hero's name to start the "Adventure Oracle" and hover the mouse over monsters to see if they would like to join your army (all the variables are desribed in this thread). You can also double-click on a hero's number to see his level-up tree. To change depth of calculations choose "Options -> Skill Tree Depth". Have fun

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Vampire_Rush
Vampire_Rush


Adventuring Hero
posted October 16, 2014 01:58 PM

I found it on page 22, thanks =).

AlexSPL, do you mean that there is more to learn from the program you shared than this thread? It seems pretty complete to me.

Is it possible to cheat in multiplayer as well with that program?

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted October 16, 2014 06:33 PM
Edited by AlexSpl at 18:46, 16 Oct 2014.

Quote:
AlexSPL, do you mean that there is more to learn from the program you shared than this thread? It seems pretty complete to me.

You can see how things work in practice. Btw, J (Join_value) = Sympathy + Diplomacy_Level + 1, JG (Join_for_Gold_value) = Sympathy + 2 * Diplomacy_Level + 1, SF stands for Power_Factor ('strength factor'), DL - Diplomacy_Level, Sym - your guess? Also, I didn't say that if Ch > X and you can't join monsters (because J < X or JG < X), they just flee if allowed to.

Quote:
Is it possible to cheat in multiplayer as well with that program?

Nope.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
bloodsucker
bloodsucker


Legendary Hero
posted May 19, 2016 03:04 AM
Edited by bloodsucker at 03:05, 19 May 2016.

About Sympathy: I had an hero with just 75 giants and was trying to get a stack of Titans, on the way 118 cerberi joined (so way less then the strength of giants...).
Without the cerberi they would join for money, with them they flee. So there is a forth degree of sympathy, to have only those creatures in army.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
batoonike
batoonike


Known Hero
posted May 20, 2016 08:56 PM

In the above case with 75 giants you had the "army consists mostly of giants" bonus. When you took dogs, your army didn't consist mostly of giants any more, because only the number of units matter. The strength doesn't matter. If you took 76 peasants you would lose the bonus.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread » This thread is 3 pages long: 1 2 3 · NEXT»
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.0691 seconds