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: Research about probabilities for getting moral
Thread: Research about probabilities for getting moral
angelito
angelito


Honorable
Undefeatable Hero
proud father of a princess
posted July 20, 2010 02:04 PM

Research about probabilities for getting moral

The discussion about getting many morals in a row from the thread "Not in the manual" is copied here now:

angelito wrote
Quote:
posted July 14, 2010 02:50 PM  
--------------------------------------------------------------------------------
It may not be the correct thread, but we were talking about the probabilities of getting moral aswell here.

This is what happened to me in a single player game (WoG) yesterday:

I was attacking a horde of goblins day 3 with kyrre. In WoG, those Rampart guys always start with a first aid tent. So there were 3 stacks of 23, 1 stack of them upgraded.

After 2 rounds, only 1 single hobgoblin was left, and instead of attacking my centaurs or my commander, it decided to attack my first aid tent.
It made 1 damage and recieved moral, attacked the tent again and dealed 1 damage again.

Now the first aid tent healed itself (WoG) and next round started.
You know what? Hobgoblin attacked the tent again, dealed 1 damage and RECIEVED moral again. Second hit on the tent, I took defense stand with all creeps and tent healed itself.

Next round, same again, the goblin recieved moral.

I did that for 30 rounds, and it happened every round..

So I think we can exclude coincidence.

Anybody an explanation for that?
Maybe the hex on which the unit stands has something to do with the chance of getting moral? Just a shot into the dark....


AlexSpl wrote:
Quote:
posted July 14, 2010 03:02 PM  
--------------------------------------------------------------------------------
2angelito: What army did you have? Had you manual control over the first aid tent? Did you use autocombat?


Salamandre wrote:
Quote:
posted July 14, 2010 03:03 PM  
--------------------------------------------------------------------------------
Easy to test, was the goblin just in front of the tent or on other square?


AlexSpl wrote:
Quote:
posted July 14, 2010 03:16 PM  
--------------------------------------------------------------------------------
I have an answer  cause I am true specialist in Moral/Luck theory

1. It's because of incorrect first aid tent self-healing implementation in WoG which fixes someway random number and, thus, makes the next event in the battle strictly determined (like getting Morale again and again). Cause, if I caught the post above, there was no user interference between the first aid tent and hobgoblin's turn.

2. You were pressing 'Defend' quickly enough for no creatures animation was changed during clicking 'Defend'.

If I only could see a savegame and repeat the case mentioned.


angelito wrote:
Quote:
posted July 14, 2010 05:49 PM  
Quote:
2angelito: What army did you have? Had you manual control over the first aid tent? Did you use autocombat?



I just had about 35 cents and a commander. No control over the tent due to missing first aid skill. No autocombat.

And the goblin stood right in front of the tent.


angelito wrote:
Quote:
posted July 14, 2010 05:52 PM  
Quote:

2. You were pressing 'Defend' quickly enough for no creatures animation was changed during clicking 'Defend'.


This may have been the reason in round 3 or 4 and following, but in round 2, I surely did not press defend very quickly, because I just was thinking about how to revive my lost cents and wanted to wait first, so I get my cents to move again after the tent revived the cents. But I noticed the tent will always heal itself first before healing other creeps, that's when I noticed the moral thingy....



val89 wrote:
Quote:
posted July 14, 2010 07:27 PM  
It's just a pseudo-random number generator, like on other RPGs.

Also depends on what difficulty you were playing on.

Also, it's WoG. Tents healing themselves?  That kind of thing messes with game mechanics, so I'm not surprised that the Hobgoblin did the same thing over for 30 rounds.


angelito wrote:
Quote:
posted July 14, 2010 08:01 PM  Edited by angelito at 20:03, 14 Jul 2010.
Quote:

It's just a pseudo-random number generator, like on other RPGs.

Also depends on what difficulty you were playing on.

Also, it's WoG. Tents healing themselves?  That kind of thing messes with game mechanics, so I'm not surprised that the Hobgoblin did the same thing over for 30 rounds.


Thanks for your well thought comment. Maybe next time related to some facts? Since when has moral to do with game difficulty?  What's so funny in tents healing tents, when tents can "heal" undead in normal H3?


Salamandre wrote:
Quote:
posted July 14, 2010 08:21 PM  Edited by Salamandre at 20:31, 14 Jul 2010.
I played thousand of WoG games when the enemy creature attacked my tent and tent healed. Never saw 30 morals in a battle. You had an unique game there I think. It was proved that each square on the map has different monster setup (upgrade or not), also each square has its own predefined obstacles (PHOMM editor shows that). It is possible that they inserted more than that for each square, morale, luck. Hard to say without source code.

Quote:

1. It's because of incorrect first aid tent self-healing implementation in WoG which fixes someway random number and, thus, makes the next event in the battle strictly determined (like getting Morale again and again). Cause, if I caught the post above, there was no user interference between the first aid tent and hobgoblin's turn.



