Fixing the cumulative luck calculation: 2/26/2011 01:20:45 
crafty35a
Level 3
Report

Over time, I've come to notice that the cumulative luck calculation doesn't seem to average out to zero over time. What I mean by this is that you are much more likely to end up with negative luck than positive luck. I don't know exactly how Warlight is calculating cumulative luck right now, but I feel that it should be a zero based system, for sake of simplicity. The way it works right now, average luck is actually negative, so it's difficult to tell if you actually had good or bad luck in a given game.
Just to prove I'm not imagining things, I checked the final cumulative luck total for the 27 games I have completed in the ladder so far. The average final luck in those games was 2.3, with a median value of 2.1.
While I don't know how luck is currently being calculated, I'd like to propose a system that will average out to zero. I will show a few attacks and the resulting luck calculations:
Turn 1:
A attacks B (3v2)
Expected kills: 0.6 * 3 = 1.8
Actual kills: 2
Luck: 2  1.8 = 0.2
Expected attackers killed: 0.7 * 2 = 1.4
Actual attackers killed: 2
Luck: 1.4  2 = 0.6
Total attacking luck: 0.2  0.6 = 0.4
B attacks A (6 v 4)
Expected kills: 0.6 * 6 = 3.6
Actual kills: 4
Luck: 3.6  4 = 0.4
Expected attackers killed: 0.7 * 4 = 2.8
Actual attackers killed: 3
Luck: 3  2.8 = 0.2
Total defensive luck: 0.4 + 0.2 = 0.2
Total cumulative luck for turn 1: 0.4  0.2 = 0.6 (This means that on this turn, player A lost 0.6 more troops than would be expected with average luck)
I'm sorry if this is a bit tough to follow  I can't really do much formatting here on the forums to make it easier to read. I'd love to hear anyone's thoughts on whether this makes sense. Please let me know if I was unclear or didn't explain anything well enough, and I will be glad to explain.

Fixing the cumulative luck calculation: 2/26/2011 02:57:57 
crafty35a
Level 3
Report

Minor correction  when I said "This means that on this turn, player A lost 0.6 more troops than would be expected with average luck," what I really should have said is that it was a combination of losing slightly more troops than expected, and killing slightly fewer enemy troops than expected.

Fixing the cumulative luck calculation: 2/26/2011 07:32:45 
The Impaller
Level 9
Report

This is a very good post. I've been meaning to make a post about this for some time as I have noticed the same thing as you, that the luck calculations can be quite misleading.
Someone can confirm or deny this claim, but I'm fairly certain that your luck value is directly related to how many safe or risky attacks you made in a game. If you make a lot of 3x2 attacks in a game, you're going to have significantly lower luck at the end of the game than if you make a lot of 4x2 attacks. My reasoning behind believing this to be true is that every time you fail a 3x2 attack, you get negative offensive luck for that attack, but if you're only making 4x2 attacks then you're never going to fail any (this assumes a low luck game) and thus you will never get negative offensive luck from it. Defensive luck is going to remain consistent for both.

Fixing the cumulative luck calculation: 2/26/2011 08:38:49 
Fizzer
Level 58
Warzone Creator
Report

Perhaps I'm missing something, but it looks like your system is the same as what WarLight already uses. Can you point out what's different?
If you hover over any attack order on the right side, it shows you the offensive and defensive luck for that attack.
The graphs just show the sum of these.

Fixing the cumulative luck calculation: 2/26/2011 09:38:44 
Math Wolf
Level 63
Report

I think this may make sense in a way.
The luck should sum up to zero, but with the neutrals included.
The neutrals are only attacked, but never attack you, so they may screw up the results and have on average a positive luck.
It all depends whether defensive luck and offensive luck are equally prevalent. Since players will play more offence than defence on average (aka, attacking neutral), you will have a negative luck IF the offence luck is slightly lower than the defensive luck. From the formula's I don't see immediately why offensive luck would be lower than defensive luck (large sample wise, that is), but as The Impaller said, you may make the same move (possibly with an average negative luck, live 3v2) several times, thus skewing your results.

Fixing the cumulative luck calculation: 2/26/2011 13:28:49 
crafty35a
Level 3
Report

Fizzer, wow, I had no idea you could hover over the attacks to see individual attack luck. That helps a ton.
First of all, you are splitting up the offensive and defensive luck differently than I am. I am including both parts of an attack (defenders killed, attackers lost) in the offensive luck calculation, and vice versa. I did this because it seemed more intuitive to me, but it would be easy enough to adjust if you want to maintain the current system.
Also, I think there is a bug or two in the current calculations that is making it very difficult for me to figure out exactly what is going wrong. Example:
 I just started a single player game. I issued a single attack of 3v2 each of the first three turns. Each time, both defenders were killed, and two attackers were killed.
 For each of these attacks, hovering over the history is showing Offense: 0.20, Defense 0.60 (defense should be 0.60 by my calculations)
 These numbers don't also don't seem to be match the graphs. The graphs show Offense: 0.4, Defense 0.4 for each of these turns (total luck zero).
Impaller:
3v2 attacks should not cause any undue luck in either direction. Succeeding will generate 0.2 positive luck, and failing will generate 0.8 negative luck  but you will succeed 80% of the time, so it will tend to average out to zero (but does not have to equal zero for any particular game). (Note that I am ignoring the "attackers lost" portion of the calculation, but the same is true)
MathWolf:
"The luck should sum up to zero, but with the neutrals included."
If you mean the two human players' luck vs. each other will sum to zero, then yes, that is true, but one player's luck should not necessarily always be zero in this system, even ignoring neutrals. It will, however, tend to average out to zero across multiple games.
"The neutrals are only attacked, but never attack you, so they may screw up the results and have on average a positive luck."
Neutral luck should average out to zero as well, across multiple games. I think you are misunderstanding the way it is calculated which ties in to the next statement...
"Since players will play more offence than defence on average (aka, attacking neutral), you will have a negative luck IF the offence luck is slightly lower than the defensive luck."
It really shouldn't matter how much you attack or defend. The kill rates are built in to the calculation. If a defender is expected to kill 0.7 troops, 70% of the time he will kill 1 troop and receive +0.3 luck. He will fail 30% of the time and get 0.7 luck. These will tend to average out to zero.

