PieceOfMind's Advanced Combat Odds

Note that without the 0 hitpoint odds, the various odds add up to the percentage of victory of the unit mentioned above. The 0 hitpoint odds are equal to the odds of the other unit winning. It seems a bit counter-intuitive to mention them below the odds of that unit winning.
 
Note that without the 0 hitpoint odds, the various odds add up to the percentage of victory of the unit mentioned above. The 0 hitpoint odds are equal to the odds of the other unit winning. It seems a bit counter-intuitive to mention them below the odds of that unit winning.
You could reverse the order for the defender's odds, so it goes from death, to winning undefeated. Would probably be more intuitive that way.
 
I think the bullets clutter it up and compete with the bars and just aren't necessary in the Low detail view. Perhaps just add a white colon after each outcome name to match other texts:

Victory: 49.2%, 5.3HP

Now I already think before I say it that this will be a) confusing and b) goofy, but what about coloring the bars based on the "goodness" of the outcome for the attacker?

  • Green: Attacker wins
  • Yellow: Attacker retreats or withdraws (or possibly dies for defender bars)
  • Red: Attacker dies
The above example would look like this:

Code:
[COLOR="Green"]Victory[/COLOR]: 75.11%
[COLOR="Green"]Retreat[/COLOR]: 7.47%
[COLOR="Green"]=[/COLOR] [COLOR="Green"]100HP[/COLOR]
[COLOR="Green"]== [/COLOR][COLOR="Green"]83HP[/COLOR]
[COLOR="Green"]=== [/COLOR][COLOR="Green"]49HP[/COLOR]
[COLOR="Green"]=== [/COLOR][COLOR="Green"]32HP[/COLOR]
[COLOR="Yellow"]== [/COLOR][COLOR="Green"]15HP[/COLOR]
[COLOR="Red"]=== [/COLOR][COLOR="Green"]0HP[/COLOR]
[COLOR="Red"]Defeat[/COLOR]: 17.43%
[COLOR="Red"]= [/COLOR]100HP
[COLOR="Yellow"]= [/COLOR]78HP
[COLOR="Yellow"]== [/COLOR]56HP
[COLOR="Yellow"]=== [/COLOR]34HP
[COLOR="Yellow"]=== [/COLOR]12HP
[COLOR="Green"]============ [/COLOR]0HP

Edit: LOL, that looks . . . interesting.

Otherwise, I think I'd remove the yellow bars as they don't belong to the outcome under which they appear.
 
I agree about the bullets. I already got rid of them actually. lol

Regarding the yellow bars, I thought it wasn't that misleading to put those bars to represent the death of the unit because making it yellow was sufficient to make it clear it wasn't part of the odds of the unit surviving. Mainly it just helps to show how low some odds can be - you can see that the 0HP outcome is extremely likely without even looking at the number! I think just being able to glance at the display and not even read numbers is a powerful way to use it, though really it's not the point of the higher detail settings.

But I guess I will get rid of the 0HP details all together...

EmperorFool, the problem with colouring the different HP outcomes based on how "good" they are is that they often cover a range of outcomes. For example, the 15HP for the attacker up there includes the possibility of retreating and killing the defender while on 15HP. i.e. you can end up on 15HP without retreating.
 
Mainly it just helps to show how low some odds can be - you can see that the 0HP outcome is extremely likely without even looking at the number!

That's why I'm still undecided which way I prefer. But that raises a good point: how about an "All Graphical" display mode just for kicks? Use bars for each outcome probability and expected HP. It could work for XP too, I suppose. LOL, that would probably be very hard to read, but it would look neat. :D

Survival: ======= ===
Victory: ====== for == XP
Retreat: = for = XP

Adding the E[HP] values would get very messy. I doubt anyone wants that kind of numberless display, so it's probably not worth the effort. I just like throwing out ideas, and I'm stoked the bars worked out so well that I want to use them everywhere! ;)

I think just being able to glance at the display and not even read numbers is a powerful way to use it, though really it's not the point of the higher detail settings.

Thus my idea of using them for the lowest detail, below Low. But back on track . . .

But I guess I will get rid of the 0HP details all together...

You can always add an option for it and let the user decide. :dunno: I know that's kind of backing away from my earlier press for fixed detail levels, but I'm not 100% on either side with this option.

EmperorFool, the problem with colouring the different HP outcomes based on how "good" they are is that they often cover a range of outcomes.

