Stupid or unlucky?

Discuss anything related to warbarons.

Re: Stupid or unlucky?

Postby KGB » Tue Sep 07, 2010 7:34 pm

Piranha,

Ah, OK. Instead of doing all the 20 sided dice rolls for every hit you are just doing straight percentage for each hit in order to speed up the 1000 roll simulation.

Yes, that should work. It should be easily testable too against doing the slower dice rolling numbers for the spider battle and hero battle. If you get the same numbers (counts of each individual outcome and final winning percentage) then you'll know it works and you can use that to generate the 90% ratio at lightning speed.

KGB
KGB
 
Posts: 3030
Joined: Tue Feb 16, 2010 12:06 am

Re: Stupid or unlucky?

Postby Zajoman » Tue Sep 07, 2010 8:30 pm

Okay, I've implemented the hard 90% cut off now and it works like a charm. I run 1000 simulation battles and get occurences of survivors for each side. Then I run "real" battle and if it fits with the survivors of the 1000 simulations, the battle is okay, if not, I run it again, until it meets the criteria. So now it works exactly as we wanted - extreme results never happen, lucky ones happen sometimes.

In a 8v8 scenario, 1000 simulations plus the real battle takes about 25600 rolls and 1.8 seconds.
Zajoman
 
Posts: 107
Joined: Thu Aug 12, 2010 6:56 pm

Re: Stupid or unlucky?

Postby Zajoman » Tue Sep 07, 2010 8:49 pm

But, in an 8v16 simulation this doesn't work. I have 8 Light Infantry vs 16 Scouts. Defender has 28% chance to win, but cannot ever win, because the survivor occurences are too spread out between all the possibilities (as there are 16 slots) and not even 1 survivor gets enough occurences to pass through. Need to tweak this.
Zajoman
 
Posts: 107
Joined: Thu Aug 12, 2010 6:56 pm

Re: Stupid or unlucky?

Postby KGB » Tue Sep 07, 2010 9:03 pm

Zajoman,

That's why I suggested using the soft method of summing up to 100 (since you are using 1000) results.

It means you'll always get a cut off point.

KGB
KGB
 
Posts: 3030
Joined: Tue Feb 16, 2010 12:06 am

Re: Stupid or unlucky?

Postby Zajoman » Tue Sep 07, 2010 10:11 pm

Okay, but what if these are my occurences (in 1000 loops, not 10000):
Stack 1 Survivor Distribution (going from 0 to 8 survivors): 97 96 116 191 214 162 92 31 1
Stack 2 Survivor Distribution: 903 27 23 16 12 7 8 4 0
Attacker average units left: 3.344
Defender average units left: 0.28
Attacker won 903 out of 1000 battles (90.3% wins).

In this case, the attacker should be left with 2 to 5 men and the defender should always lose. But if we use the soft method, for the attacker you get 1 + 31. Since adding 92 to that is more than 100 you don't include the 92 result. All the rest is used.
Defender simply always loses.

So stack 1 distribution is (from 0 to whatever men left): 97 96 116 191 214 162.
So stack 2 distribution is: 903.

So stack 1 wins with 1, 2, 3, 4 or 5 men left (excluding zero as that cannot happen because defender cannot win).
Stack 2 never wins.

But that's bad for stack 1 as it should end up with at least 2 men, but according to this it can get unlucky and win with only 1 man left.

What do you think?
Zajoman
 
Posts: 107
Joined: Thu Aug 12, 2010 6:56 pm

Re: Stupid or unlucky?

Postby KGB » Tue Sep 07, 2010 11:01 pm

Zajoman,

It looks perfectly fine to me.

In reality the numbers should be shown like:
0 4 8 7 12 16 23 27 | 96 116 191 214 162 92 31 1

As in it's one long chain going from max survivors on the left (stack 2) to max survivors on the right (stack 1). If you graph these numbers (X axis -8 to 8, Y Axis 0-1000) it will help clarify things to look like a bell curve with the top of the curve occurring between 3-4 (3.3 your average result). What we are eliminating would be the shaded areas at the ends of the bell curve (the outliers).

In this instance that shaded area on the left is all of stack 2 because the sum of all stack 2 victories is <100. On the right you are eliminating the last 2 results (7, 8 men left).

So the attacking stack in this case wins with 1-6 men left (not 5, the 92 case is included in the soft cap). The average result you worked out to be 3.3 men. So getting 1 man in the worst case for the winner is only 2.3 men less than average. It's not *that* unlucky. On the other end getting 6 men left is getting 2.7 more than average which again isn't *that* lucky.


