Advertisement
Civilization Fanatics' Center  

Go Back   Civilization Fanatics' Forums > CIVILIZATION IV > Civ4 - Creation & Customization > Civ4 - Mod Components

Reply
 
Thread Tools
Old Feb 13, 2009, 06:31 PM   #1
PieceOfMind
Drill IV Defender
 
PieceOfMind's Avatar
 
Join Date: Jan 2006
Location: Australia
Posts: 9,291
PieceOfMind's Advanced Combat Odds

Advanced Combat Odds
For BtS 3.19
Current Version:
v2.01 (3/11/2009)

readme for v2.01


Download:
ACO v2.01. For BtS 3.19 unmodded
Source files included


Description:
Advanced Combat Odds is a simple interface mod that gives the user a more detailed analysis of combat outcomes. It does not reveal anything that cannot be calculated from information available to the user.





Old Versions:
Spoiler:
ACO v1.1. For BtS 3.19 unmodded
Source files included

ACO v1.3. For BtS 3.19 unmodded
Source files included

(non-Executable) ACO v1.3. For BtS 3.19 unmodded (for those who prefer to unpack a mod manually)
Source files included

(non-Executable) ACO v1.3 + Better BtS AI v078C (by jdog5000 et al). For BtS 3.19 unmodded
Source files included
(Better AI mod can be found here)

ACO v1.4. For BtS 3.19 unmodded
Source files included
Attached Thumbnails
Click image for larger version

Name:	v0_4 main example.PNG
Views:	5800
Size:	443.9 KB
ID:	204447   Click image for larger version

Name:	latest_changes.PNG
Views:	2107
Size:	55.7 KB
ID:	204448   Click image for larger version

Name:	ACO_image.PNG
Views:	19707
Size:	456.4 KB
ID:	211290   Click image for larger version

Name:	v1_0 detail settings.PNG
Views:	16540
Size:	62.8 KB
ID:	211291   Click image for larger version

Name:	ACO v1_1 demo.PNG
Views:	13797
Size:	489.4 KB
ID:	220298  

Attached Files
File Type: txt readme.txt (14.6 KB, 911 views)

Last edited by PieceOfMind; Nov 02, 2009 at 09:28 PM.
PieceOfMind is offline   Reply With Quote
Old Feb 13, 2009, 06:33 PM   #2
PieceOfMind
Drill IV Defender
 
PieceOfMind's Avatar
 
Join Date: Jan 2006
Location: Australia
Posts: 9,291
Mods using Advanced Combat Odds:(Sorry, this list is not being maintained. There are probably many mods that use ACO now)

Last edited by PieceOfMind; Jan 10, 2013 at 03:11 PM.
PieceOfMind is offline   Reply With Quote
Old Feb 13, 2009, 06:34 PM   #3
PieceOfMind
Drill IV Defender
 
PieceOfMind's Avatar
 
Join Date: Jan 2006
Location: Australia
Posts: 9,291
Older versions...

The mod below works only for BtS 3.17.

Spoiler:
Advanced Combat Odds
BtS 3.17
Current Version:
v1.0 (18/04/09)

Description:
Advanced Combat Odds is a simple interface mod that gives the user a more detailed analysis of combat outcomes. It does not reveal anything that cannot be calculated from information available to the user.



Download:
v1.0. For BtS 3.17 unmodded
Source files included
v1.0.Merged with Better AI v0.70
Source files included
v1.0 Merged with Dresden's Unofficial Patch (including amphibious OOS fix)
Source files included


Installation instructions:
1. You must have at least Beyond the Sword version 3.17 before installing.
2. To install as a mod, simply extract the zip to your mods folder (\My Documents\My Games\Beyond the Sword\MODS\)and a mod called "Advanced Combat Odds v1_0" will be created, which can be loaded from the game.
3. To install it over the original DLL (not recommended if you play multiplayer), then first BACKUP the original dll file, which can be found at \Firaxis Games\Sid Meier's Civilization 4\Beyond the Sword\Assets\CvGameCoreDLL.dll, and then paste the new DLL in its place. If you installed it correctly it should be obvious when you start up a game and try out the mouseover odds. If you use this method, you should also place the contents of the "Advanced Combat Odds v0_4" folder inside your CustomAssets folder, as some XML changes have been made.

4. To change the detail level, you must change the value of COMBAT_ODDS_DETAIL in the XML file GlobalDefines.xml included.
0 = Low
1 = Medium (default)
2 = High
3 = Everything
Using Advanced Combat Odds:
Right from the outset, make sure you understand that all odds in the Advanced Combat Odds display are rounded to 1 or 2 decimal places. Displayed odds of 100.00%, for example, could represent 99.995% or greater meaning the odds are not certain. Similarly, 0.00% does not mean zero odds - just very small odds.

There are now four settings for the level of detail you wish to have displayed using this mod: Low, Medium, High and Everything! Medium is the default setting and recommended for most users. For the three settings Low, Medium and High, pressing and holding the SHIFT key brings up the Everything! detail - handy if you only need all the detail very occasionally.

Advanced Combat Odds aims to be more accurate, relevant and informative than the original odds calculator. Here is the list of features available at each detail setting. The features that are in bold are those that are not available at lower detail settings.