Many WoG maps use the warfare feature, and the first tent works perfectly while dealing with thousand combinations. But if you can fix what you think it is not fixed, go ahead.


val89 wrote:
Quote:
posted July 15, 2010 02:19 AM  
OK, sorry about that last post: here's a fact. Pseudo-random numbers are used in all RPGs. They determine everything from how much damage the creature deals to when its special ability activates. The first aid tent comment meant that the developers of Heroes III didn't plan the first aid tent to heal itself. This type of unexpectedness can interfere with game numbers. Obviously, the mod makers fixed most of the glitches, or WoG would unexpectedly crash...

But this type of thing wouldn't be possible in Heroes III.
When I face a particular single stack (Unicorns in Unicorn Glade) that all of my creatures are slower than, the particular stack has high morale when it attacks because I can't input anything to interfere with its morale before it attacks. No matter how many times I reload the mission, exit the game, restart it, etc. the Unicorns keep having high morale.

Basically, something in that first aid tent is interfering with the game morale system. Nothing else is being changed (all your creatures are defending). A lot of this is a mystery; I asked about difficulty since AI monsters act differently on a different difficulty. Why it attacked the tent and not one of your creature stacks in the first place is confusing in itself. Even the number of stacks you have defending can be taken into the game to determine the Hobgoblin's morale.

Hope that cleared some things up.


AlexSpl wrote:
Quote:
posted July 15, 2010 07:53 AM  Edited by AlexSpl at 08:05, 15 Jul 2010.
Quote:
It is possible that they inserted more than that for each square, morale, luck.

Proven not true.

Well, back to Morale thing... When first aid tent 'decides' to heal somebody, it rolls a dice to obtain random stack to be healed. In the case described, I suppose, first aid tent doesn't 'decide', it just heals ifself, so there is always fixed number is produced, then the game obtains the next 'random' number based on the *previous* value that's why you always face hobgoblin's morale.


angelito wrote:
Quote:
posted July 15, 2010 02:32 PM  Edited by angelito at 14:32, 15 Jul 2010.
If that would be true, then it should be the same with following scenario:

AI has 1 nagaqueen, I have 1 Chaoshydra. Fight on snow.

Nagaqueen attacks Hydra, no retail (same as attacking a tent), gets moral, attacks again. Chaoshydra takes defense stand.

Next round then should work the same, because nothing has changed from first to second round, except the hitpoints left of the hydra (maybe with elexir of life, you could even react like the tent in the first scenario).

So now the nagas would get moral in each round?


AlexSpl wrote:
Quote:
posted July 15, 2010 02:57 PM  
Quote:
So now the nagas would get moral in each round?

No, they wouldn't.

I state only that if there is no player interference between two events (A and B), and the A event always generates the same random number, then the event B will be strictly determined, and depend on the random number generated by the A event.
 

Binabik wrote:
Quote:
This really shouldn't be in this thread, but....

There could be several explanations for getting morale 30 times in a row. Some have already been mentioned.

However I just wanted to mention something that I see in game forums a lot. I'll quote Angelito to illustrate.
Quote:
I did that for 30 rounds, and it happened every round..

So I think we can exclude coincidence.

I'm not going to say that it *IS* coincidence because I don't know. But I will say that it *CAN* be coincidence. It's easy to think that the odds of this happening are extremely small. But the odds of it happening are actually pretty high.

In a *SINGLE* combat the odds are extremely low, but how many combat's have you done in H3? You've probably done at least a hundred thousand of combats, so the odds of something like this happening at least once during all those fights becomes a hundred thousand times better than the odds of it happening during a single game. Now take that and multiply it times thousands of H3 players and the odds become higher still.

You also have to assume that if someone gets morale 30 times in a row that they are very likely to post it in a forum. So from a total of probably many millions of combats done by HC members over the last 10 years, it's been posted ONCE.

Again, I'm not saying this is what happened because I don't think it is, I think there is something else involved. But I just wanted to make the point because I see this so often in game forums.


Protos wrote:
Quote:
posted July 15, 2010 09:41 PM  
Hmm, interesting theory, but i think that getting morale 30 times in a row cant be coincidence, because this situation is so unlikely that it wont happen if all 6 bilions people in the world would play H3 every day for next 100 years. If odds for one round are 1:10 (they are prolly a bit higher, but lets asume this), then odds for 30 rounds are 1:1000000000000000000000000000000.


Binabik wrote:
Quote:
posted July 15, 2010 10:43 PM  
Quote:
interesting theory

Not theory, it's fact.

Yes it CAN be coincidence.

But regardless of the odds, you are missing the point. The fact is that people commonly isolate an individual event and neglect to remember that it's not an isolated event. It's only one event out of many millions of events.

You can't even isolate getting morale 30 times in a row. You also have to consider getting luck 27 times in a row, or getting Stronghold with 19 piles of crystal laying around, or starting with Spirit of Oppression 14 games in a row, or any one of thousands of other highly unlikely things.

