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 ]
New Server | HOMM1: info forum | HOMM2: info forum | HOMM3: info forum | HOMM4: info forum | HOMM5: info forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Library of Enlightenment > Thread: Tribute to Strategists
Thread: Tribute to Strategists This thread is 18 pages long: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 · «PREV / NEXT»
AlexSpl
AlexSpl


Responsible
Supreme Hero
posted December 15, 2014 11:40 PM

Salamandre, try these coordinates x = 14, y = 13, z = 0 and say what R1 will you have?

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


Admirable
Omnipresent Hero
Wog refugee
posted December 15, 2014 11:40 PM
Edited by Salamandre at 23:45, 15 Dec 2014.

Ok, it seems to work very well, under 50 I always get upgraded, over 50 not upgraded. here is the final script, changed to trigger when you click on monster.

ZVSE

!?CM0;
!!CM:P?y2/?y3/?y4; get location of click
!!OBy2/y3/y4:T?y5;
!!FU&y5<>54:E; exit if not monster
;R1 = a*x + b*y + c*z + d
!!VRy5:S196143423*y2;
!!VRy6:S928924629*y3;
!!VRy7:S348991063*y4;
!!VRv2:Sy5+y6+y7+2148842073;
;R2 = R1 / 65536 (integer division here!)
!!VRv3:Sv2:65536;
!!VRv3&v3<0:+65536;
;R3 = R2 % 32768
!!VRv4:Sv3%32768;
;R4 = R3 % 100
!!VRv5:Sv4%100;
!!IF:M^%V5^;

@Alex, one moment, I try. I got R1=-208999012 but R4=78 and stack was not upgraded.

____________
All my Era II mods

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


Responsible
Supreme Hero
posted December 15, 2014 11:46 PM

Try this:

1. R1 = a*x + b*y + c*z + d
2. R2 = R1 / 65536 (integer division here!)
3. R3 = R2 % 32768
3a. If R3 < 0 then R3 = R3 + 32767
4. R4 = R3 % 100

Where

a = 196143423
b = 928924629
c = 348991063
d = 2148842073

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


Admirable
Omnipresent Hero
Wog refugee
posted December 15, 2014 11:48 PM

I tried, got exactly same R4 as before. 78.
____________
All my Era II mods

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


Responsible
Supreme Hero
posted December 15, 2014 11:51 PM
Edited by AlexSpl at 23:52, 15 Dec 2014.

Well, now you might wanna do some testing

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


Admirable
Omnipresent Hero
Wog refugee
posted December 15, 2014 11:53 PM
Edited by Salamandre at 00:12, 16 Dec 2014.

ok, who wanna test also?

ZVSE
;click on monster stack.
;will display message if stack has upgraded form

!?CM0;
!!CM:P?y2/?y3/?y4; [get location of click]
!!OBy2/y3/y4:T?y5;
!!FU&y5<>54:E; [exit if no monster stack]
!!VRy5:S196143423*y2;
!!VRy6:S928924629*y3;
!!VRy7:S348991063*y4;
!!VRv2:Sy5+y6+y7+2148842073;
!!VRv3:Sv2:65536;
!!VRv4:Sv3%32768;
!!VRv4&v4<0:+32767;
!!VRv5:Sv4%100;
!!IF&v5<50:M^These neutrals have upgraded stack^; [display result]

Thanks both
____________
All my Era II mods

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


Responsible
Supreme Hero
posted December 15, 2014 11:55 PM

Quote:
;if result >50, stack does not have upgrade

You mean, if result >= 50 ...

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


Admirable
Omnipresent Hero
Wog refugee
posted December 15, 2014 11:56 PM
Edited by Salamandre at 00:05, 16 Dec 2014.

Fixed, sorry. Sunday I go holidays and I will start to look into split algorithms. If you have any extra data which could help me, please, especially about those tiles cases
____________
All my Era II mods

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


Responsible
Supreme Hero
posted December 16, 2014 12:05 AM

Now we should probably concentrate on the splitting problem, shouldn't we?

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


Admirable
Omnipresent Hero
Wog refugee
posted December 16, 2014 12:06 AM
Edited by Salamandre at 00:09, 16 Dec 2014.

From Friday, for me. I feel we will make it.

btw, I only tested on small map, the upgraded coded will be compatible with bigger sizes too or need different values?
____________
All my Era II mods

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