Spoiler:
Low detail:
  • Survival odds
  • Main battle outcome probabilities (Victory, Defeat, Retreat, Withdraw)
  • XP for each battle outcome (beside main battle outcomes)

Medium detail (Recommended):
  • Survival odds
  • Main battle outcome probabilities (Victory, Defeat, Retreat, Withdraw)
  • XP for each battle outcome (beside main battle outcomes)
  • Expected hitpoints conditioned on battle outcome (beside battle outcomes)
  • Att,Def damage per hit and number of hits and odds of hits and CombatRatio
  • Attacker and Defender Unharmed Odds

High Detail:
  • Survival odds
  • Main battle outcome probabilities (Victory, Defeat, Retreat, Withdraw)
  • XP for each battle outcome (beside main battle outcomes)
  • Expected hitpoints conditioned on battle outcome (beside battle outcomes)
  • Probability of every possible Attacker HP outcome
  • Att,Def damage per hit and number of hits and odds of hits and CombatRatio
  • Average HP for attacker and defender
  • Attacker and Defender Unharmed Odds

Everything!:
  • Survival odds
  • Main battle outcome probabilities (Victory, Defeat, Retreat, Withdraw)
  • XP for each battle outcome (beside main battle outcomes)
  • Expected hitpoints conditioned on battle outcome (beside battle outcomes)
  • Probability of every possible Attacker HP outcome
  • Probability of every possible Defender HP outcome
  • Nearby XP thresholds for units without a combat limit
  • Att,Def damage per hit and number of hits and odds of hits and CombatRatio
  • Unconditional expected Attacker,Defender HP
  • Attacker and Defender Unharmed Odds
  • Unrounded XP

Visual comparison:
Spoiler:



What do all those values mean?

Survival Odds:
These are simple - the odds of both the attacker (green) and defender (red) surviving. Sometimes using units like catapults means the defender will have 100% odds; This is because the attacker cannot kill the defender and must withdraw before dealing a killing blow.

Victory:
The odds of the attacker killing the defender. Also presented on this line is the number of XP the attacker would earn if he wins. At Medium detail and higher, there is an additional value on this line. This value is the average hitpoints of the attacker if he kills the defender.

Withdraw:

These are the odds of a forced withdrawal from combat. Units like catapults and cannons, which have a combat limit, cannot kill a defending unit. Instead they can only damage the defender down to a certain level (eg. 25HP for catapults, 20HP for cannons, 15HP for artillery). The XP a unit earns for withdrawal is 1XP. At the end of this line, the average values of both attacker and defender HP are presented for the withdrawal battle outcome (for Medium detail and higher). Note average defender HP on this line corresponds to the damage limit of the unit you are using to attack.

Retreat:
If you are using units that have inherent retreat odds or that have earned promotions that give them retreat chances, then this line tells you the probability of your unit retreating. Units will only retreat if they are one hit away from being killed, and only when they are the attacker. The HP value presented on this line (Medium detail and higher) is the number of hitpoints the attacker would have if he were to retreat from the battle injured.

Defeat:
The odds of the attacker being killed by the defender. The XP the defender will earn is displayed, along with the average number of hitpoints the defender will have if he survives combat (Medium detail and higher).

Detailed Attacker HP Outcomes:
At the High and Everything settings, these values will be displayed directly under the battle outcomes representing the attacker surviving. For each number of hitpoints the attacker could possibly have, beside it you will find the probability of the unit exiting battle with that many hitpoints. There is also a coloured bar beside each outcome, to help visually identify the scope of the values. Note if there are retreat odds involved, the lowest HP value for the attacker will include the probability of retreat in its odds. Note the sum of all the HP outcomes should be the same as the odds of the attacker surviving.

Detailed Defender HP Outcomes:
Much the same as Attacker HP Outcomes, except for the defender. Note the sum of all these values should be the odds of the defender surviving.

Attacker/Defender damager per hit, number of hits required, odds of hits and CombatRatio:
A lot of data is displayed on this line. The first two values are the amount of HP damage each of the attacker and defender (respectively) will cause per hit. Then after that, the number of hits required by each combatant are displayed. In green, is the number of hits required by the attacker to kill the defender or to force the attacker's withdrawal due to a combat limit. In red is the number of hits required for the defender to make to either kill the attacker or to make him retreat. Next, the odds displayed in green are the odds of the attacker for making a hit in each combat round. The defender's odds are just 100% minus this number. Finally on this line is the important value called the CombatRatio or simply R. This value is equal to the attacker's modified combat strength divided by the defender's modified combat strength. This number is important for many reasons - one being that it determines how many XP the attacker and defender can earn from combat. The value R takes both injured units and all combat related modifiers into account (e.g. promotions and defense bonuses).

Average HP:
This line simply gives the average hitpoints for each combatant after battle. Unlike the averages presented earlier, these averages include the possibility of the unit dying, so they better reflect the overall outcome of battle.

Unharmed:
These odds are very simple. They are the odds of the attacker/defender exiting combat without taking a single hit i.e. unharmed. Units that are already injured are counted as winning unharmed if they don't take damage during the battle.

