PieceOfMind's Advanced Combat Odds

The bars turned out so good, I'm wondering how we could use them in the lower detail levels. Perhaps they could go at the start of each outcome line, before Victory, Defeat, Retreat, and Withdraw? I think those lines should be short enough not to wrap with the bars.
 
At the low setting, where average HP are not displayed they'd fit on those lines, but I'm not so sure about on medium and higher.

My advice would be to only use them at high and Everything detail. At lower details, there is not much need to use bars to represent the few battle outcomes.

When stating the explicit HP outcomes though, reading 5 values or so, or more, can be easier done with a graph, which is where the bars will be powerful.
 
I agree. I just integrated your latest version, and indeed the medium level would cause those lines to wrap. It was a neat feature in search of a use, and not worth it. ;)
 
This is looking great.

I still feel the bars are a bit short most of the time. I'm going to try conditioning the length of the bars against the unit surviving and see how they look, even though the figures beside the bars won't be conditioned. This will just mean the bars for attacker and defender will not be to the same scale.

 

Attachments

  • Civ4ScreenShot0206.JPG
    Civ4ScreenShot0206.JPG
    28.5 KB · Views: 422
Looking better now. This is the same battle as previous post...

 

Attachments

  • Civ4ScreenShot0207.JPG
    Civ4ScreenShot0207.JPG
    29.1 KB · Views: 422
lol gotta love this battle...

Do you think I'll win?

However this example is making me wonder if I should include the 0HP possibility so we don't have things looking like this.... Note the probability of axe surviving with 25HP is near 0 yet it looks significant.

 

Attachments

  • Civ4ScreenShot0208.JPG
    Civ4ScreenShot0208.JPG
    25.6 KB · Views: 396
Wow, that looks cool. :goodjob: Is there a simple way to normalize all the bars to the same scale? The bars in the pic two posts ago make it look like the defender is more likely to win since the area of all its bars is larger than the area of the attacker's bars.

I haven't looked at the code at all. Do you calculate all the possibilities up front, or as you draw them? If the former, can you keep track of the max and then normalize all the bars to that one being 100 pixels?

Originally I was going to make red bars for the defender. Should I still do that? It looks nice having the bars be one color. Perhaps they should all change to yellow so they stand out from the green and red numbers?
 
Regarding the 2 first pics (not the 3rd)...

The first one had the bars exactly proportional to the size of the odds against them. This one involved no scaling. The entire area of the two sets of bars should be 1.

The second one I normalized the length of each bar by dividing by the probability of the unit surviving. This effectively makes the area of each of the attackers bars and defenders bars 1. The total thus being 2. The area of both should be the same so it would be an optical illusion I guess, if you were thinking the defender had more area.

The reason I showed the second one was because when the defender odds were very low you basically couldn't see any defender bars at all. If defender odds are 2% for example, there's not much point having 1 pixel wide bars.

I calculate the probabilities then draw them as I do it. There's a little bit of redundancy in the number of loops done because the Victory odds and expected hitpoints (beside the victory odds) need to be known before I print the detailed HP odds.

However it will not be hard to keep a max value for the HP details. The one problem with normalizing against a max value though is that if odds are fairly spread out across the different HP levels, the area of the bars will look huge because they will all be near the maximum.

Regarding the colour of bars, I think it would be nice to have red bars too because the green ones do look a bit odd beside the red values. You could make them all yellow instead - I'm not sure how it will look so maybe you can test and decide? Are these dds files hard to make?

EDIT
I used the word 'area' in much the same way as one would say 'length'.
 
By the way, I have gone back to using the unscaled bars, but have now included a 0HP value for each. This definitely makes it more obvious who has the better odds now. I think this is how it should be left.

 

Attachments

  • Civ4ScreenShot0209.JPG
    Civ4ScreenShot0209.JPG
    31.1 KB · Views: 442
I'm torn. I understand the reasoning, but I think it's slightly misleading to show the 0HP probability under the outcome where that unit wins. Enough to remove it? :dunno: Maybe replace the 0HP with a little skull and crossbones. :lol:

As for colors, the bars are pretty easy to make. I'll make both red and yellow versions. so you can see for yourself.
 
Maybe we could use the yellow version for the death of the unit? lol do you want to make a skull and crossbones image?

By the way, can you make any other recommendations by way of tidying up the presentation. The heading and "----------" at the end look a bit tacky, not that I care. But I'm sure people like things more when they look nice.

Hmmm after a bit of thought I think I agree in getting rid of the 0HP bar. lol.
 
I agree with ditching the dividers to clean it up. I'm no artist, so you'd have to find an existing skull and crossbones. :D I can, however, draw little bars (attached).

