![]() |
| General | Hosted Sites | CivRev | Colonization | Civilization IV | Civilization III | Civilization II | Civilization | Misc | Marketplace |
![]() |
|
|
Welcome to Civilization Fanatics' Center. You are currently viewing our site as a guest which gives you limited access to our site features. By joining our free community, you will be able to participate in the discussions, search the forum, send private messages, vote in polls, upload your own screenshots to the gallery, and access many other special features. Registration is fast, simple and absolutely free, so sign up today! If you have any problems with the registration process or your account login, please contact support. |
|
|||||||
![]() |
|
|
Thread Tools |
|
|
#1 |
|
Drill IV Defender
Join Date: Jan 2006
Posts: 4,466
|
PieceOfMind's Advanced Combat Odds
Advanced Combat Odds
For BtS 3.19Current Version: v2.01 (3/11/2009) Download: ACO v2.01. For BtS 3.19 unmoddedDescription: 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:
Last edited by PieceOfMind; Nov 02, 2009 at 10:28 PM. |
|
|
|
|
|
#2 |
|
Drill IV Defender
Join Date: Jan 2006
Posts: 4,466
|
Mods using Advanced Combat Odds:
Last edited by PieceOfMind; Oct 21, 2009 at 08:17 AM. |
|
|
|
|
|
#3 |
|
Drill IV Defender
Join Date: Jan 2006
Posts: 4,466
|
Older versions...
The mod below works only for BtS 3.17. Spoiler:
Last edited by PieceOfMind; Jul 09, 2009 at 01:02 AM. |
|
|
|
|
|
#4 |
|
Warlord
Join Date: Apr 2005
Location: Mt. Vernon, NY USA
Posts: 226
|
This looks awesome! Well done.
I'd love to see this merged into Revolution and RevDCM's DLLs. |
|
|
|
|
|
#5 | |
|
Drill IV Defender
Join Date: Jan 2006
Posts: 4,466
|
Quote:
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.
__________________
Mods: Advanced Combat Odds, PIG Mod (v0.81), End of Espionage Articles: Unit Healing, FORTS in BtS... Everything there is to know, Optimising the Globe Theatre Draft City, First Strikes, Combat Odds and RNG Last edited by PieceOfMind; Feb 14, 2009 at 01:45 AM. |
|
|
|
|
|
|
#6 |
|
Deity
Join Date: Mar 2003
Posts: 4,188
|
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.
|
|
|
|
|
|
#7 |
|
Deity
Join Date: Mar 2007
Location: Mountain View, California
Posts: 6,245
|
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, 2XPOf course that fourth line will probably wrap if it's that long.
|
|
|
|
|
|
#8 | |
|
Drill IV Defender
Join Date: Jan 2006
Posts: 4,466
|
Quote:
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.
__________________
Mods: Advanced Combat Odds, PIG Mod (v0.81), End of Espionage Articles: Unit Healing, FORTS in BtS... Everything there is to know, Optimising the Globe Theatre Draft City, First Strikes, Combat Odds and RNG Last edited by PieceOfMind; Feb 14, 2009 at 03:01 AM. |
|
|
|
|
|
|
#9 | |||||
|
Deity
Join Date: Mar 2007
Location: Mountain View, California
Posts: 6,245
|
Quote:
![]() 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:
Quote:
Quote:
Quote:
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.
__________________
"Genius is conscious evolution." - a friend BUG Mod - BTS Unaltered Gameplay - Project, Forum, Download Last edited by EmperorFool; Feb 14, 2009 at 04:01 AM. |
|||||
|
|
|
|
|
#10 |
|
Drill IV Defender
Join Date: Jan 2006
Posts: 4,466
|
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.
__________________
Mods: Advanced Combat Odds, PIG Mod (v0.81), End of Espionage Articles: Unit Healing, FORTS in BtS... Everything there is to know, Optimising the Globe Theatre Draft City, First Strikes, Combat Odds and RNG |
|
|
|
|
|
#11 | |
|
Deity
Join Date: Mar 2007
Location: Mountain View, California
Posts: 6,245
|
Quote:
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!
|
|
|
|
|
|
|
#12 |
|
Strategist
Join Date: Nov 2007
Posts: 218
|
Will they be throwing this in the BUG mod?
__________________
A hero is born among a hundred, a wise man is found among a thousand, but an accomplished one might not be found even among a hundred thousand men. ~Plato |
|
|
|
|
|
#13 |
|
Deity
Join Date: Mar 2007
Location: Mountain View, California
Posts: 6,245
|
That's my plan.
|
|
|
|
|
|
#14 |
|
Drill IV Defender
Join Date: Jan 2006
Posts: 4,466
|
"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 ).
__________________
Mods: Advanced Combat Odds, PIG Mod (v0.81), End of Espionage Articles: Unit Healing, FORTS in BtS... Everything there is to know, Optimising the Globe Theatre Draft City, First Strikes, Combat Odds and RNG |
|
|
|
|
|
#15 |
|
Deity
Join Date: Mar 2007
Location: Mountain View, California
Posts: 6,245
|
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. |
|
|
|
|
|
#16 |
|
Drill IV Defender
Join Date: Jan 2006
Posts: 4,466
|
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.
__________________
Mods: Advanced Combat Odds, PIG Mod (v0.81), End of Espionage Articles: Unit Healing, FORTS in BtS... Everything there is to know, Optimising the Globe Theatre Draft City, First Strikes, Combat Odds and RNG |
|
|
|
|
|
#17 |
|
Deity
Join Date: Mar 2007
Location: Mountain View, California
Posts: 6,245
|
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.
|
|
|
|
|
|
#18 | |
|
King
Join Date: Feb 2008
Posts: 929
|
Quote:
__________________
|
|
|
|
|
|
|
#19 |
|
Drill IV Defender
Join Date: Jan 2006
Posts: 4,466
|
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.
__________________
Mods: Advanced Combat Odds, PIG Mod (v0.81), End of Espionage Articles: Unit Healing, FORTS in BtS... Everything there is to know, Optimising the Globe Theatre Draft City, First Strikes, Combat Odds and RNG |
|
|
|
|
|
#20 |
|
Drill IV Defender
Join Date: Jan 2006
Posts: 4,466
|
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.
__________________
Mods: Advanced Combat Odds, PIG Mod (v0.81), End of Espionage Articles: Unit Healing, FORTS in BtS... Everything there is to know, Optimising the Globe Theatre Draft City, First Strikes, Combat Odds and RNG Last edited by PieceOfMind; Feb 15, 2009 at 12:12 PM. |
|
|
|
![]() |
| Bookmarks |
|
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Combat odds ... | berserks01 | Civ4 - Strategy & Tips | 24 | Aug 13, 2009 04:23 PM |
| Combat Odds | Sarisin | Civ4 - Fall from Heaven | 65 | Jul 20, 2008 03:32 PM |
| Combat odds | mystyfly | Civ4 - Strategy & Tips | 9 | Oct 29, 2007 02:38 AM |
| Combat Odds | cef71 | Civ4 - General Discussions | 4 | Nov 23, 2005 06:40 AM |
| combat odds | tazman8 | Civ4 - General Discussions | 7 | Oct 19, 2005 05:47 PM |