Unrouneded XP:
These values are shown at Everything detail only. These values are rounded down to the nearest whole number, and then forced to be within 1 and 10, to give the actual XP that can be earned by each combatant for killing their opponent.

XP range:
This line is only shown at Everything detail, and it crams a lot of information on one line. In the middle, it presents the CombatRatio i.e. the R value, and the XP it corresponds to. On either side of it, the CombatRatios that would lead to different number of XP earned are shown. If you increase the value of R (for example, by taking a Combat promotion) then tipping it over the next value will cause your XP earned to drop by 1 point.



Suggestions:
If you think there other statistics you would like to see in Advanced Combat Odds then let me know and I will consider including it for you. You don't necessarily need to know how to calculate the figure - there are many results that can already be calculated from the new code but I have only displayed the information I have found most useful, but of course different information can be useful to different people.

I welcome any other feedback.

Version History:
Spoiler:

v0.1

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
-Green/red bars for detailed HP outcomes
-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)
-Fixed bug where the bottom Attacker HP value was not including the odds of retreat.
-Re-added defender/attacker unharmed odds to medium detail.
-Coloured part of the bottom HP bar for attacker yellow (high detail and above only) to reflect the proportion of the odds that are due to reatreat chances.

v0.5
-1 decimal place only for Low setting
-Merged HP bars when they were individually less than some cutoff - currently 0.5%. Note the attacker min HP bar was left alone in case retreat odds came into it.
-Added XP modifiers (eg. Great General promotion - Leadership)
-Fixed XP range calculations so they will work with mods
-Added detail about free wins vs barbs - now shows correct odds for such battles unlike old calculator which lied to the user. (note this only works if defender is barb at the moment)
-Added correct XP taking barb XP caps into account, including animals. e.g. if on 8XP and killing the barb would normally result in large xp, the shown amount will be only 2.
-Fixed negative XP bug in barb normalization code (thanks to phungus420) (it was only present in earlier builds of this version)
-Prevented the unit unharmed HP bars from being combined with others. eg. if you use a warrior to attack an infantry it will still show you the bar with the probability of your warrior keeping 100HP or whatever other hitpoints it starts with.


v0.6
-Added display for barb free wins remaining. You get free wins vs. barbs on Prince difficulty and lower.

v1.0 Released (18/4/2009)

To Do (later versions)
+Flanking damage
+GG point modifiers? eg. great wall and IMP leaders
+look at how incorrect modifiers are showing, when using switcharoo (not enabled in v1.0)
Other Info:
Separate versions created (or merged):
-For BtS 3.17 (v1.0 - latest version)
-Advanced Combat Odds v1.0 Merged with Better BtS AI v0.70
-v1.0 Merged with Dresden's Unofficial Patch (including amphibious OOS fix)
-(not yet - any help would be appreciated) For BAT/BUG

Affected source files: (3 files changed, 1 added)
CvGameCoreUtils.cpp
CvGameCoreUtils.h
CvGameTextMgr.cpp
AdvancedCobmatOdds.h (new header file)

Affected Assets:
ACO folder with needed images added to /Art
GlobalDefinesAlt.xml
CIV4GameTextInfos_ACO.xml
Old Versions:
v0.1 for BtS 3.17
v0.4 for BtS 3.17
v0.4 Merged with Better BtS AI v0.60N (old version)

Last edited by PieceOfMind; Jul 09, 2009 at 12:02 AM.
PieceOfMind is offline   Reply With Quote
Old Feb 13, 2009, 06:42 PM   #4
Hephaistion
Warlord
 
Join Date: Apr 2005
Location: Mt. Vernon, NY USA
Posts: 272
This looks awesome! Well done.

I'd love to see this merged into Revolution and RevDCM's DLLs.
Hephaistion is offline   Reply With Quote
Old Feb 13, 2009, 11:06 PM   #5
PieceOfMind
Drill IV Defender
 
PieceOfMind's Avatar
 
Join Date: Jan 2006
Location: Australia
Posts: 9,291
Quote:
Originally Posted by Hephaistion View Post
This looks awesome! Well done.

I'd love to see this merged into Revolution and RevDCM's DLLs.
I'm sure jdog would happily merge them if you point him to this page. I only inserted a single block of code into the three necessary files so merging it with other mods should be very easy.

I'll be a bit careful and watch how it would merge with mods that even slightly alter combat mechanics. I think it will work with a mod that uses ranged combat. I've tried as best I can to avoid putting in hardcoded numbers, so it should work with a variety of mods.

EDIT Oh it's glider too? Sorry I'm a bit out of touch with those mods.
__________________
Tip: Forcing Steam's Offline Mode
Civ4 Mods: Advanced Combat Odds, PIG Mod(discontinued), HEX Mod(discontinued)
Suggestion: Try karadoc's K-Mod: Far Beyond the Sword
Read if bored: Zoom-To-Cursor, Good advice from Kaell for DX11 users, Nvidia beats AMD in Civ V

Last edited by PieceOfMind; Feb 14, 2009 at 12:45 AM.
PieceOfMind is offline   Reply With Quote
Old Feb 14, 2009, 12:43 AM   #6
phungus420
Deity
 
phungus420's Avatar
 