With a large enough player base playing many millions of game, the odds of SOMETHING like that happening becomes very high, and the odds of an unlikely event to NOT happen becomes very low. When that unlikely event happens it will probably get posted, and people will scratch their heads wondering how that particular event could happen.

To put it another way

Instead of looking at the odds of event 'A' happening, look at the odds of A OR B OR C OR D OR E OR F OR G OR H, etc happening.

I repeat again that I don't think that's what really happened (mainly because there are better explanations), but my point is completely valid.


AlexSpl wrote:
Quote:
posted July 16, 2010 07:44 AM  
Binabik's point of view is completely right. I, myself, saw six morales(!) in a row (got by different units, not only just one - hobgoblins - as angelito said). Though I think that getting it 30 times in a row is pretty far from simply coincidence. Moreover, I can reconstruct the situation discussed as many times as I want (just need some appropriate initial conditions).


dimis wrote:
Quote:
posted July 16, 2010 08:59 AM  Edited by dimis at 09:31, 16 Jul 2010.
Claiming that angelito had morale 30 times in a row simply because he was lucky, sounds like a joke. But many things are scattered and kind of messed in the explanations.

As Protos said, the chance of such a behavior is "supposed to be" a little bit higher than (1/10)^{30}. Let's be generous and make it about (1/4)^{30} = 2^{-60}. Let's also be generous and say that the average player so far has given about 100,000 battles, and moreover, there are about 100,000 average players who would also report such a bad thing happening. It is hilarious; I know, this is not "average" for sure ... Anyway, this means at most 10^{10} battles (tests) for this event. Now, it is a simple union bound argument.

Let's call B_i the (bad) event that 30 morals arise in a row when a single creature attacks our tent, the tent heals itself, and the creature receives morale. A bad event B_i can happen with probability at most 2^{-60} (this is what is expected in theory for a good RNG). None of these bad events will happen with probability = 1 - Pr(any one of the B_i's occurs). However, by the Union Bound,
Pr(any one of the B_i's occurs) <= (read: less than or equal) Sum_{over all B_i's} Pr( B_i happening ).
The right side is at most 10^10 * 2^{-60} = 8.67 * 10^{-9} <= 10^{-8}.

In other words, the probability of observing such a bad event after 10^{10} = 10 billion tries, is less than 0.00000001 = 0.000001 %


So yes, the point that the probability has increased in order to observe such a thing after so long playing heroes is valid (compared to the 2^{-60} < 10^{-18} for a single try). However, the probability is ridiculously small even now. I mean, we can even say that there are 1 million people who have done 1 million battles each, and the probability will still be less than 0.0001 %, which is  ... funny ? Oh, and if we go back I think we were generous and said that in 1 out of 4 times the single creature will get morale.


But of course, we already know some stuff. Certain parts of the game seem not to have been designed and/or implemented well. And in this point is where the explanations by Alex come into the picture and seem reasonable, although they are sketchy at this point.


-- Just my viewpoint.

____________
Better judged by 12 than carried by 6.

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


Honorable
Undefeatable Hero
proud father of a princess
posted July 20, 2010 02:19 PM

angelito wrote:
Quote:
posted July 16, 2010 09:30 AM  
Maybe I left out an important point:

I stopped the fight after the 30th time of moral by killing that sturdy hobgoblin. If I wouldn't have killed it, I am pretty sure the moral would have happened many more rounds (infinity?)


dimis wrote:
Quote:
posted July 16, 2010 09:32 AM  Edited by dimis at 10:04, 16 Jul 2010.
I am pretty sure you are right angelito. And if I understand correctly, Alex speculates the same thing (under some assumptions that seem reasonable).


suicidpeiarba wrote:
Quote:
posted July 16, 2010 01:08 PM  
Quote:

I am pretty sure you are right angelito. And if I understand correctly, Alex speculates the same thing (under some assumptions that seem reasonable).

i see good mathematics and logic here. i want to add something: we know for sure that there are limited situations of battles. If we have one battle with 3 goblins against a cerber and the cerber recievs morale, then we know for sure that in the same situation with the same army and stats, the cerber will recieve morale. so if we have a notebook to note every this situation when morale takes place, we will see that in certain situations the recieving morale is standard.


AlexSpl wrote:
Quote:
posted July 16, 2010 02:05 PM  Edited by AlexSpl at 14:32, 16 Jul 2010.
Quote:
If we have one battle with 3 goblins against a cerber and the cerber recievs morale, then we know for sure that in the same situation with the same army and stats, the cerber will recieve morale.

How about of that fact that morale depends on time (is function of time): M = M(t)?

So questions like this one: 'what chances to get morale with my elves?' isn't correct without mention of how much time it takes me to make my move.

To clarify it a little:
Let a battle begins at time t. You always can find such an interval of time [t + a, t + b] on which you will have 0% chance of getting morale despite of your Morale parameter, and always can point another interval [t + c, t + d] on which you will have 100% chance!