Responsible
Supreme Hero
posted December 16, 2014 12:08 AM

Quote:
From Friday, for me. I feel we will make it.

No doubt

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


Responsible
Supreme Hero
posted December 16, 2014 12:11 AM
Edited by AlexSpl at 00:23, 16 Dec 2014.

Quote:
btw, I only tested on small map, the upgraded coded will be compatible with bigger sizes too or need different values?

Yeah, in LMOracle this code works fine for 252x252.

Here, btw, the link to the latest version with HotA 1.3.3 support:
http://handbookhmm.ru/forum/download/file.php?id=564

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


Known Hero
posted December 16, 2014 12:21 AM

Ok, I played with it, and it seems to be working

I found one case in which the result said there would be upgraded stack and did I not get one. But it was due to the splitting. I had large army, and I got the rare case of 1 stack and upgraded stack together.

I tested again with the same save but smaller army, and got an upgraded stack. Which means that for the next part, the case with small number of stacks can have upgrades, but it won't have any if you only fight one stack. It also means I did not find any case of the script not working

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


Responsible
Supreme Hero
posted December 16, 2014 12:34 AM

Of course, if you face a single stack it will never be upgraded unless you're attacking upgraded monsters. You also will never see an upgraded stack when fighting monsters who don't have upgrades

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


Responsible
Supreme Hero
posted December 16, 2014 07:06 PM bonus applied by angelito on 21 Dec 2014.
Edited by AlexSpl at 19:09, 16 Dec 2014.

The Splitting Problem

1. Find both Army_Power and Neutrals_Power. They are just the sum of AI values of all creatures in the corresponding armies. A powerful hero at your side doesn't change anything.

2. Find k = Army_Power / Neutrals_Power.

3. Determine the basic splitting:

k < 0.5 then 7 stacks
0.5 <= k < 0.67 then 6 stacks
0.67 <= k < 1 then 5 stacks
1 <= k < 1.5 then 4 stacks
1.5 <= k < 2 then 3 stacks
k >= 2 then 2 stacks

Note:
Here all the floating point numbers are of double precision, or type; sizeof(double) = 8 bytes.


4. Find the actual splitting:

1. R1 = a*x + b*y + c*z + d
2. R2 = R1 / 65536 (integer division here!)
3. R3 = R2 % 32768
3a. If R3 < 0 then R3 = R3 + 32767
4. R4 = R3 % 100 + 1

Where:
a = 1550811371
b = -935900487
c = 1943276003
d = -1120346418

Then,
if R4 <= 20 decrease the number of stacks by 1
if R4 >= 80 increase the number of stacks by 1 unless you have already 7.

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


Admirable
Omnipresent Hero
Wog refugee
posted December 16, 2014 07:45 PM
Edited by Salamandre at 19:46, 16 Dec 2014.

Thanks, finding AI value is easy, but getting two values percentage in erm I have no clue how, asked in russian forums and waiting. We can only use addition, extract, multiply, division, remainder and integers thus this link didn't help me much.

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


Responsible
Supreme Hero
posted December 16, 2014 07:47 PM

You should finally start to use floating point numbers

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


Admirable
Omnipresent Hero
Wog refugee
posted December 16, 2014 08:01 PM

Hmm, confused. I am testing and have this:

18400 our army value
10500 neutrals AI value

Result gives me that our army is 175% more powerful. Is this correct? Then I get only 3 stacks split, which suggest our army is 200% better
____________
All my Era II mods

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


Responsible
Supreme Hero
posted December 16, 2014 08:07 PM

However, you can still use integers.

For example,

0.5 <= k < 0.67 means 1/2 <= Army_Power / Neutrals_Power < 67/100, or:

1 * Neutrals_Powers <= 2 * Army_Power
and
100 * Army_Power < 67 * Neutrals_Power

Is this idea clear enough?

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


Responsible
Supreme Hero
posted December 16, 2014 08:13 PM
Edited by AlexSpl at 20:16, 16 Dec 2014.

Quote:
Result gives me that our army is 175% more powerful. Is this correct? Then I get only 3 stacks split, which suggest our army is 200% better


Not exactly. If your army is 175% more powerful then you will face (3 + Deviation) stacks, where Deviation is -1, 0, or 1. If your army were 200% more powerful, you would have encountered (2 + Deviation) stacks.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread » This thread is 18 pages long: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 · «PREV / NEXT»
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.0996 seconds