Join Date: Mar 2003
Posts: 6,296
Yeah just requested RevDCM include this in the next update. These are the type of components glider seems to like, hope he decides to include, looks very nice.
__________________
Do not PM me with questions about modding. I will not answer. If you want help with something, start a thread on it, or post in a related existing thread.
phungus420 is offline   Reply With Quote
Old Feb 14, 2009, 01:43 AM   #7
EmperorFool
Deity
 
EmperorFool's Avatar
 
Join Date: Mar 2007
Location: Mountain View, California
Posts: 9,625
I'm wondering if taking the outcome into account when presenting the information might help. For example, the expected HP of the defender will always be 0 for the victory outcome. It will only be non-zero for defeat/withdrawal.
Victory: 72.3%, 5.8HP, 2XP
Attacker Unhurt: 4.5%
Defeat: 22.5%, 3.4HP, 2XP
Withdrawal: 5.2%, 1.2HP, 1XP, 3.1HP, 2XP
Defender Unhurt: 2.8%
Of course that fourth line will probably wrap if it's that long.
__________________
Monkeys killing monkeys killing monkeys over pieces of the ground.
Silly monkeys, give them thumbs they make a club and beat their brother down.


BUG Mod - BTS Unaltered Gameplay
[ Forum | Download | FAQ | Known Issues | Troubleshooting | Modding Tutorial ]

BAT 3.0.1 QuickFix™ released Oct 24th
EmperorFool is offline   Reply With Quote
Old Feb 14, 2009, 01:55 AM   #8
PieceOfMind
Drill IV Defender
 
PieceOfMind's Avatar
 
Join Date: Jan 2006
Location: Australia
Posts: 9,291
Quote:
Originally Posted by EmperorFool View Post
I'm wondering if taking the outcome into account when presenting the information might help. For example, the expected HP of the defender will always be 0 for the victory outcome. It will only be non-zero for defeat/withdrawal.
Victory: 72.3%, 5.8HP, 2XP
Attacker Unhurt: 4.5%
Defeat: 22.5%, 3.4HP, 2XP
Withdrawal: 5.2%, 1.2HP, 1XP, 3.1HP, 2XP
Defender Unhurt: 2.8%
Of course that fourth line will probably wrap if it's that long.
Firstly, if an attacker withdraws/retreats (I call them different things) then the defender does not earn XP, so I'm not sure what you mean in your fourth line.

I will consider the way you want the odds to be ordered, but I think there is some value in leaving the most important odds at the top as these will always be what people look for first or when they don't want much detail.

Eventually I hope to entirely replace the original game's displayed odds at the top you see. I'm only really leaving it there at the moment because I want to spot errors if there are any.

The Attacker/Defender Unharmed I consider not very important in most battles which is why I placed them at the bottom, but it seems you are considering moving them in with the others to make the order be more sorted for each combatant.

By the way, the expected hit points are normalized against the set of all events. In other words, if an attacker has 50% chance of victory or defeat, and he can only take 1 hit worth 100HP (unrealistic I know) then his expected hitpoints would be 50HP. In other words, the expected hitpoints include the possibility of death. This is why for very onesided battles the expected hitpoints of the weak unit will be extremely low (a good sign if you are the stronger unit) - sometimes even rounded to 0.00!

I also have considered normalising the expected hitpoints for unit X against the probability of that unit surviving, but I feel this tends to mislead a bit more. If I have a unit that has only a 10% chance of victory, but if he survives his average HP would be 50, I don't think that's a good number to be displaying.
__________________
Tip: Forcing Steam's Offline Mode
Civ4 Mods: Advanced Combat Odds, PIG Mod(discontinued), HEX Mod(discontinued)
Suggestion: Try karadoc's K-Mod: Far Beyond the Sword
Read if bored: Zoom-To-Cursor, Good advice from Kaell for DX11 users, Nvidia beats AMD in Civ V

Last edited by PieceOfMind; Feb 14, 2009 at 02:01 AM.
PieceOfMind is offline   Reply With Quote
Old Feb 14, 2009, 02:57 AM   #9
EmperorFool
Deity
 
EmperorFool's Avatar
 
Join Date: Mar 2007
Location: Mountain View, California
Posts: 9,625
Quote:
Originally Posted by PieceOfMind View Post
Firstly, if an attacker withdraws/retreats (I call them different things) then the defender does not earn XP, so I'm not sure what you mean in your fourth line.
Right, I posted that very quickly without a lot of thought. Remove that, and the line is less likely to wrap.

What is your distinction between retreat and withdrawal? My guess is that withdrawal is what siege weapons do when they do maximum damage. IOW, withdrawal is siege's form of victory. And retreat is what Civ normally calls withdrawal: unit would have died, but escaped.

Quote:
Originally Posted by PieceOfMind View Post
I will consider the way you want the odds to be ordered, but I think there is some value in leaving the most important odds at the top as these will always be what people look for first or when they don't want much detail.
I wholeheartedly agree. I was just throwing out a different presentation for discussion. Your goal of having the most important info at the top is the right goal.

Quote:
Originally Posted by PieceOfMind View Post
Eventually I hope to entirely replace the original game's displayed odds at the top you see. I'm only really leaving it there at the moment because I want to spot errors if there are any.
I would consider keeping the game's inherent calculation so it will never be different from what the unmodded game shows. You can move it elsewhere; just use the same calculation. Maybe that's what you meant, though.