Fixing the cumulative luck calculation: 2/26/2011 14:37:08 
Math Wolf
Level 63
Report

I meant that in 1 game, the luck of all players, including (neutral) should sum up to zero.
I agree completely with you that everyone, neutrals included, should have, large sample wise (over several games) an average luck of 0.
However, you pointed out in your first post that this wasn't the case and I have experienced something similar myself. In games with full distribution however, the players will always sum up to zero, so therefore I argued that the neutrals somehow screw up the results.
According to the theory, they shouldn't screw up the result and formula wise (as I pointed out), there is no indication they do. However, in practice, they actually do so therefore I argued "you will have a negative luck IF the offensive luck is slightly lower than the defensive luck" since that would be the only possible explanation if all the formula's are correct and correctly implemented.
I think this is actually a very interesting discussion and if I had the time (which sadly enough I don't at the moment) I'd look back into all my games and study this in detail.

Fixing the cumulative luck calculation: 2/26/2011 21:01:58 
Duke
Level 5
Report

And what's with 100th of a point. I win attackign with 1 and it's +.39? Why not +.4. This is just an example, but it happens with all the calculations.

Fixing the cumulative luck calculation: 2/26/2011 21:27:12 
Fizzer
Level 58
Warzone Creator
Report

Hmm, I think you're right  there's a bug when calculating the *defensive luck* graph.
And since *cumulative luck* is just the sum of *defensive luck* and *offensive luck*, that means that it's wrong as well.
Unfortunately I just found it and I won't have time to fix it before 1.00.3, but I'll make sure it's fixed in the next release.
This is only a bug in the graphs  the values you see when hovering are accurate. *Offensive Luck* is accurate though.
Thanks for finding this!

Fixing the cumulative luck calculation: 2/26/2011 22:56:31 
crafty35a
Level 3
Report

Fizzer, are you sure about that? In my testing, offensive luck is not showing up properly in the graph, either. Note this part of my prior post:
 For each of these attacks, hovering over the history is showing Offense: 0.20, Defense 0.60 (defense should be 0.60 by my calculations)
 These numbers don't also don't seem to be match the graphs. The graphs show Offense: 0.4, Defense 0.4 for each of these turns (total luck zero).
I just retested this to verify, and I'm definitely not seeing the proper numbers for offense in the graph.

"This is only a bug in the graphs  the values you see when hovering are accurate."
I think the defense luck is wrong in the hover, too. For 3v2 attacks, if two attackers are lost, I'm seeing 0.6 when it should be 0.6. And it only one attacker is lost, I'm seeing 0.39 when it should be +0.4
So it looks like you just have the sign reversed, and are maybe truncating the decimal instead of rounding it?

Fixing the cumulative luck calculation: 2/26/2011 23:02:34 
Fizzer
Level 58
Warzone Creator
Report

*Defensive luck* when you hover over an order is from the defender's perspective. *Offensive luck* when you hover over an order is from the attacker's perspective.
The *cumulative offensive luck* graph simply calculates by adding the *offensive luck* and subtracting the *defensive luck*.
The .39 instead of .4 is just a rounding error. I think MultiPlayer will have fewer rounding errors than SinglePlayer, but I need to confirm that.

Fixing the cumulative luck calculation: 2/26/2011 23:06:37 
Fizzer
Level 58
Warzone Creator
Report

WarLight could have tried to change the values shown in the hover to always be from your perspective, but this would have posed problems.
For one thing, two people looking at the same order would get different numbers (you vs your opponent.) That's not too big of a deal, but it may bring up confusion when discussing luck values.
Secondly, and really more importantly, what would WarLight do when you observed two opposing players fighting? If it said + or  there would be no clear way to know who got the advantage.
To make it consistent, WarLight simply always makes the offensive number the attacker's perspective, and the defensive number the defender's perspective.

Fixing the cumulative luck calculation: 2/26/2011 23:29:21 
crafty35a
Level 3
Report

Good point about the different perspectives, I hadn't even considered that. That makes sense. When 0.39 is shown in the hover, the graph shows 0.39999999999... I understand that the graph value is due to a rounding error, but why wouldn't it be rounded to 0.40 for the hover?

Fixing the cumulative luck calculation: 2/28/2011 19:03:24 
Duke
Level 5
Report

I don't think it's a rounding error, maybe it's just showing only up to tenths when the actual number is 9 repeating.

Fixing the cumulative luck calculation: 2/28/2011 19:18:02 
Matma Rex
Level 12
Report

Actually, Duke, it probably is. Unfortunately the way floatingpoint numbers (nonintegral ones) work in computers is very clever and not always sensible to a normal human.
You can test it right in your browser: copy this into address bar and press Enter:
javascript: 1  0.9
Guess what  it will not be 0.1.

Fixing the cumulative luck calculation: 3/1/2011 13:11:05 
crafty35a
Level 3
Report

Regardless of the floating point math, wouldn't it make sense to round 0.3999999... to 0.4 for the hover? And even in the graph, for that matter.

Post a reply to this thread
Before posting, please proofread to ensure your post uses proper grammar and is free of spelling mistakes or typos.