val89 wrote:
Quote:
posted July 16, 2010 07:26 PM  Edited by val89 at 20:13, 16 Jul 2010.
We don't know how the game measures time to determine morale.

Suppose we didn't have this situation and we didn't know the facts.
It could be to the nearest millisecond, or the nearest 10 seconds.

Clearly, it's not to the nearest millisecond because reasonably angelito defended with one of his stacks a millisecond off at least one of those 30 times.

We can also obviously rule out chance: (4.2% if they have 1 morale) ^ 30 = .042 ^ 30
= 4.98286031 * 10 ^ -42 = really really really ... small number. And I didn't mistype anything in the calculator.
If you're not convinced, it's actually 0.00000000000000000000000000000000000000000498286031 OR 0.000000000000000000000000000000000000000498286031%.
I wouldn't say Binabik's argument applies here.

Now, try another experiment: save your game in a campaign or single scenario before a battle where your enemy receives morale. Load the game, and see whether the same enemy gets morale with the same conditions as before. Try making time a variable, changing it with every time you run the battle (a few seconds, several seconds, ..., a minute). If time was the only thing you changed (you didn't exit out of the game to reset the RNG), you should get the same result, no matter how long you wait.

I don't think it's time that's taken into play to determine morale, it's your creatures' actions and your spells.

I recently fought a Dungeon enemy with a Rampart army on Dungeon soil.
As you well know, if both sides have the same speed rating, the attacker attacks first, so my Silver Pegasi beat his Red Dragon stack.

Now, I played through the battle with the intention of leaving with no casualties, but his 3 Red Dragons kept getting one of my War Unicorns (they were face to face across the battlefield, and I didn't have the Resurrect spell yet)! I reloaded the battle and tried everything I could; no 4th level spell I had was strong enough to kill a Red Dragon, and I didn't have Implosion either. I teleported my Unicorns. I cast Haste on them. Now the Red Dragons had morale; even worse. Then I came up with a brilliant idea: I cast Force Field around my Unicorns, and the Dragons didn't get morale! They just flew up next to the Force Field as an easy snack for the rest of my army. I then finally finished the battle with no casualties. (The AI hero had 5 or 6 spell points and I had my Pegasi so he didn't cast anything the whole time.)

Now, in this situation, I tried everything I could have (I desperately needed no casualties) from waiting to more waiting to different spells... and I never exited out of the game to reset the RNG.

Time didn't help me; the Force Field spell did. Just now I loaded up the same battle and the Dragons didn't have morale after teleporting my Unicorns. That just means the RNG has reset and I didn't do everything the exact same way up until the battle (I loaded the game a day earlier and just did end turn). Because I had different input for the enemy, he didn't get morale.

So the morale factor relies on user input (at least AI enemy morale).

Now, what about the user's morale? Good question.

I have (had; I'm not doing this again now) some Sharpshooters divided evenly into 5 or 6 different stacks and I have Basic Leadership (2 morale). I know that if two Sharpshooter stacks get morale by the end of my second turn, I will kill the guards to the Unicorn Glade with no spells cast.

I notice that I shoot with all of my Sharpshooters, the Unicorns walk closer, and I shoot again. No morale. They end up killing some Sharpshooters, and I reload so that I'm at the Glade and ready to battle again with nothing else changed.

I keep trying and keep getting absolutely no morale.
Something's wrong.

Now, I come up with the genius idea of using the Wait command on all my stacks, letting the Unicorns walk forward, then having two turns at once.

Almost immediately, a stack got morale.

I reloaded and retried, and different stacks of mine got morale each time, so it must be working. Eventually, I got the morale the second time, got the last guard, and saved the game. Nowhere in all those attempts have the enemy Unicorns gotten morale (keep in mind I tried this at the very least 20 times; I had messed up sometime later several times and had to load from before here; it was a headache to do the same thing over and over until I finally got it).

So your morale is also somewhat dependent on what you do (like the enemy morale), but there's also just plain chance involved (unlike the enemy morale).

Now let's combine the two concepts. Can enemy morale be dependent on your morale, and therefore on chance? The most likely answer is no, because out of all my tries at the Glade, the Unicorns had never gotten high morale. Now, I had tried going to the same Glade with a different hero but had miserably failed every time because the Unicorns had high morale since they attacked before me and I could do nothing to stop them (they didn't wait). I reloaded the game over and over again, but it didn't work. However, they didn't have morale against my Sharpshooters. This leads me to believe that enemy morale also depends on your creatures' speed.

To sum up, your morale is dependent on user input (your actions and spells) and chance. AI enemy morale is dependent on user input and relative creature speed.

I hope these tests help you guys in deciding what morale is caused by, but if no one else does any tests, we can hypothesize all week and not get anywhere with this.

But I still sort of think that since the developers didn't plan to have the first aid tent heal itself, it could also be the result of a hidden glitch.

So what do you guys think?


suicidpeiarba wrote:
Quote:
posted July 16, 2010 08:28 PM
i didn't say that we are dependents of situations. i just said that out of what we think or what we say, there are determined results of certain situations. so it is known in computer input-output system that if situation A, then result B.


val89 wrote:
Quote:
posted July 16, 2010 09:18 PM  Edited by val89 at 21:21, 16 Jul 2010.
Quote:
i didn't say that we are dependents of situations. i just said that out of what we think or what we say, there are determined results of certain situations. so it is known in computer input-output system that if situation A, then result B.

So we're on the same track. Also, don't quote the whole thing, quote the part you're replying to.
Event A (say, a spell like my force field) leads to Event B (no enemy morale).
So what are we arguing about actually?


And it doesn't seem to be a function of time, at least neither in angelito's test nor in my tests.

"After a generous tip, the barkeep whispers: Careful, your actions and spells can determine morale." (Proven true in tests.)


OhforfSake wrote:
Quote:
posted July 17, 2010 01:48 PM
About the pseudo random number. A program, I guess, will in general use any type of parameter that is expected to be present. It could just as well be the clock on your computer, or the humidity in the air, if it's expected you've access to certain internet pages.

As long as it doesn't use parameters that's impossible* to know, it's theoretical possible to predict all random events and thereby find the optimal way to win (like player X didn't attack with his titans, but moved them?? suddenly opposing player Y gets a lot of bad morale).