Quote:
Originally Posted by PieceOfMind View Post
The Attacker/Defender Unharmed I consider not very important in most battles which is why I placed them at the bottom, but it seems you are considering moving them in with the others to make the order be more sorted for each combatant.
That was my thinking, but I think I prefer it at the bottom for the same reason. I was just trying out a more logical grouping which doesn't always yield the most usable display.

Quote:
Originally Posted by PieceOfMind View Post
By the way, the expected hit points are normalized against the set of all events.
That was my understanding as well, thus you had only one value for the entire set of outcomes. However, I tend to think of it the other way. I would rather see the possible expected HP values given the different results.

Taking your example, the unit will never end combat with 50HP, so 50 is misleading to me. I'd rather see 50% chance of 100HP and 50% chance of death (0HP). Perhaps this comes down to your world view. I'm not a statistician, though I took a few statistics classes. I think very few average users will understand the concept of "expected value" whereas I think most will intuitively grasp "84% chance of surviving with 35HP", even though the second one does include an expected value; it just doesn't need to be called that.

I also kinda liked how DanF displayed the HP per hit and number of hits to kill as multiplications -- 5 x 23hp vs. 7 x 16hp -- because it seemed more intuitive and required less punctuation. It just read clearer to me, but that's just my opinion.
__________________
Monkeys killing monkeys killing monkeys over pieces of the ground.
Silly monkeys, give them thumbs they make a club and beat their brother down.


BUG Mod - BTS Unaltered Gameplay
[ Forum | Download | FAQ | Known Issues | Troubleshooting | Modding Tutorial ]

BAT 3.0.1 QuickFix™ released Oct 24th

Last edited by EmperorFool; Feb 14, 2009 at 03:01 AM.
EmperorFool is offline   Reply With Quote
Old Feb 14, 2009, 03:29 AM   #10
PieceOfMind
Drill IV Defender
 
PieceOfMind's Avatar
 
Join Date: Jan 2006
Location: Australia
Posts: 9,291
Regarding the hits to kill and multiplications, I decided to separate them because utlimately the hits to kill is the most important number. The damage per hit does not actually figure in the combat odds at all, except in determining the number of hits required. I guess the way I have it displayed now was also my way of trying to make it more readable to most users. Although I liked DanF's way as well, and will strongly consider going back to that, I find it just as useful to have each value paired separately as they are now. I felt Dan's way while a little more compact was less obvious in what it meant.

You'll notice in post #2 above I highlighted a line in blue. Set this value to true if you would like to see the way the expected hit points are calculated - I like using it particularly to check things are correct. It does what you were describing a moment ago - giving the exact odds of every single battle outcome for each combatant. It's just not as tidy though, and at this stage I would guess it would be too overwhelming for most users. (see the attached thumbnail for a slightly exaggerated example, because the cannon has boh retreat chances and withdraw odds due to Flanking I which is normally impossible . Note this was a slightly earlier version).

I agree somewhat with your position that many people will not fully grasp the idea of expected damage, but short of showing the odds of each outcome (like with the ACO_debug flag I just mentioned), it can be hard to give much info about the average outcomes in a single figure. I could re-write it as how many hits you take on average, but it's much the same.

Note also, obviously when an attacker retreats, the expected hitpoints (assuming the attacker retreats) are not very enlightening as this is a fixed number and will just be (currHP - (n-1)iDamageToAttacker) where n is the number of hits to kill the attacker.

The reason I went with the expected hitpoints alone as they are now, is that I felt it gave a good glance indication of how well battle will go for each combatant. It clearly shows the effect of better modified strengths when you promote units, which wouldn't necessarily happen if you normalized it against the unit surviving or against a particular outcome.

Also, after using these expected HPs for a while, it really does start to become clear they are a realistic estimate of the unit's HP after battle, assuming you aren't going to go in and say 'hey that unit can't have 56.17 HP, only 50 or 60'. I don't know how to describe it other than it just 'feels' right. For example, a lot of battles fought at good odds have expected attacker hitpoints around 30HP or so, and this generally agrees with our observations that we are constantly having to heal units from roughly that number. Once we start to really dominate with our attacking units we get expected hitpoints up as high as 80 or so (especially Drill IV ), and paired with the Attacker Unharmed odds you can cherry pick the best attacker.

However another thing I had considered doing, and which I forgot, honestly, before posting the mod was to change the rounding on these expected figures to 1 decimal place, as two is a bit of overkill. The odds for attacker winning a round would probably also be better off with 1 decimal point, as DanF had done IIRC. The other results I like to have 2 decimal places on though.

A very powerful way to use the Advanced Combat Odds display is when attacking cities and you have a choice between several different units to use to attack. You can immediately see the XP each would earn and you will see how as you promote units up the CR line, not only will your unit not earn as much XP, the defender will earn more XP if he kills the attacker! This is not a big consideration for humans attacking AIs though as we tend to do our city strikes in 1 turn and those lucky defenders are not going to survive to see their shiny new promotions.
Attached Thumbnails
Click image for larger version