Yeah, that's what I was getting at--too many overlapping cases that it would be misleading.
 
That's why I'm still undecided which way I prefer. But that raises a good point: how about an "All Graphical" display mode just for kicks? Use bars for each outcome probability and expected HP. It could work for XP too, I suppose. LOL, that would probably be very hard to read, but it would look neat. :D

Survival: ======= ===
Victory: ====== for == XP
Retreat: = for = XP
I'm interested to see what something like this would look like. If you do add it in, you should color the retreat in the survival bar as yellow, something like so:
Survival: ====== = === #%(%vic+%wit)
Victory: ====== #% for #XP
Retreat: = #% for 1XP
Defeat: === #% for #XP
 
How about like this? :D

The four detail settings...

Changes:
Coloured retreat odds yellow. Added a bar at the top that shows the 3 main possible battle outcomes and their proportions out of the full bar.



By the way, the yellow got a bit washed out in the jpg. It looks a bit brigther, as seen in this bitmap instead.



EDIT
Still on the To Do list:
-Add Flanking damage
-Add in details about barb free wins (for Prince and lower difficulties).
 

Attachments

  • Civ4ScreenShot0225_demo.JPG
    Civ4ScreenShot0225_demo.JPG
    85.6 KB · Views: 440
  • Civ4ScreenShot0225_demo2.bmp
    150 KB · Views: 411
That looks totally freakin' awesome! :goodjob:

Two minor nits left:

  • It looks like there are 2 spaces before the (E[HP]) parens on the outcome lines, but it may just be the paren itself.
  • Put a white colon (":") after "Att/Def unharmed" headings to match the other lines.
Brilliant! :D
 
I'll add the colons. I want to leave the 2 spaces before the parentheses though. Can we get a second (well, third) opinion? :p

By the way, this is the current changelog...
I've spotted 2 bugs already from v0.1, though one of them is very rare (involves units with 100% retreat odds or greater. e.g. Flanking 2 attack subs with the GG withdraw promo)

Changes:
Version History
---------------
v0.1 (Please report any questionable behaviour)

v0.2
-Fixed a bug causing Defender Unharmed odds to be too high if defender was 1 hit from being killed at start of battle.
-Added expected hitpoints conditional on certain unit outcomes, now placed beside the specific outcomes.
-Removed universal expected hitpoints, as they were less useful with the above additions
-Removed combatLimit display for attacker because this is now obvious from the expected defender hitpoints beside the Withdraw odds.​

v0.3
-Added options for Low,Medium,High details. Also included Everything level.
-Added a few new statistics
-Added CombatRatio
-Added detailed HP outcomes
-Added more detail to XP shown for "everything" detail level
-Added range CombatRatio detail to "everything" detail level
-Moved Defender Unharmed odds to only high detail
-Re-added universal expected hitpoints but only for high and everything detail settings​

v0.4
+Flanking damage (to do)
-Green/red bars for detailed HP outcomes
+barb combat details made explicit (to do)
-fixed bug when withdraw odds were greater than 100% (eg. attack sub with +60% more withdraw chance). Units can in fact have exactly 100% withdraw odds
-added visual bar at top of display, representing the 3 main battle outcomes (or 2 if no retreat odds involved)​
 
It looks fine with 2 spaces--I just wanted to make sure it wasn't accidental.

Edit: A couple more questions because for the most part all numbers are color-coded to the attacker, defender, or outcome:

  1. Should the outcome labels be white and the odds be colored? I like the labels with color so they match the single survival bar at the top, but I'm considering consistency here.
    Victory: 12.2% for 2XP
  2. For the "HP x hits at X%" line, should the X% be green to denote that it's the attacker's chance to hit? [That's what it is, right?]
If you do change #1 above, what about merging the unharmed lines into one?

Unharmed: 12.2% vs. 2.5%
 
More good news:
The text scalings with Blue Marble do not adversely affect the odds display. It seems that increasing the font increases the width of the tooltip so there is no problem.

However, I found that enabling the alternative font Sans Serif, strangely, narrows the box to the point that many of the lines (particularly the retreat odds line) will wrap. The visual odds bar at the top wraps as well. I don't know if there's an easy way to fix this but at this stage it seems I should just recommend not using this mod in conjunction with the alternative font provided by Blue Marble. I don't really think many people desperately need that other font anyway.

Here's what it looks like with the largest font size from Blue Marble, but the default font type:
 

Attachments

  • Civ4ScreenShot0234.JPG
    Civ4ScreenShot0234.JPG
    43.4 KB · Views: 290
Looks good. A couple quick things:

1)Remove the white combat odd text left over from the original code, it's redundant, and just clutters up the new combat odds window you've built.
--1a)After removing the default odds numbers, you might consider moving the modified unit combat values to the top, with modifiers. But I really don't know, it might look better leaving them at the bottom.