The only reason I believe this sort of things isn't done, isn't because you can't look into the code and find out what determines these random parameters (I believe, often they're a set count that only repeats after a long long period, or maybe won't repeat at all, yet the function would then be clearly defined), no I believe the problem is much like the problem of trying to win chess by going through every possible combination. The amount of combinations if enough parameters are present are simply too high to calculate.

That doesn't mean there isn't an end result however, like with the first aid tent + goblins situation, here I'd assume that all parameters used in the pseudo random generater weren't changed, (which is basicly what a look into the code probably would tell as well). But single end results can't be used to much (like mate in four), if the entire system is too complicated to derive how to get to the given point (not sufficient computer power). If it was possible to create some kind of analytical way, a function, that could determine these kinds of things, I guess making such a program wouuld be rather easy, but my guess is that we don't have knowledge / possibility of constructing such a function through the usual operations and functions we use.

*If the program would be measuring some kind of quantum effect, either by getting data from the internet that is measuring these, or measuring something inside the computer, then it's believed to be impossible to predict the outcome, thereby making such a program impossible to construct. [That is, equal conditions do not produce equal results, but rather equal conditions produces a limited set of results].

So all in all, I think it's true that it's simply a pseudo random generator where the paramters happened to be fixed in the given situation, but I don't think it's really possible for us to take advantage of it, even if we find all the parameters in question.
[That is, it's not so hard to find out what kind of code the computer uses, at least that's very possible, it's rather, to take account of all possible actions of the opponent to derive the most likely road to victory from this information].


val89 wrote:
Quote:
posted July 18, 2010 08:24 PM
Sake: you might be able to hack into the game's code and be able to use the pseudo-random number to your advantage ('tactically') in terms of morale, luck, etc. However, it would be even worse than the maximum morale/luck cheat.


OhforfSake wrote:
Quote:
posted July 18, 2010 08:49 PM
Maybe, but where is the limit between taking advantage of how the game is build and actual cheating? In principle, the only difference of reading the code of the game and making a series of experiments to determine the code, is the direction you go in at and basicly there's not a way to really seperate the two ways, because the programs used for either can very well be the same [basicly, reading the code, is just a much better way of testing, as it can be said to be the computer that runs billions of tests where the human had only ran a single one, but just because it's the computer that does it, is not cheat. Had we not been born with hands, we'd not see it as cheat if someone invented hands to defeat their opponents in whatever activities hands are required. It's merely a tool, like everything of our body, that enhances our ability to interact with the world].
 I mean, we don't see stuff like defeating griff cons with armies that only can do so, because of the poor AI as cheating, eventhough it gives a huge advantage. My guess is, we won't see it as cheat either, if some people through testing finds out that in certain situations, you can give bad morals at a very high likelyness, to the opponent, by only doing in game stuff. However, had someone read the code and being able to determine the smallest army needed to take out a hive, or the exact procedure needed to optimize bad morals of the opponent for all times, then I'd guess it'd be counted as cheating.
As I see it, there's a code of honour between two players determing what is allowed and what isn't [usually, the general cheating commands aren't allowed, simply because people don't see it as part of the 'universe'], but for an everything goes game, to me, the difference goes when you edit the code of the program itself, no matter in what degree.