Name:	fun_example_ACO_debug.JPG
Views:	403
Size:	88.6 KB
ID:	203798  
__________________
Tip: Forcing Steam's Offline Mode
Civ4 Mods: Advanced Combat Odds, PIG Mod(discontinued), HEX Mod(discontinued)
Suggestion: Try karadoc's K-Mod: Far Beyond the Sword
Read if bored: Zoom-To-Cursor, Good advice from Kaell for DX11 users, Nvidia beats AMD in Civ V
PieceOfMind is offline   Reply With Quote
Old Feb 14, 2009, 03:52 AM   #11
EmperorFool
Deity
 
EmperorFool's Avatar
 
Join Date: Mar 2007
Location: Mountain View, California
Posts: 9,625
Quote:
Originally Posted by PieceOfMind View Post
For example, a lot of battles fought at good odds have expected attacker hitpoints around 30HP or so, and this generally agrees with our observations that we are constantly having to heal units from roughly that number.
This statement right here is precisely why I think it makes more sense to split the expected HP for each outcome. You never have to heal the units that die during the attack. So really, you aren't healing from 30HP normally in your example. Instead you are healing normally from 50HP and losing 1/5 of your units.

I must admit that I have never gotten into doing any of these calculates prior to seeing DanF's mod. I looked exclusively at the victory odds. I didn't even know that your comparative strength alone determine the XP you'd earn, ignoring FS. So I will concede up front that my take is more from gut than experience. That being said, I think that will be true of a lot of users as well.

As I was reading your post, I envisioned a combat assistant Python/DLL combo. You select your attacking units, hit a key, and select the target plot. A mini screen pops up showing a sortable table of all these values for each attacker. Click on a row to have that unit attack; the table updates with new values; you pick the next attacker, etc.

This would remove the need to select and ALT + hover with each unit one-by-one, comparing values. Ahh, if only I had a team of eager coders to direct like minions to do my bidding!
__________________
Monkeys killing monkeys killing monkeys over pieces of the ground.
Silly monkeys, give them thumbs they make a club and beat their brother down.


BUG Mod - BTS Unaltered Gameplay
[ Forum | Download | FAQ | Known Issues | Troubleshooting | Modding Tutorial ]

BAT 3.0.1 QuickFix™ released Oct 24th
EmperorFool is offline   Reply With Quote
Old Feb 14, 2009, 04:20 AM   #12
Yesod
Warlord
 
Yesod's Avatar
 
Join Date: Nov 2007
Posts: 278
Will they be throwing this in the BUG mod?
__________________
A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects.

~Robert A. Heinlein
Yesod is offline   Reply With Quote
Old Feb 14, 2009, 04:22 AM   #13
EmperorFool
Deity
 
EmperorFool's Avatar
 
Join Date: Mar 2007
Location: Mountain View, California
Posts: 9,625
That's my plan.
__________________
Monkeys killing monkeys killing monkeys over pieces of the ground.
Silly monkeys, give them thumbs they make a club and beat their brother down.


BUG Mod - BTS Unaltered Gameplay
[ Forum | Download | FAQ | Known Issues | Troubleshooting | Modding Tutorial ]

BAT 3.0.1 QuickFix™ released Oct 24th
EmperorFool is offline   Reply With Quote
Old Feb 14, 2009, 04:47 AM   #14
PieceOfMind
Drill IV Defender
 
PieceOfMind's Avatar
 
Join Date: Jan 2006
Location: Australia
Posts: 9,291
"This statement right here is precisely why I think it makes more sense to split the expected HP for each outcome. You never have to heal the units that die during the attack. So really, you aren't healing from 30HP normally in your example. Instead you are healing normally from 50HP and losing 1/5 of your units."

In that case we are both trying to use the same figure for different evaluations. I'm more interested in a literal indication of how much damage I can expect the attacker to take, whereas you are thinking more about the need to heal a unit and so only care about when it survives. That's pretty reasonable I guess and convincing reason to normalize it the way you suggest. But there is still the problem that it no longer fulfils the roll I wanted it to - to give a good sort of 'rating' if you will of how each will do in combat. When the combat odds are skewed heavily one way, the expected hitpoints for the unit with low odds no longer mean much at all, which is a bit of a problem IMO.

The solution to this might be to opt to include both numbers somehow. I could write the expected hitpoints given the unit survives beside the victory/retreat/withdraw odds like you originally were suggesting.

"I must admit that I have never gotten into doing any of these calculates prior to seeing DanF's mod. I looked exclusively at the victory odds. I didn't even know that your comparative strength alone determine the XP you'd earn, ignoring FS. So I will concede up front that my take is more from gut than experience. That being said, I think that will be true of a lot of users as well."

Hmm you just reminded me that I was thinking about putting in a figure showing the R value - that is the ratio of the attacker/defender modified strengths. This is the only value that determines XP earned, so knowing this value and seeing that it is near a "jump point" might help one to decide between two promotions. For example, if you have a choice between Combat 4 and Drill 4 and you are right on the verge of tipping from 2XP down to 1XP, you'd take D4 because it would no affect the XP. (Personally I'd take D4 without a moment's thought but I'm a D4 nut I admit - IMO D4 is the only promotion that makes the drill line worthwhile at all).

