Explore GameReplays...

Rise of the Witch King

Random revisited

Reply to this topic Start new topic
# 1brabox May 19 2015, 22:07 PM
Intro:
gamereplays.org/community/index.php?showtopic=755440

Not very conclusive. This time around, things are getting more prostrat as I have created a macro to do the data collection part and as such I can execute many tests in a relatively short amount of time with me doing something else. (+/- 35 sec per run or 822 in 8 hours). Huzzah.


First test (control)

NOTE: The macro uses the keyboard to get to FoI2 (10 down presses). This
is different from what most players do.
Results:
CODE

Map: FoI2   ||   Opponent: Brutal
CaH: No     ||   RH: Yes
Teams: -    ||   Colours: ?

NOTE: The macro uses the keyboard to get to FoI2 (10 down presses). This is different from what most players do. Results:

Mordor:    9    6.25%
Angmar:    31   21.53%
Elves:     36   25.00%
Dwarves:   22   15.28%
Isengard:  28   19.44%
Goblins:   18   12.50%
Men:       0    0.00%


Actually better than expected, still men is obviously broken. The probability of any one faction not being picked at least once is terribly small and horrible to calculate. To give you a feel, this is probably a good approximation:
Chance of motw not being picked in 144 trials: ((6/7)^144) = 0.000000000289 (2.289e-10) or 0.0000000289%
Since there are 7 factions that could have not been picked, multiply by 7 gives: 1.6024e-9 (I know I'm ignoring overlap).

Fun comparison: the probability of somebody randomly guessing a 4-digit PIN within 3 attempts is about 0.0003. (3e-4). That's more than 180000x more likely to have happened to me than this outcome (if rotwk RNG was fair).

So what I wanted to ask was, which factors would you like to test? Skirmish profiles? Video/sound settings? Game specific settings (colour/team/map)? Good/evil CaH settings (is is 1/4 probability to get mordor with an evil CaH or is that screwed up too)?


Would be cool to have RandomEvil and RandomGood crappy CaHs in 2.02 v5.0 that aren't worth their money.


Second Test (map)

So... I ran a new test with 3 simultaneously executed, alternating scenarios (to minimize the effect of time-based factors). Unfortunately, I played some games before doing the run and I forgot to reset the colour so now all runs have player 1's colour set to green.
Scenarios:
1. Control scenario
2. Argonath (first map in the list, so no action to select map)
3. Argonath (scrolling 5 maps up and down again to match the 10 key presses in the control scenario)

Results:
CODE

Scenario 1
Map: FoI2   ||   Opponent: Brutal
CaH: No     ||   RH: Yes
Teams: -    ||   Colours: Green

Dwarves   47    18.50%
Mordor    46    18.11%
Angmar    52    20.47%
Men       43    16.93%
Elves     12    4.72%
Goblins   36    14.17%
Isengard  18    7.09%
Sum       254   100.00%

Scenario 2
Map: Argonath  ||   Opponent: Brutal
CaH: No        ||   RH: Yes
Teams: -       ||   Colours: Green

Scenario 2
Dwarves   49    19.52%
Mordor    45    17.93%
Angmar    54    21.51%
Men       49    19.52%
Elves     16    6.37%
Goblins   22    8.76%
Isengard  16    6.37%
Sum       251   100.00%


Scenario 3
Map: Argonath  ||   Opponent: Brutal
CaH: No        ||   RH: Yes
Teams: -       ||   Colours: Green

Scenario 3
Dwarves   53    21.37%
Mordor    38    15.32%
Angmar    44    17.74%
Men       38    15.32%
Elves     22    8.87%
Goblins   33    13.31%
Isengard  20    8.06%
Sum       248   100.00%


Combined
Dwarves   149   19.79%
Mordor    129   17.13%
Angmar    150   19.92%
Men       130   17.26%
Elves     50    6.64%
Goblins   91    12.08%
Isengard  54    7.17%
Sum       753   100.00%


Conclusion: The differences between the 3 scenarios is relatively small. Probably the map setting and scrolling through the map list does not effect the outcome of the RNG.

However, test 1 and test 2's scenario 1 are effectively the same (except player 1 colour), these can be compared. What's striking is the difference mainly in motw (0% -> 16.9%), mordor (6.3% -> 18.11%) and isengard (19.4% -> 7.1%). Remember the only difference is player 1's colour!


Third test (colour)

Since the previous test seemed to indicate player 1's colour affects the random generator I decided to dive more into that. Again, the scenarios were run alternatingly. Colours used: ?, pink, turqoise and black/grey.

Results:
CODE

Scenario 1
Map: Argonath   ||   Opponent: Brutal
CaH: No         ||   RH: Yes
Teams: -        ||   Colours: ?

Dwarves   46   25.00%
Mordor    17   9.24%
Angmar    51   27.72%
Men       3    1.63%
Elves     38   20.65%
Goblins   13   7.07%
Isengard  16   8.70%
Sum       184  100.00%

Scenario 2
Map: Argonath   ||   Opponent: Brutal
CaH: No         ||   RH: Yes
Teams: -        ||   Colours: Black (dark grey)

Dwarves   37   19.89%
Mordor    24   12.90%
Angmar    56   30.11%
Men       1    0.54%
Elves     37   19.89%
Goblins   8    4.30%
Isengard  23   12.37%
Sum       186  100.00%

Scenario 3
Map: Argonath   ||   Opponent: Brutal
CaH: No         ||   RH: Yes
Teams: -        ||   Colours: Pink

Dwarves   33   17.84%
Mordor    22   11.89%
Angmar    47   25.41%
Men       0    0.00%
Elves     55   29.73%
Goblins   12   6.49%
Isengard  16   8.65%
Sum       185  100.00%


Scenario 4
Map: Argonath   ||   Opponent: Brutal
CaH: No         ||   RH: Yes
Teams: -        ||   Colours: Turqoise

Dwarves   35   19.13%
Mordor    26   14.21%
Angmar    62   33.88%
Men       1    0.55%
Elves     34   18.58%
Goblins   7    3.83%
Isengard  18   9.84%
Sum       183  100.00%


The variations are not as big as they were in the green colour scenario. Elves 30% (pink) -> 19% (turqoise) is pretty substantial though. Especially since the mean is supposed to be 14% (or 17% if you subtract motw).
Anyway, after I run Damul's test I will test ? vs green again with >800 samples check whether colour really affects the RNG. This test does not show a whole lot, sadly.


Fourth test (green revisited)

The following test distinguishes colour (picked) an colour (preset). A picked colour was altered using in-game controls, a preset colour was set in the 'network.ini' configuration file located in 'appdata' prior to starting the game. In the first two scenarios, whenever the colour green is picked, it was set to '?' and vice versa (since the game saves the previous colour setting).

Results:
CODE

Scenario 1
Colours: ? (picked, from green)

Dwarves   84   21.93%
Mordor    69   18.02%
Angmar    55   14.36%
Men       80   20.89%
Elves     21   5.48%
Goblins   46   12.01%
Isengard  28   7.31%
Sum       383  100.00%


Scenario 2
Colours: green (picked, from ?)

Dwarves   80   21.00%
Mordor    53   13.91%
Angmar    71   18.64%
Men       70   18.37%
Elves     35   9.19%
Goblins   45   11.81%
Isengard  27   7.09%
Sum       381  100.00%


Scenario 3
Colours: green (preset in network.ini)

Dwarves   90   23.62%
Mordor    66   17.32%
Angmar    100  26.25%
Men       8    2.10%
Elves     71   18.64%
Goblins   25   6.56%
Isengard  30   7.87%
Sum       390  102.36%


Scenario 4
Colours: ? (preset in network.ini)

Dwarves   90   23.50%
Mordor    61   15.93%
Angmar    114  29.77%
Men       12   3.13%
Elves     67   17.49%
Goblins   17   4.44%
Isengard  29   7.57%
Sum       390  101.83%


Yeah so this isn't making much sense. It seems up to now all scenarios that are run simultaneously produce more or less the same results. Next up:
- How do CaHs influence the RNG (e.g. if you select an evil CaH is the probability 1/4 you get angmar?)
- How does bfme2's RNG compare to that of ROTWK?
- Does removing/adding a faction help?


Fifth test (CaH)

OK so, when an evil CaH is picked in combination with random, the RNG won't select good factions. For this test, I selected Thrugg (the default Uruk CaH).

Results:
CODE

Mordor    54    20.22%
Angmar    52    19.48%
Goblins   56    20.97%
Isengard  105   39.33%
Sum       267   100.00%


The distribution of Mordor, Angmar and Goblins seems fair. Isengard messes it up by having about 2x the probability. It could be RotWK developers wanted to create a system where the race (uruk -> Isengard) of your CaH influences the RNG and in the process ended up messing with the core workings of it.

This post has been edited by brabox: Jul 18 2015, 10:12 AM

Posts: 5,037

Game: Rise of the Witchking 2.01


+
# 2The Smoking Man™ May 19 2015, 23:09 PM
Good read, keep this coming. thumb.gif

Posts: 7,155

Game: Rise of the Witch King


+
# 3bushit May 19 2015, 23:51 PM
Not a good read, I don't like math. Give me sci-fi, fantasy, guns, and hamburgers...please.

Posts: 10,242

Clan: GoF|

Game: Rise of the Witch King


+
# 4Motoma May 20 2015, 01:11 AM
I'd like to help with this if you're open to it. If you give me the set of variables and method you're after I can do some additional data gathering, it would be manual however. I can do this in the background whilst studying.

Posts: 1,588

Game: Rise of the Witch King


+
# 5Mako May 20 2015, 05:48 AM
Try on other 2 maps to see if percentage are similar. As motoma is, so i'm interested about "how do you did it?". Do you have same percentage if you start it from network? Have you tried some other tests with the same condition?

I could do some graphic statistical but i need more data and anyway " how do you did it".

Anyway where is the code that choose random team?

Posts: 4,937

Game: Rise of the Witch King


+
# 6brabox May 20 2015, 06:01 AM
QUOTE

Not a good read, I don't like math. Give me sci-fi, fantasy, guns, and hamburgers...please.


Sorry bushit, I should've known this sort of stuff scares you smile.gif

QUOTE
I'd like to help with this if you're open to it. If you give me the set of variables and method you're after I can do some additional data gathering, it would be manual however. I can do this in the background whilst studying.

QUOTE
I could do some graphic statistical but i need more data and anyway " how do you did it".


I'm using a AutoHotkey (FOSS program) script I could send you, then you don't have to do it manually. You'll have to edit the script though to make the mouse click coordinates match your resolution I guess but that's maybe 5-10 min work.
What the script does is click my rotwk shortcut, go to multiplayer->network, create game, select FoI2, create brutal opponent, play game, F12 screenshot, kill game.dat, repeat. (CaH is disabled in my network profile, so I don't do that every time)

QUOTE
Try on other 2 maps to see if percentage are similar.

That's a good suggestion, I will probably test that first. It's good to start simple and eliminate factors.

Posts: 5,037

Game: Rise of the Witchking 2.01


+
# 7Muadd May 20 2015, 12:23 PM
Just fix the random somehow for 5.0. Add the chance of getting men/mordor/goblins by x10 and reduce dw/ang x20

Posts: 4,356

Clan: GoF|

Game: Rise of the Witch King


+
# 8Mako May 20 2015, 12:46 PM
QUOTE(ConquerorOfSweg @ May 20 2015, 12:23 PM) *

Just fix the random somehow for 5.0. Add the chance of getting men/mordor/goblins by x10 and reduce dw/ang x20


"somehow" is the problem... which are parameters that influence random? is quite simple make percentage (1/7) but where are codes?? BOOOH biggrin.gif.

Posts: 4,937

Game: Rise of the Witch King


+
# 9brabox May 20 2015, 13:13 PM
QUOTE
where are codes?? BOOOH

The code that actually does the RNG is compiled into game.dat and as such can not be studied, sadly.

QUOTE
Just fix the random somehow for 5.0. Add the chance of getting men/mordor/goblins by x10 and reduce dw/ang x20

If it were this simple it would've been fixed long ago. As can be seen from the data, the chance of getting motw in one specific scenario is (very close to) 0%. By what number would you multiply it? Before this can be solved more samples must be collected.

Posts: 5,037

Game: Rise of the Witchking 2.01


+
# 10Val` May 20 2015, 14:00 PM
gamedat can be read, its whether or not your willing to put in half your life getting through safedisc. Some folks have done some limited work with it


Posts: 13,212

Clan: Unr3al

Game: Battle for Middle Earth 2


+
# 11Phoenix May 20 2015, 14:21 PM
OP Quote
QUOTE(brabox @ May 19 2015, 18:07 PM) *

Intro:
gamereplays.org/community/index.php?showtopic=755440

Not very conclusive. This time around, things are getting more prostrat as I have created a macro to do the data collection part and as such I can execute many tests in a relatively short amount of time with me doing something else. (+/- 35 sec per run or 822 in 8 hours). Huzzah.

I ran a random test with 144 samples just now, settings:
Map: FoI2 ----- Opponent: Brutal
CaH: No ----- RH: Yes
No teams or colours.
NOTE: The macro uses the keyboard to get to FoI2 (10 down presses). This is different from what most players do.
Results:
CODE

Map: FoI2   ||   Opponent: Brutal
CaH: No     ||   RH: Yes
Teams: -    ||   Colours: ?

NOTE: The macro uses the keyboard to get to FoI2 (10 down presses). This is different from what most players do.
Results:

Mordor:    9    6.25%
Angmar:    31   21.53%
Elves:     36   25.00%
Dwarves:   22   15.28%
Isengard:  28   19.44%
Goblins:   18   12.50%
Men:       0    0.00%


Actually better than expected, still men is obviously broken. The probability of any one faction not being picked at least once is terribly small and horrible to calculate. To give you a feel, this is probably a good approximation:
Chance of motw not being picked in 144 trials: ((6/7)^144) = 0.000000000289 (2.289e-10) or 0.0000000289%
Since there are 7 factions that could have not been picked, multiply by 7 gives: 1.6024e-9 (I know I'm ignoring overlap).

Fun comparison: the probability of somebody randomly guessing a 4-digit PIN within 3 attempts is about 0.0003. (3e-4). That's more than 180000x more likely to have happened to me than this outcome (if rotwk RNG was fair).

So what I wanted to ask was, which factors would you like to test? Skirmish profiles? Video/sound settings? Game specific settings (colour/team/map)? Good/evil CaH settings (is is 1/4 probability to get mordor with an evil CaH or is that screwed up too)?
Would be cool to have RandomEvil and RandomGood crappy CaHs in 2.02 v5.0 that aren't worth their money.

Awesome, I enjoyed your last topic on this and this one too. It's worth testing everything you can so we can get a good idea of exactly what affects the RNG algorithm.

QUOTE(Mako @ May 20 2015, 01:48 AM) *

Try on other 2 maps to see if percentage are similar. As motoma is, so i'm interested about "how do you did it?". Do you have same percentage if you start it from network? Have you tried some other tests with the same condition?

I could do some graphic statistical but i need more data and anyway " how do you did it".

Anyway where is the code that choose random team?

Can you clarify what you mean by graphic statistical? Assuming you had a data set showing the percentage changes of getting each faction in different situations, what would you do with it?

All the game's core source code is compiled in game.dat, but it's encrypted using Safedisc 4 technology and the source code cannot be accessed without some hacking skills. No one has figured out how to do it yet though as far as I know, but it's something that is being looked into. The changes you see in 2.02 are really just changes to configuration files (and some others) that aren't encrypted and can easily be extracted, read, and modified with FinalBig.

QUOTE(ConquerorOfSweg @ May 20 2015, 08:23 AM) *

Just fix the random somehow for 5.0. Add the chance of getting men/mordor/goblins by x10 and reduce dw/ang x20

That's not likely to be fixed because we can't access the RNG algorithm code. If we did fix it though you would have a 1/7 chance of getting any faction.

QUOTE(brabox @ May 20 2015, 09:13 AM) *

The code that actually does the RNG is compiled into game.dat and as such can not be studied, sadly.

Well in theory it can be studied, but it would require unpacking it and figuring out how to get past Safedisc 4, which requires some pretty impressive hacking skills, or a lot of time, or both. Multiple people have tried to figure out how to do it over the years. As far as I know none have yet succeeded.

Posts: 23,108

Clan: Corruption of Light

Game: Rise of the Witch King


+
# 12Mako May 20 2015, 14:47 PM
My brother like to program (he is graduated in informatics in security system) i could ask him something about (hacking skills). about graphic now i thinking that isn't useful...

(i now that this hacking is really hard... but i try)

This post has been edited by Mako: May 20 2015, 14:52 PM

Posts: 4,937

Game: Rise of the Witch King


+
# 13Phoenix May 20 2015, 15:33 PM
QUOTE(Mako @ May 20 2015, 10:47 AM) *

My brother like to program (he is graduated in informatics in security system) i could ask him something about (hacking skills). about graphic now i thinking that isn't useful...

(i now that this hacking is really hard... but i try)

You could ask your brother to take a look if he is interested, but it's going to be time consuming either way.

Posts: 23,108

Clan: Corruption of Light

Game: Rise of the Witch King


+
# 14brabox May 20 2015, 18:08 PM
QUOTE(Val` @ May 20 2015, 15:00 PM) *

gamedat can be read, its whether or not your willing to put in half your life getting through safedisc. Some folks have done some limited work with it


After safedisc there might be even more encryption if you're unlucky. Besides, if you rename game.dat to game.exe you can see it's actually an executable itself. Reverting 12mB of object code to something like C is to my knowledge already quite impossible.

However, since we all know 1v1 games where motw was obtained from random, there must be some way to influence rotwk's RNG. It's a matter of finding out what methods work best!

Posts: 5,037

Game: Rise of the Witchking 2.01


+
# 15Forlong May 20 2015, 19:46 PM
Soo... who here wants random factions revealed on the loadscreen? I can't fix random, but I can give you that!

Posts: 30,998

Game: Rise of the Witch King


+
# 16The Smoking Man™ May 20 2015, 19:53 PM
QUOTE(Forlong @ May 20 2015, 20:46 PM) *
Soo... who here wants random factions revealed on the loadscreen? I can't fix random, but I can give you that!

You have been trying to do that for a long time. tongue.gif

I'm OK with it, it does remove the early-game element of surprise, but since that's pure luck and chance thus is crappy IMO.

Imagine having Elves vs Isen. Neither of them scout eachother. The elven player takes the risk and goes for a Lancer start. The Isengard player takes the risk and goes for a Wildmen start. The Elven player actually won, not out of skill but out of pure luck.

But by having factions being displayed, you make sure you don't make silly mistakes and go for the right start/BO.

I'd like to see what others think.

Posts: 7,155

Game: Rise of the Witch King


+
# 17bushit May 20 2015, 20:04 PM
revealing all armies at start could be kinda cool, you could still spy to see starts anyways

Posts: 10,242

Clan: GoF|

Game: Rise of the Witch King


+
# 18Lazarus° May 20 2015, 20:04 PM
QUOTE(Forlong @ May 20 2015, 21:46 PM) *

Soo... who here wants random factions revealed on the loadscreen? I can't fix random, but I can give you that!

No way, random is meant to be surprise or forcing enemy to spy.

Posts: 2,919

Game: Rise of the Witch King


+
# 19TheRingisHot May 20 2015, 20:28 PM
An option to turn this on would be handy

Posts: 2,943

Game: Rise of the Witch King


+
# 20Phoenix May 20 2015, 21:16 PM
QUOTE(brabox @ May 20 2015, 14:08 PM) *

After safedisc there might be even more encryption if you're unlucky. Besides, if you rename game.dat to game.exe you can see it's actually an executable itself. Reverting 12mB of object code to something like C is to my knowledge already quite impossible.

However, since we all know 1v1 games where motw was obtained from random, there must be some way to influence rotwk's RNG. It's a matter of finding out what methods work best!

This is a topic I never bothered to explore so I don't know how far it can be exploited. I do know that certain people managed to pull out certain relevant pieces of information by reading the RAM in real-time while the game was running though. Reading encrypted files saved on a hard disk may be improbable, but reading raw memory is certainly doable and since the machine works with the raw data in order to perform its work you can gain a picture of what was originally in the files. Even passwords have been determined by hackers by accessing the memory of the machine processing the password. From what I recall this is how the OpenSSL issues arose - people accessing random pieces of memory potentially containing confidential information.

QUOTE(The Smoking Man™ @ May 20 2015, 15:53 PM) *

You have been trying to do that for a long time. tongue.gif

I'm OK with it, it does remove the early-game element of surprise, but since that's pure luck and chance thus is crappy IMO.

Imagine having Elves vs Isen. Neither of them scout eachother. The elven player takes the risk and goes for a Lancer start. The Isengard player takes the risk and goes for a Wildmen start. The Elven player actually won, not out of skill but out of pure luck.

But by having factions being displayed, you make sure you don't make silly mistakes and go for the right start/BO.

I'd like to see what others think.

This will never gain enough community support to go through I think. I hate Random too and I especially hate it when players who don't understand that the RNG is broken try to tell me not to pick factions. But it's not enough to know the faction. If you're Men vs. Elves for example, you're still clueless whether your opponent is going for a Green Pasture or a Barracks start, and getting it wrong and making the wrong choice will cost you dearly.

Posts: 23,108

Clan: Corruption of Light

Game: Rise of the Witch King


+

1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)