2)Add the Unharmed defender stat to Medium display.

4)How does it look with siege? Is siege in yellow, because it withdraws? Personally I think siege should be displayed slightly differently, replacing the "Victory" & "Retreat" columns with "Withdraw", make withdraw green as this is the victory type for siege units.


Looks really slick so far. For what it's worth I think you should leave in the High and Everything HP value bars and percents, but personally I wol't use them, as I think it looks cluttered. No idea how to make it more aesthetic though, so I'm happy there will just be the option to play on a lower setting so that I'm not forced to see it. This is the main reason why I think you should add the Unharmed defender % to the Medium display, as that's useful info I'd like to see without needing to use the high detail window.
 
phungus,
I could remove the white odds from the top entirely, but I was given advice to leave them there by EF.

I can simply comment out the lines where those bits are printed. I'll post an update pic shortly.
 
Looks good:

1)For the High and Everything display, add in the Retreat odds to the bar and % for the 1hit left value at the bottom for victory. This will give a more accurate picture of what's going on in terms of expected life left in the unit. (In the above picture it gives a 10% chance of 16HP left, when in fact due to retreats it's 10%+42%, it would make sense to reflect this in the life left display)
2)Siege, see my post above bullet #4

I think EF is wrong, I can see why he'd want to have them left in, as they are the original code, but honestly the new combat pane supercedes it in a more detailed way, leaving them in only clutters it up. Also I'm curious to know if the modified combat values (with modifiers), from the original code would look better on top of, or below (as is) the improved combat odds pane. I'm not sure, this is purely aesthetic though, but hey that's part of it.
 
Siege withdraw odds are done in green just like victory odds, and I agree with you about it being the victory type condition for them - that was my logic too.

Regarding the leaving in of the white odds, I'm working on removing them atm and cleaning up the overall display. I'll post a pic with what it looks like soon.

Regarding the reatreat odds not showing up in the lowest HP value for attacker - that's a bug you just spotted, which surprisingly I hadn't yet. I always intended for the bottm HP value to include retreat odds so I'll go and see where I went wrong in the code. Thanks for mentioning it :goodjob:
 
white odds removed

I'm think I'm going to swap the top bar with the survival odds
 

Attachments

  • example11.GIF
    example11.GIF
    371.7 KB · Views: 326
phungus,
I could remove the white odds from the top entirely, but I was given advice to leave them there by EF.

Dunno where you got that, but no worries. I thought you said you were leaving those in while you were still testing so that you could make sure the original calculations matched yours. I assumed you were going to take them out when you were done testing.

I'm think I'm going to swap the top bar with the survival odds

I agree with this, too. I want to see the survival chances of both units as the first line. Edit: okay I see you've done that already. Looks great.

I see you added colors to the outcome probabilities. Cool. Did you try it also with the labels being white? It might be good to leave the colors only on the numbers and bars and keep all the labels white.

Why did you change the R value to red? Isn't it the ratio of the attacker's strength to the defender's strength? Higher numbers are better for the attacker, right? If so, I think it should be green.

I had another idea, too. We can detect when the shift and/or ctrl keys are pressed and have different detail settings for each. This would let the user set normal to Medium and ctrl to Everything. That way when you want more detail, you don't have to open the options screen (for BUG) or restart Civ (for stand-alone).

Edit2: Okay, last thing I promise: Do we need the "odds" label after Survival and Unharmed? All the percentages are odds, right? Of course, technically they aren't because odds are ratios, but I think you know what I mean.
 
Why did you change the R value to red? Isn't it the ratio of the attacker's strength to the defender's strength? Higher numbers are better for the attacker, right? If so, I think it should be green.

I changed it to red when it is less than 1.0. I was thinking about changing its colour entirely actually. Note at the Everything level it's always green. Maybe I'll make it cyan. I'd like the value to stand out a little bit.



I think the outcome labels look better coloured. They increase readability a tad.
 

Attachments

  • tidied up2.PNG
    tidied up2.PNG
    14.8 KB · Views: 399
Top Bottom