"As I was reading your post, I envisioned a combat assistant Python/DLL combo. You select your attacking units, hit a key, and select the target plot. A mini screen pops up showing a sortable table of all these values for each attacker. Click on a row to have that unit attack; the table updates with new values; you pick the next attacker, etc.

This would remove the need to select and ALT + hover with each unit one-by-one, comparing values. Ahh, if only I had a team of eager coders to direct like minions to do my bidding!"

Yeah don't get your hopes up on me doing something like that. I was barely able to figure out how to make this mod (I've never done any C++ before), only getting by because of my reasonable procedural-oriented programming skills. But definitely there may be room for customising the odds display here. As we have seen already, we see different value in different statistics and being able to choose from an options screen which ones one wants would be very nifty.

Tell you what... I'll go and put your suggestion into work by putting the expected hitpoints beside each battle outcome and report back with a picture or something. To be honest, this should take a couple minutes work at most because I've already set up all the code for calculating pretty much anything one could imagine (relevant to this problem anyway, not solving the Riemann Hypothesis ).
__________________
Tip: Forcing Steam's Offline Mode
Civ4 Mods: Advanced Combat Odds, PIG Mod(discontinued), HEX Mod(discontinued)
Suggestion: Try karadoc's K-Mod: Far Beyond the Sword
Read if bored: Zoom-To-Cursor, Good advice from Kaell for DX11 users, Nvidia beats AMD in Civ V
PieceOfMind is offline   Reply With Quote
Old Feb 14, 2009, 05:15 AM   #15
EmperorFool
Deity
 
EmperorFool's Avatar
 
Join Date: Mar 2007
Location: Mountain View, California
Posts: 9,625
This might be overkill, but if the unit has available promotions, it might be cool to show the differences each promo would make for that combat, even if just a summary of the victory odds, E[HP], and XP.

I like the idea of having both my version and the aggregated E[HP] for all outcomes as a single value. And of course, BUG is all about options. But for a standalone mod, you can always stick options in the CIV4Defines.xml file to pull from within C++ easily.

Give yourself a big pat on the back for getting this to work. C++ is an ornery beast, and the DLL code is tough to wade through without any comments.

The key thing that would be necessary in the DLL for that idea I laid out is a function on CvUnit that would take a CvPlot, pick the best defender, and return an array containing all the desired data for the various outcomes. It wouldn't be that hard, actually. It would be more work creating the Python screen, filling it, and having it work. All things I could do with unlimited time.
__________________
Monkeys killing monkeys killing monkeys over pieces of the ground.
Silly monkeys, give them thumbs they make a club and beat their brother down.


BUG Mod - BTS Unaltered Gameplay
[ Forum | Download | FAQ | Known Issues | Troubleshooting | Modding Tutorial ]

BAT 3.0.1 QuickFix™ released Oct 24th
EmperorFool is offline   Reply With Quote
Old Feb 14, 2009, 05:45 AM   #16
PieceOfMind
Drill IV Defender
 
PieceOfMind's Avatar
 
Join Date: Jan 2006
Location: Australia
Posts: 9,291
Not that it's a big issue, but I have not done much in the way of optimising this code for speed and efficiency, mainly because I was expecting it to only be called in the mouseover event which is obviously infrequent enough that I can do almost as many flops as I like.

I haven't found C++ to be too bad, but I did find it a hassle that I couldn't declare an array of size something that's not a constant. That is probably something I took for granted in java. (By the way, I originally wrote most of this code in a separate java program and have used that to produce tables of results of various combat experiments - one I did some time ago was Drill IV vs. Combat IV and that was an interesting thread to see. It was pretty easy to just copy and paste the code over for the most part).

"I like the idea of having both my version and the aggregated E[HP] for all outcomes as a single value"

Righto. I'll be putting that in the next version most likely.

Re the idea about the effect of promotions, again this is something I had thought of, but I have no idea how to do that. I'd need to be able to pull info about what promotions are available to the unit from CvUnit (I think?) somehow. lol mousing over the promotion could reveal the new odds. But that is probably what you meant...

Re the ability to put options in the CIV4Defines.xml file to pull from C++, I should have realised that earlier because really I've been doing it but with the GlobalDefines values already! It would certainly be easier doing that than recompiling the code every time I need to change a constant, though this compiler I have does seem to recompile the code very quickly.

I would be interested in looking through the code now to see how the best defender is picked too, since you mentioned it. I have a feeling it's not always the unit with the best odds.

lol It still annoys me when I have a Drill I longbow and a DIII longbow on a tile together and they get attacked by a unit that ignores first strikes - the D3 unit will, annoyingly, stand up to defend.

As for the Python idea of creating a table etc., I'm too hesitant as I feel something like that is overkill for most people, even for me. I personally wouldn't consider the value of that to be worth the effort required.
__________________
Tip: Forcing Steam's Offline Mode
Civ4 Mods: Advanced Combat Odds, PIG Mod(discontinued), HEX Mod(discontinued)
Suggestion: Try karadoc's K-Mod: Far Beyond the Sword
Read if bored: Zoom-To-Cursor, Good advice from Kaell for DX11 users, Nvidia beats AMD in Civ V
PieceOfMind is offline   Reply With Quote
Old Feb 14, 2009, 06:11 AM   #17
EmperorFool
Deity
 