I have a few minor formatting suggestions:

  • Put a space after any comma to add a little breathing room
  • Add ".0" to the E[AttHP] for the retreat case to match the E[DefHP] right next to it
  • Maybe change (#XP) to "for #XP" like DanF had: e.g. "24.23% for 3XP (32.2HP)" [because there are a lot of parens]
Oh, I've been meaning to ask but keep forgetting. On the E[HP] line, are the two "100->" parts shown because your examples always test two healthy units? Is it necessary to show the starting HP for each unit since it's shown in the standard details further below?

And you might want to change "E[HP]" to "Exp. HP" or "Avg. HP". Bah, those aren't any clearer, nm. LOL

In the readme, you might want to state that the odds can never be exactly 0% or 100%, so when those numbers are shown, they are always due to rounding. The way it's worded, it implies that you hide the difference between 100% and >99.99% when in fact they are the same, right?
 
Put a space after any comma to add a little breathing room
Done
Add ".0" to the E[AttHP] for the retreat case to match the E[DefHP] right next to it
I would prefer not to do this because the number is not rounded. I think the risk of someone believing it is a rounded number is a bigger problem than the slight inconsistency between the 2 numbers - one being an integer and one being a rounded float.
Maybe change (#XP) to "for #XP" like DanF had: e.g. "24.23% for 3XP (32.2HP)" [because there are a lot of parens]
Done
Oh, I've been meaning to ask but keep forgetting. On the E[HP] line, are the two "100->" parts shown because your examples always test two healthy units? Is it necessary to show the starting HP for each unit since it's shown in the standard details further below?
Yeah most of my examples have been full health units. It is true the hitpoints are shown below, but I thought it was good to include them here so when you are fighting an injured unit you can see more easily whether you are actually likely to damage them or not. If it just says 30HP but they start on 35HP then it could lead you to believe you are damaging them quite well. However I will see how it goes without the starting HP, because I do agree with you to an extent. Also, note this feature only shows at high detail or higher.
And you might want to change "E[HP]" to "Exp. HP" or "Avg. HP". Bah, those aren't any clearer, nm. LOL
Changed to "Average HP:"
In the readme, you might want to state that the odds can never be exactly 0% or 100%, so when those numbers are shown, they are always due to rounding. The way it's worded, it implies that you hide the difference between 100% and >99.99% when in fact they are the same, right?
I'm not sure exactly what you mean. In the readme I have:
All results are rounded, meaning sometimes the sum of some numbers that should add up to 1 will be slightly greater than 1 or less than 1. eg. if three events are equally likely but mutually exclusive, they each have 1/3 probability of occuring. This would be displayed as 33.33% for each, adding up to 99.99%.

I have not bothered to call odds greater than 99.99% ">99.99%". Instead, odds that are rounded to 100.00% will be displayed as 100.00%. Similarly for 0.00% when odds are very low.

It is possible for the attacker to have 100% chance of victory, but never the defender to have 100% chance of victory. This is due to the way the die is rolled. Perhaps I actually could go and write >99.99% when it's greater than 99.99 but not equal to 100. I may make another line pop up if the defender odds are indeed exactly 0%.
 
I think theoretically, with a 1000sided die used for combat (as is used by the game), a 1HP scout has literally 0% chance of winning if attacked by a unit with 10:strength: or more. Similarly for a 2HP warrior and a 20:strength: unit.

The strength difference (taking injuries into account) must be at least a factor of 1000. But if we change the number of die sides to say, 100, then it becomes much more frequent.

Perhaps I could insert an Easter Egg for the rare event of having 100% odds? :D
 
In any case, I'd prefer it looked like

Survival odds: 63.2% , 51.8%

May I throw in a suggestion: We are so accustomed to seeing 6.00 vs. 2.00 for the strength factors. Wouldn't it make sense to display percentages the same way? I.e. 63.2% vs. 51.8%

Cheers.
 
I would prefer not to do this because the number is not rounded. I think the risk of someone believing it is a rounded number is a bigger problem than the slight inconsistency between the 2 numbers - one being an integer and one being a rounded float.

What is the harm in the player thinking it's a rounded number?

I'm not sure exactly what you mean. In the readme I have: . . .

This is probably my lack of knowledge about the algorithm, but I thought that it was impossible to have 100% and 0% odds. You say below the attacker can in a rare case have literally 100% chance of winning; is that exactly 100%, or really close to 100%?

My only concern is that I've never seen 100% odds in the game, so showing >99.99% as 100% might make players think they actually have no chance of losing a battle. And if that happens and they do lose, we'll never hear the end of it! :rolleyes:

I love Easter eggs, so ya!

63.2% vs. 51.8%

I like this too for the first line.
 
Ok. Here are some examples of using the "Everything!" detail level.

I'm already able to finally do the experiments I've been meaning to do :D

What do people think of the yellow bars?



Here is the typical cavalry vs. Combat 5 mace battle I've shown several times above, for easy comparison...

 

Attachments

  • Drill 1 to 4 on injured unit.JPG
    Drill 1 to 4 on injured unit.JPG
    141.1 KB · Views: 961
  • Civ4ScreenShot0211.JPG
    Civ4ScreenShot0211.JPG
    31.3 KB · Views: 413
What is the harm in the player thinking it's a rounded number?
Just the fact that it isn't a rounded number. The actual value in the code is an int so it would be weird to add a .0 onto it just so it looks the same as the next value.
This is probably my lack of knowledge about the algorithm, but I thought that it was impossible to have 100% and 0% odds. You say below the attacker can in a rare case have literally 100% chance of winning; is that exactly 100%, or really close to 100%?
I really did mean literally. For example, I just tried a Combat 6/Shock 1 Modern Armor vs. a warrior with 3HP. :D (yes the power difference has to be that crazy!)

The defender odds are calcualted as:
int iDefenderOdds = (1000 x 4) / (7000 + 4) = 0. This warrior literally cannot win a round unless we were to increase the die size to 7004/4 = 1751. Because the die has 1000 sides we get this result.

My only concern is that I've never seen 100% odds in the game, so showing >99.99% as 100% might make players think they actually have no chance of losing a battle. And if that happens and they do lose, we'll never hear the end of it! :rolleyes:
That's a good point. Whatever happens though, my preferred solution to that is to make the readme and instructions in the thread as clear as possible about that point, because going through the code putting in lots of if statements for that one little detail will be tedious.
 
Here's another settings comparison...

I've added bullets in front of the general combat odds, but I could remove them if they look silly.

 

Attachments

  • Civ4ScreenShot0220demo.JPG
    Civ4ScreenShot0220demo.JPG
    88 KB · Views: 298
Top Bottom