Can I guess the reason you think something is wrong is because we are allowing the 96 (1 man) and 92 (6 men) cases to stand under the soft cap system?

If so, remember that I wanted to eliminate the outlier 10%. If you actually total up the number of excluded cases you'll see they are 0+4+8+7+12+16+23+27+31+1=129. That's actually 129/1000 or 12.9% exclusion or slightly more than 10%.

In the hard cap method you'd add 92+96 to that total to actually exclude 317/1000 or 31.7% of the total. So the hard cap case reduces randomness even more by lowering the standard deviation (hence why you only get 2,3,4 and 5 men left).

There are argument to be made for both methods. In fact maybe Piranha could allow the user to select one of 3 battle results modifiers for a map: Highly Random (as it is now), Some Variation (The soft cap), Highly Deterministic (The hard cap) and then use the appropriate method to shape the results.

KGB
Last edited by KGB on Wed Sep 08, 2010 1:20 am, edited 2 times in total.
KGB
 
Posts: 3030
Joined: Tue Feb 16, 2010 12:06 am

Re: Stupid or unlucky?

Postby KGB » Tue Sep 07, 2010 11:12 pm

Piranha,

I wanted to clarify something about the percentage chance you are using. Lets use the 2 strength unit vs a 1 strength unit.

When you obtain the hit % I hope you are using the ratio of (2 strength unit chance to hit / 1 strength unit chance to hit) and not just straight strength numbers.

Correct way:

2 str hit chance: 2/20*19/20= 0.095
1 str hit chance: 1/20*18/20=0.045

2 str hit percentage is .095/(0.095+0.045)=67.8%

Incorrect way:

2 str hit numbers = 2
1 str hit numbers = 1

2 str hit percentage is 2/(2+1)=66.6%

While the difference here is minor it becomes much much bigger with other numbers such as a 10 str vs 5 str unit.

10 str hit chance: 10/20*15/20= 0.375
5 str hit chance: 5/20*10/20=0.125

10 str hit percentage is 0.375/(0.375+0.125)=75%

So both battles feature a unit that has 2X the strength of the other unit. But in the second case the chance of hitting is 3-1 instead of what you might first think would be 2-1 (10/(10+5)).

This is why greater stack strength = much greater chances of killing vast amounts of inferior armies.

KGB
KGB
 
Posts: 3030
Joined: Tue Feb 16, 2010 12:06 am

Re: Stupid or unlucky?

Postby Zajoman » Wed Sep 08, 2010 1:43 am

What I'm afraid of in the soft cap method is that in certain rare cases it will be possible for the winner to survive with less men than he should. For instance if you have a battle where the attacker gets 10 1s, 20 2s, and then any numbers, if you go by the soft method, it will allow the winner to survive with only 1 or 2 men while he shouldn't, as 10 and 20 are too little. The problem is that when you reach the first 100 (or 1000 in your case), you just say, okay, all the rest of the results are okay, I take them. So if the stack is really unlucky, it will win with too few men.
Zajoman
 
Posts: 107
Joined: Thu Aug 12, 2010 6:56 pm

Re: Stupid or unlucky?

Postby KGB » Wed Sep 08, 2010 4:16 am

Zajoman,

I am afraid I don't understand what you are saying.

Can you just construct a case using made up numbers for each surviving unit count (attacker/defender) to illustrate what you mean.

KGB
KGB
 
Posts: 3030
Joined: Tue Feb 16, 2010 12:06 am

Re: Stupid or unlucky?

Postby Zajoman » Wed Sep 08, 2010 5:47 am

Made up numbers...

Stack 1 survivor distribution: 10 20 250 250 250 170 35 15
Stack 2 survivor distribution: 905 85 10 0 0 0 0 0

Stack 1 always wins, but the question with how many men. Soft method goes like 15 + 35, since adding 170 to that is more than 100 you don't include the 170 result. All the rest of the results are taken.

So stack 1 (10 20 250 250 250) can end up with 1, 2, 3, 4 or 5 men left. The problem is that even though it should never end up with only 1 or 2 men, it can, according to the soft method, because it takes everything what is after reaching 100.

In short, the soft method does not handle the minimal survivors, only the maximal.
Zajoman
 
Posts: 107
Joined: Thu Aug 12, 2010 6:56 pm

PreviousNext

Return to Game discussion

Who is online

Users browsing this forum: No registered users and 7 guests

cron
Not able to open ./cache/data_global.php