EmperorFool's Avatar
 
Join Date: Mar 2007
Location: Mountain View, California
Posts: 9,625
Right, you need to dynamically create the array and manage its memory, unlike Java. You may have seen SAFE_DELETE_ARRAY() calls in the DLL code; that's what those do. After Java and Python, C++ seems so archaic--nay, barbaric! Yet it is really good at what it does (confuse new programmers!).

I only threw out that Python table suggestion because I thought it was a neat idea. I can't count the number of features I haven't added to BUG simply because I don't have the time. It's always a cost/benefit decision.

As for showing the promotion results, I was more thinking of the effects on the combat odds for a particular target. Thus you wouldn't be able to hover over each promotion--you'd need to show them in the attack plot hover. You can certainly loop over the available promos for a unit, but again I think this would be more neat as a learning tool, and not worth the effort. The biggest hurdle is that Civ is not designed for what-if scenarios. The only way to see the effect of a promotion easily is to apply it, and there's no undo in Civ.
__________________
Monkeys killing monkeys killing monkeys over pieces of the ground.
Silly monkeys, give them thumbs they make a club and beat their brother down.


BUG Mod - BTS Unaltered Gameplay
[ Forum | Download | FAQ | Known Issues | Troubleshooting | Modding Tutorial ]

BAT 3.0.1 QuickFix™ released Oct 24th
EmperorFool is offline   Reply With Quote
Old Feb 15, 2009, 09:54 AM   #18
DanF5771
Emperor
 
DanF5771's Avatar
 
Join Date: Feb 2008
Posts: 1,194
Quote:
Originally Posted by EmperorFool View Post
Give yourself a big pat on the back for getting this to work.
I second that!
__________________
R I G H T O N C O M M A N D E R !
DanF5771 is offline   Reply With Quote
Old Feb 15, 2009, 10:30 AM   #19
PieceOfMind
Drill IV Defender
 
PieceOfMind's Avatar
 
Join Date: Jan 2006
Location: Australia
Posts: 9,291
Quote:
Originally Posted by DanF5771 View Post
I second that!
Cheers! Thanks for helping me get started! Your code was perfect for use as a skeleton, and showed me the basic things I needed - handling C++ objects and printing stuff.

Note I accidentally spelt your name with a 3 in the code but I'll fix that in the next version.
__________________
Tip: Forcing Steam's Offline Mode
Civ4 Mods: Advanced Combat Odds, PIG Mod(discontinued), HEX Mod(discontinued)
Suggestion: Try karadoc's K-Mod: Far Beyond the Sword
Read if bored: Zoom-To-Cursor, Good advice from Kaell for DX11 users, Nvidia beats AMD in Civ V
PieceOfMind is offline   Reply With Quote
Old Feb 15, 2009, 11:06 AM   #20
PieceOfMind
Drill IV Defender
 
PieceOfMind's Avatar
 
Join Date: Jan 2006
Location: Australia
Posts: 9,291
Ok here are some examples of the tooltip with the changes I have made with your suggestions in mind EmperorFool. Now to the right of each possible outcome you can see the expected hitpoints conditioned on that outcome.

I have decided now to remove my overall expected hitpoints because it probably is a little more confusing to most people, and really information can still reasonably be learned from the separate averages now given.



For a moment I tried making the unharmed odds conditioned on the unit surviving, but I found the results a bit more confusing and would prefer to avoid it unless I hear a good reason otherwise.
Attached Thumbnails
Click image for larger version

Name:	some_examples_combatoddsv2.JPG
Views:	17539
Size:	45.3 KB
ID:	203915  
__________________
Tip: Forcing Steam's Offline Mode
Civ4 Mods: Advanced Combat Odds, PIG Mod(discontinued), HEX Mod(discontinued)
Suggestion: Try karadoc's K-Mod: Far Beyond the Sword
Read if bored: Zoom-To-Cursor, Good advice from Kaell for DX11 users, Nvidia beats AMD in Civ V

Last edited by PieceOfMind; Feb 15, 2009 at 11:12 AM.
PieceOfMind is offline   Reply With Quote
Reply

Bookmarks

Go Back Civilization Fanatics' Forums > CIVILIZATION IV > Civ4 - Creation & Customization > Civ4 - Mod Components > PieceOfMind's Advanced Combat Odds

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combat odds ... berserks01 Civ4 - Strategy & Tips 45 Mar 11, 2010 02:07 PM
Combat Odds Sarisin Civ4 - Fall from Heaven 65 Jul 20, 2008 02:32 PM
Combat odds mystyfly Civ4 - Strategy & Tips 9 Oct 29, 2007 01:38 AM
Combat Odds cef71 Civ4 - General Discussions 4 Nov 23, 2005 05:40 AM
combat odds tazman8 Civ4 - General Discussions 7 Oct 19, 2005 04:47 PM


Advertisement

All times are GMT -6. The time now is 05:32 PM.


Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
This site is copyright © Civilization Fanatics' Center.
Support CFC: Amazon.com | Amazon UK | Amazon DE | Amazon CA | Amazon FR