[An analogy to this, is with the cycling sport. People who uses dope might get an advantage, but in general, you actually can't seperate the different cases of drugs, genes, excersize and other types of help, because our moral [which is what determines what is cheating for each given person and what makes it a subjective matter until clearly defined absolute (which is much harder than it sounds, because you need definitions that seperates what is illegal and legal, and that do not overlap under any given circumstance) rules have been made] is so ambiguous].

Okay, this doesn't really seem to belong to the topic, I just thought I'd point it out, but I don't mind if it gets deleted.


AlexSpl wrote:
Quote:
posted July 19, 2010 07:55 AM  Edited by AlexSpl at 14:26, 19 Jul 2010.
I respect your points of view but dependance on user's action is obvious and I preferred not to mention it.
Quote:
We can also obviously rule out chance: (4.2% if they have 1 morale) ^ 30 = .042 ^ 30
= 4.98286031 * 10 ^ -42 = really really really ... small number.

Those numbers: 1/24, 2/24, 3/24 for +1, +2, +3 Morale aren't correct at all when dealing with real RNG, not theory! Even with +1 Morale your chances to get it may vary from 0 to 100%! Usually, the longer you are thinking, the less chance to catch Morale, although you should avoid to rush your move because of great possibility of dead zone (0% to get Morale).

Here is the most common picture of how probability to get Morale Pr[M] depends on time t:



Of course, not always the next branch will be below the previous one, but usually it is so.


val89 wrote:
Quote:
posted July 19, 2010 06:49 PM  Edited by val89 at 20:07, 19 Jul 2010.
How did you get this information? You sound like you're hypothesizing. The graph and equations sound smart, but that doesn't mean they're right. I ran tests and found out that if I wait 2 seconds, 5 seconds, 10 seconds, or 30 seconds, the enemy will always have morale in a particular situation where the only thing altered is time. I loaded the game without exiting...

Did you even read my long comment all the way through? The 'respect' part sounds a little too dismissive.

Also keep in mind that hero and enemy morale are dependent on different causes.

As for hero morale, there's chance involved. If you can take apart the game code in a hexadecimal editor or something similar and show how it creates your morale and takes time into account, I'll believe you.

And why aren't 1/24, 2/24, and 3/24 correct?
I've had experience with psuedo-random numbers before. I've used Visual Basic to make psuedo-random number programs that use chance, not time. I can easily make one in Visual Basic for 1/24, 2/24, and 3/24 and upload it for you so you can download and use it.
EDIT: I've already made this program: Morale App
If you're going to download this, 1 (from 24) is counted as morale. 2 is also counted for the second set, and both 2 and 3 are also counted for the third set. You'll see what I mean when you try it out.

So you can argue all you want about time for my application too, but it's based on an RNG, using the 'Randomize()' and 'Rnd()' code.

Here's all 20 lines of MY code if you understand it:
Public Class Form1
  Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      Randomize()
  End Sub
  Private Sub btnMorale1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMorale1.Click
      Dim Morale1 As Integer = Int(24 * Rnd() + 1)
      If Morale1 = 1 Then lblMorale1.Text = "You have morale." Else lblMorale1.Text = "The 1/24 chance did not succeed."
      lblMorale1Text.Text = "The random number was " + Morale1.ToString + "."
  End Sub
  Private Sub btnMorale2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMorale2.Click
      Dim Morale2 As Integer = Int(24 * Rnd() + 1)
      If Morale2 = 1 Or Morale2 = 2 Then lblMorale2.Text = "You have morale." Else lblMorale2.Text = "The 2/24 (1/12) chance did not succeed."
      lblMorale2Text.Text = "The random number was " + Morale2.ToString + "."
  End Sub
  Private Sub btnMorale3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMorale3.Click
      Dim Morale3 As Integer = Int(24 * Rnd() + 1)
      If Morale3 = 1 Or Morale3 = 2 Or Morale3 = 3 Then lblMorale3.Text = "You have morale." Else lblMorale3.Text = "The 3/24 (1/8) chance did not succeed."
      lblMorale3Text.Text = "The random number was " + Morale3.ToString + "."
  End Sub
End Class

I've used the minimum time possible (if you're willing to apply your concept to angelito's case, you should apply it here too) both in my hero morale test (keep in mind I did TWO tests. I clicked as fast I could) and in my programs (by holding down Enter). Both my programs and the game generator have something more than just time involved

____________
Better judged by 12 than carried by 6.

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


Honorable
Undefeatable Hero
proud father of a princess
posted July 20, 2010 02:22 PM
Edited by angelito at 19:20, 20 Jul 2010.

warmonger wrote:
Quote:
posted July 19, 2010 07:08 PM
Maybe the algorithm is simply based on Low-discrepancy sequence which for some starting conditions becomes convergent?

Still, I would like to see an answer for my previous question.


Salamandre wrote:
Quote:
posted July 19, 2010 07:16 PM
Open a map
Give artefact and magic arrow to one hero
Make a battle
put artefact in backpack
Make a battle
Compare
Share with us results


warmonger wrote:
Quote:
posted July 19, 2010 07:17 PM
You're right, I'm just too lazy.


OhforfSake wrote:
Quote:
posted July 19, 2010 08:04 PM  
Sorry if this have already been mentioned, but this time variable, do I understand it correct that it's defined as the time from when a given creatures action starts to it ends? Meaning it'll be reset everytime a new creature of the player moves?

Anyway, my guess for what makes it probability based and you won't find anything like "at 30 seconds it's 100% chance of good morale" is because time is only one of many factors. It could be that for certain times, the time parameter is 1 and for others it's 0, though maybe there are several values where some is only good for some other paramters and others bad for the same and vice versa for other instances making it much more complicated.


val89 wrote:
Quote:
posted July 20, 2010 12:19 AM
I think you're right. Most likely it's not just time that comes into play; it's also the black box involved in the RNG that the game uses to determine morale.

It would be plausible to crack the game's code to find out what it uses to make morale so that it could be used as a tactic, but it would be difficult and complicated.

In the meantime, I'll go find me a usable editor for Heroes III.


AlexSpl wrote:
Quote:
posted July 20, 2010 08:04 AM  Edited by AlexSpl at 08:37, 20 Jul 2010.
Quote:
Did you even read my long comment all the way through? The 'respect' part sounds a little too dismissive.

Of course, I did. It might be interesting for you to play with this tool (see the last post for update).

And, finally, I'm talking about player's morale, not AI's.

Quote:
Sorry if this have already been mentioned, but this time variable, do I understand it correct that it's defined as the time from when a given creatures action starts to it ends? Meaning it'll be reset everytime a new creature of the player moves?

Yes, this is exactly what I mean.

Well, such a strange behavior of Morale is the direct result of using the same RNG for many purposes in the game. In particular, the game uses it for managing random creature animation when nothing happens on a battlefield (just recall what creatures do while you're drinking coffee). Thus, things mess up. There was an attempt to make a patch to fix this issue (specially for offline tournaments) but players still love to get Morale when they want to So, the patch's fate was unlucky.




AlexSpl wrote:
Quote:
posted by AlexSpl on July 20th, 2010 01:57 PM
Our goal is to estimate probabilities of getting morale with our unit after different actions such as move, attack and others. Let's start from the simplest case - getting morale after moving from hex A to hex B.

As we know, there is M/24 (-M/12) chance to get positive (negative) morale for both human player and AI after (before) any action of any their unit (M is for Morale parameter, can be -3, -2, -1, 0, +1, +2, or +3). Whether a stack gets positive (negative) morale (here I mean its effect) or not, this depends on the following condition: mod(R, 24) < M (mod(R, 12) < -M), where R - random integer. If this condition is met, your creatures see the beautiful gold bird above them (or ugly brown one in case of negative morale).

However, it's just the theory. Real things, as always, are much more complicated. First of all, this random number is changing even if human player doesn't do anything. This is the main difference in RNG mechanism between HoMM III and earlier versions (in HoMM I/II RNG doesn't produce any new random number unless a player or AI do their actions). That's why, for example, you cannot repeat all the actions (morales, damages, etc.) when playing the same battle again. Though, if a battle starts with AI opponent moving first, morales, lucks, damages, etc. will be the same exactly as they have been in previous battle as long as it is not human player's turn.

Why random numbers are changing if there are no user actions? Because the only one game's RNG produces random numbers not only for morale, luck, special abilities events and damage calculations but also for such things as creatures idle animation, music theme changing and some other purposes.

So, can we consider such multipurpose RNG as uniformly distributed? Of course, no! Because some remainders (see the inequations above) 'live' longer than others. This results in almost unpredictable distributions. Studying properties of these distributions is my main goal now.

To be continued...

____________
Better judged by 12 than carried by 6.

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

Tavern Dweller
The enemy of your enemy
posted July 20, 2010 10:06 PM
Edited by val89 at 22:35, 20 Jul 2010.

I must congratulate you on your testing program: it showed me that my observations were correct: your hero's morale is dependent on:
1. Actions, spells, etc. (didn't expect hovering over enemy unit to be one)
2. Chance. Your program shows this excellently, although it does feature "dead zones" (which you mentioned) where the RNG stops going through numbers for about 5 seconds and "lottery" peaks (I think of the numbers spinning like in a casino lottery type thing) where change is fastest for about 5 seconds. These follow one another as shown in the graph. This also confirms your point on uneven distribution.

Disclaimer: Please note that all numbers on the graph are rough estimates. Don't sue.



However, it also showed the chance doesn't decrease as time goes on.  In fact, it stays the same. Whether you're going to use the "lottery" (when the number changes really fast; I have this on a logarithmic scale on my graph) or "dead zone" (when the number stops changing), the chance is the same.  During all of the "lottery" numbers, I've had it not even become green for a millisecond a few times. And roughly 1/24 "dead zones" sit right on the green number 1, which is how it should be.

Both chances are exactly the same, 1/24. The chance does not decrease over time; it's an RNG and it should have all numbers distributed fairly evenly -- which it does.

Note that by hovering over an enemy unit, you trigger the "lottery" change of numbers early. Moving/attacking with other units and casting spells also initiates the RNG to change the number. It then goes back to its pattern.

I also noticed that you don't have any way of calculating enemy morale.
Why? Enemy morale is already calculated, as in my Red Dragon test and as you said. An RNG is already chosen (when you load the game) for AI morale. The AI knows exactly which spells, actions, etc. it is going to use and they don't change. You don't see the AI mouse hovering over your unit for an extended period of time too.

This applies to the hobgoblin situation. Since nothing in angelito's experiment changed in a way to disrupt the enemy morale RNG (which stays fairly constant compared to your hero's morale RNG). The hobgoblin continued attacking the tent and the tent continued healing itself ad infinitum. The enemy random number was 1 to begin with, and the tent as well as the creatures defending didn't do anything to change that with the RNG.

Hope this helped. Congrats again on that chea- *AHEM* testing program.

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


Responsible
Supreme Hero
posted July 21, 2010 08:47 AM

I'm glad you've got my point. Now I'm going to explain what is my graph for. Suppose, human player has fixed time (t) to do his move. Say, t = 10 seconds. The player makes his move at random time between 0 and 10 seconds. What the probability for him getting morale? It is equal to TimeMorale / t, where TimeMorale is sum of all 'green' intervals. Now let be t variable and you'll get something like my graph.

I agree with you that morale chances don't fade away as time passes. I have done two tests (very time consuming, though) and convinced myself that Pr[M](t) function has a limit.

Test #1 (M = +2).
lim {t -> infinity} Pr[M](t) ~ 9.50%
Testing time was about 1 hour.

Test #2 (M = +1).
lim {t -> infinity} Pr[M](t) ~ 4.27%  
Testing time was about 10 hours (I just forgot to switch off my computer and went sleep).

So, what do I mean when I state that, usually, the longer you are thinking, the less chances you have for morale to appear. For small time intervals TimeMorale / t may be a very big value, while for large intervals this value tends to decrease, finally becoming equal to respective limit (see limits above).

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

Tavern Dweller
The enemy of your enemy
posted July 21, 2010 07:23 PM
Edited by val89 at 19:35, 21 Jul 2010.

Quote:
So, what do I mean when I state that, usually, the longer you are thinking, the less chances you have for morale to appear. For small time intervals TimeMorale / t may be a very big value, while for large intervals this value tends to decrease, finally becoming equal to respective limit (see limits above).


That would logically make sense, because the game doesn't use TRUE random numbers, but instead an algorithm. A site like this one uses true random numbers from atmospheric noise. The game can play without Internet, and where else would it get true random numbers? So it must use an algorithm of its own to make pseudo-random numbers.

Judging by the fact that the game was made a decade ago, the pseudo-random number generator uses an algorithm isn't really that complicated, so it falls apart if you leave it without a stimulus (something as simple as dragging your mouse over an enemy unit) for hours. This limit you're talking about is the end of the algorithm the pseudo-random number generator uses.

Then again, who would think for hours just to make a simple combat move?
____________

And remember: you do not read.

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


Admirable
Omnipresent Hero
Wog refugee
posted July 21, 2010 07:32 PM

Quote:
Then again, who would think for hours just to make a simple combat move?


Hmm, almost all good players.

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

Tavern Dweller
The enemy of your enemy
posted July 21, 2010 07:57 PM
Edited by val89 at 20:00, 21 Jul 2010.

Quote:
Hmm, almost all good players.


I naturally make most combat decisions before the battle, especially if I have the Visions spell. I can then judge what to do if my opponent goes first or if I go first, including what spells to cast and where to move. It shouldn't take hours (at that rate, it will take days or even weeks before the battle finishes), unless I'm playing in a single scenario or campaign and reload a difficult battle over and over just to get the minimum possible casualties.

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


Admirable
Omnipresent Hero
Wog refugee
posted July 21, 2010 09:21 PM
Edited by Salamandre at 21:25, 21 Jul 2010.

Visions? Great spell for defeating Crag Hack indeed
The morale issue is interesting only in MP, in single you don't need to go so far, but only know AI flaws. Would be funny if Alex demonstrates that more you wait the morale chances goes lower.

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

Tavern Dweller
The enemy of your enemy
posted July 21, 2010 10:38 PM

We shall see.

As for the morale issue in multiplayer, would you include Hot Seat or is it just internet play?
____________

And remember: you do not read.

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


Hired Hero
Romanian competition cavalier
posted July 22, 2010 03:12 AM

more you wait the morale chances goes lower.


well, i don't know how it is, but as i remember, i gain morale when i think for some time (longer). and that makes me believe that M(morale)=P(photon, velocity of light)-1. So, if you wait more and more, the chances grow, and Alex can prove how much.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread »
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.1749 seconds