Announcement

Collapse
No announcement yet.

asymmetric terrain advantages?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • asymmetric terrain advantages?

    I've been experimenting with the combat equations in the Marquis de Sodel's summary post. I have statistical software that allows me to do this easily and quickly. The first question I have is this: Has the (sensible-seeming) combinatoric true odds equation in that document been replaced by something better, or is this issue largely viewed as a solved problem? No challenge here--I simply want to know the state of the art.

    The purpose of the experimentation is this. I would like to create unit pairs with starkly different benefits from terrain modifiers or, really, with different rates of change in defensive success with respect to the same changes in defensive modifiers. I think I am learning a good bit about this, and will be happy to report the results at some point if anyone is interested. But my second question is: Has this very topic already been discussed, researched and solved?--It is sometimes very hard to thoroughly search these forums, especially for a very occasional drop-in like me. Anyway I don't want to waste effort reinventing old wheels.

    For some context to whet appetites, the problem comes up in thinking about what happened between the Napoleonic era and the U.S. civil war, when accurate, relatively long-range rifles made light infantry trained in their use deadly--especially in good defensive cover relative to traditional cavalry with muskets. In the Texas revolution, even the best Texian longrifles would be trounced by Mexican cavalry on the open field (grassland), but if they had treecover the Texian longrifles almost always won. By contrast, the relative increase in the defensive advantage of cavalry in treecover ought to be less, since their muskets were less accurate, had poorer ranges and they had to dismount and defend as traditional musket infantry in heavy timber.
    "Proud Alumnus of Whatsamatta U."

  • #2
    How would you implement this?
    Tecumseh's Village, Home of Fine Civilization Scenarios

    www.tecumseh.150m.com

    Comment


    • #3
      A while back, I wrote an Excel sheet (Civ2 Combat Probabality Calculator) that implements the equation to which MdS refers. At its heart is Excel's BINOMDIST function. Excel's no SAS-Jump (btw, what are you using?), but it is faithful to the examples cited by those who came up with the Great Library equation. Still, I've never been comfortable about how this calculator handles differing hp/fp combos. At an extreme, it appears to be pretty inaccurate with the 0d 9hp 9fp values that I gave Bedouins in El Aurens.

      Since you have the software to analyze it, how accurate is Excel's BINOMDIST? I've seen a few knowledgable statisticians blast Excel for inaccuracies without giving specifics. Wouldn't surprise me at all if they were right.

      If you could come up with a probability and range of outcomes analysis of differing hp/fp combos, you'd be doing a service. Something that designers could use as a framework for planning hp/fp values logically. Most of us know instinctively that as you increase hp's, the effect of doubling terrain becomes more pronounced. It would help, though, to flesh out those instincts with numbers.

      Btw, IIRC, this CCPCalc version's Rules.txt import routine is buggy, but the engine works as designed.
      El Aurens v2 Beta!

      Comment


      • #4
        huh?
        Tecumseh's Village, Home of Fine Civilization Scenarios

        www.tecumseh.150m.com

        Comment


        • #5
          Tecumseh, "huh" is definitely right for that last line. I would be grateful if Boca could expand on it... Especially the inscrutible bit about a buggy watchamacallit for rules.txt, which I didn't follow at all.

          As to your previous question, I _think_ the trick is to play around with the peculiarities of relatively stark differences in how a unit is strong--whether from lots of hit points w/ low firepower, or the reverse, or moderate amounts of both. The intuition has to do with the lumpiness of damage, which can be manipulated through firepower, and the fact that hit points can be fractional down to 2/10 increments.

          But that is an intuition I have developed on the basis of that combinatorical equation in the MdS post, and before I do the math (that is, invest painful thought on the basis of that equation), I wanted to make sure it is largely regarded as correct--or at least the best game in town. (Looks sensible and intuitive to me, being an empirical scientist who does lots of ugly statistics, but that doesn't mean that it is how CivII does it.)

          Boca, I don't use Excel for stats, so I know nothing about any debates as to the quality of its statistical plug-ins. Personally, I use SAS. If you told me what you got using Excel and the MdS equation, and how it differed from what you got through play-testing, for some specific pair of units, I could easily compare that to what SAS spits out as a prediction.

          There is one issue I wondered about in the MdS treatment. Formally, the combination coefficients in the MdS equation should only take integer arguments (since the factorial terms that make them up only take integer arguements. But modified hitpoints (10*hp/fp) can easily be non-integer. Are these arguments supposed to be rounded up or down (to the nearest integer)? It could depend on the default treatment of noninteger arguments to comb(n,r) functions in various packages. Many languages take default actions when an argument to a function is supposed to be integer and is not. Some languages would return an error, but others would have a "convention" pre-programmed into that function's definition. Me, I assumed they should be rounded up (since remaining modified hitpoints can be less than attacker's firepower, and hence would require another win to go to zero), but I might be wrong. In any case, differing conventions on this could account for various discepancies between predictions based on the equation and actual play-tests.

          Once I know I'm doing the right thing, I can have SAS spit out hundreds of look-up tables for anyone's benefit in seconds, and can package them up for others to use, no problem.
          "Proud Alumnus of Whatsamatta U."

          Comment


          • #6
            Sorry Boco, for calling you Boca, like you are a veggie patty or something.
            "Proud Alumnus of Whatsamatta U."

            Comment


            • #7
              More from the inscrutable veggie

              Originally posted by Bullwinkle
              Tecumseh, "huh" is definitely right for that last line. I would be grateful if Boca could expand on it... Especially the inscrutible bit about a buggy watchamacallit for rules.txt.
              Open the file, and you'll see something like the attached pic. The spreadsheet has 6 primary cells that you use for putting in unit values: AF, AHP, AFP, DF, DHP, DFP. In addition, it has cells, which I usually ignore, for road bonus, remaining movement (i.e. for adjusting when the attackers mf < 1), and the number of 'faces' in the Civ2 'die'. Finally there are ~19 controls that adjust factors for the various combat modifiers in Civ2 (e.g. the 'AEGIS' flag).

              All of these work as designed. What doesn't work is the one button that is labeled "open rules.txt". I had intended it to import settings from @UNITS so that you could select units from modified Rules.txt files and calculate the odds, using the button 'Choose from @UNITS'. It works in my current version, but that is heavily polluted with El Aurens debris.

              Most of this was designed several years ago, and my memory is a bit dim.

              Formally, the combination coefficients in the MdS equation should only take integer arguments (since the factorial terms that make them up only take integer arguements. But modified hitpoints (10*hp/fp) can easily be non-integer. Are these arguments supposed to be rounded up or down (to the nearest integer)?
              Excel's BINOMDIST does require nonzero integer arguments. For this I rounded up.

              It's generally agreed that the GL combat thread as summarized by MdS represents our best guess for how combat is programmed in Civ2. IIRC, in the original thread, no longer accessible, Eggman, Euclid, and Buenos developed the equation and tested it with about half a dozen tests using factors from the standard vanilla Rules.txt. To limit sampling error, I think they tested a combat with at least 100 trials. Although the equation passed these tests and is consistent with the description in the manual, this is hardly definitive. No one, however, has proven it wrong, and unfortunately, no one from Microprose has either confirmed or denied its accuracy.

              My own expertise in this area is very limited. I can design fancy spreadsheets and dabble in Visual Basic. I won't even pretend to understand statistics. Among current posters in Civ2, Slowthinker understands the algorithm the best.

              Personally, I'd be interested in comparing different HP/FP combinations. But rather than lookup tables, I'd like to see the file you use to develop the tables. I have SAS-Jump at work and can dabble in it.
              El Aurens v2 Beta!

              Comment


              • #8
                Boco wrote:

                "Personally, I'd be interested in comparing different HP/FP combinations. But rather than lookup tables, I'd like to see the file you use to develop the tables. I have SAS-Jump at work and can dabble in it."

                Yeah, I can do that, but it is a hassle right now because of the different vintages of the various computers involved in all this. Expect more tomorrow.

                The only thing that seems at all strange about the MdS equation to me is the specification of the equation of the probability p of winning a "round" of a combat. If I'd been guessing, I would have guessed a probit or logit model of this probability. For example, a logit specification might be

                p = 1/(1 + exp(-lamda*(attack - defense))),

                where exp( ) is the exponential function, and lambda is a "precision" parameter to be determined empirically (sort of like the multiplier of "8" in the MdS formula). A probit specification would be:

                p = psi(lambda*(attack - defense)),

                where psi( ) is the standard normal distribution function, and again lambda would be some coefficient determined by Microprose (and determined empirically by us).

                These are pretty standard ways of modeling a discrete random variable (e.g., win vs. lose) using continuous attributes (like attack and defense). The formulas in the MdS equation don't resemble anything standard in such modeling. But as I have said before, that doesn't imply that the Microprose people wouldn't have used something like this. However, the "tail behavior" of the probability p would be quite different using the MdS specification than these conventional (in statistics) specifications. Meaning that the derivation of extreme probabilities of winning a combat round from attack and defense factors could be quite different with these alternative formulas.
                "Proud Alumnus of Whatsamatta U."

                Comment


                • #9
                  Boco, thanks for all that info. I've checked whether your Excel program and my SAS program agree on the example I will discuss below, and they do, so this gives me some confidence that, at least, our programs are consistent with one another.

                  Your program and my program do different things. Yours is designed, it seems, to be a user-friendly way for a person to enter all relevant info about an attacking unit and a defending unit in terms of CivII's basic language--without requiring the person to know or understand much about the the modifiers and exceptions and so forth or even how to multiply. It is a fine thing for many, I am sure, and suits its intended user very well.

                  My program is different. The user is assumed to be able to figure the modified attack and defense values themselves...it does nothing of that kind. Instead, it simply creates a big old matrix showing how an attacker with given hp and fp fares against a defended of given hp and fp--as the modified attack value and modified defense value (the row and column labels of the matrix) vary over a large grid (the program itself is easily modified to enlarge or change increments in the grid).
                  See the end of the post for the commented program, as you requested. Just cut and paste into the SAS program editor.

                  This suits my purpose, since I wanted to scan such matrices for usefully "flat" or "steep" responses of attacker combat win percentages across some reference vector of modified defense values (say defense values 1 to 6, in unit increments--basically, a defense value of 2 over the array of basic terrain values from 50% to 300% (the fifty percent is like the "grass" or "beach" in Second Front, for instance). In the scenario I am creating, I think of 200% as being the "reference terrain" rather than 100%...I want relatively flat bonuses above the reference terrain, and lots of options for disadvantages below it (the opposite of the setup when the 100% terrain is the "reference terrain").

                  With that in mind, here is a possible pair of units for a Texas Revolution scenario:

                  (w,x,y,z) = (att, def, hp, fp)

                  Texian longrifles = (22,2,0.4,7)
                  Mexican dragoons= (3,2,2,4)

                  Note the fractional hitpoints for the longrifles, as well as the fact that the dragoons' firepower of 4 will therefore kill the lonrifles in one round. By contrast, the longrifles require three rounds of victory to kill the dragoons. This is deliberate. More on the intuition in a later post, when I have verified it more extensively.

                  Here are the percent chances that the attacker wins the combat with the defending unit, as modified defense values vary from 1 to 6. Think of these as the range of values taken by green, unfortified units without special modifiers (for "pikeman" for instance).

                  modified defensive values: 01 02 03 04 05 06

                  dragoons attack longrifles: 99 96 86 74 64 56

                  longrifles attack dragoons: 93 86 80 74 69 64

                  Remember, I'm taking 200% terrain as my "reference terrian"--so that's why I have chosen an example of two units with equal chances (74 in 100) of killing each other when the other has a modified def value of 4 (200% of their common basic def 2). And note the definite (though by no means as striking as I would have liked) asymmetry in the "response curves." With longrifles on truly awful mod def = 1 (50%) terrain, dragoons kill riflemen 99 out of 100 times; but on 300% terrain, this drops to 56/100. By contrast, with dragoons on 50% terrain, longrifles kill dragoons 93 out of 100 times, but this declines much less--just to 64/100 times--when dragoons are on 300% terrain.

                  Thus, we have an example here of asymmetric responses to terrain bonuses--at least as predicted by the MdS equation, as realized in our two programs. I can create similar results for other pairs of units. So far, it seems that the best way to create such asymmetries is to have one unit which gets killed in a single round, while the other gets killed in 2 to 4 rounds, but I need to experiment more before my intuition about this firms up (and do more mathematical thinking). Play-testing is in the future of course too.
                  "Proud Alumnus of Whatsamatta U."

                  Comment


                  • #10
                    I am very confusded my head hurts
                    I am not delusional! Now if you'll excuse me, i'm gonna go dance with the purple wombat who's playing show-tunes in my coffee cup!
                    Rules are like Egg's. They're fun when thrown out the window!
                    Difference is irrelevant when dosage is higher than recommended!

                    Comment


                    • #11
                      Originally posted by Broken_Erika
                      my head hurts
                      It'll have to come off, then!

                      Yeah there's lotso' matheriffic argle-bargle up there, but if I can help out feel free to ask. Just like my namesake said, "I'll give you a piece of my mind"--and just as his pal Rocky shot back: "That's what I like about you, Bullwinkle...no matter how little you have of anything, you're always willing to share."
                      "Proud Alumnus of Whatsamatta U."

                      Comment


                      • #12
                        Thanks for looking into this Bullwinkle! Your file looks to be a good tutorial for me to learn SAS scripting language. Whoever thought Civ2 would be good for me professionally. Sadly, RL will be keeping me too busy for a few days, so my responses will be quick and dirty (i.e. poorly reasoned and prone to oversights).

                        I like your outside-the-box-thinking here. By focusing on other aspects of scenario design, I've fallen into a traditional 2hp/1fp rut. Your ideas are a shot in the arm!

                        Some random reactions:
                        • I didn't realize the civ engine could read fractional hp values.
                        • If you have units that can be eliminated in a single round, you'll be giving Lady Luck a strong role.
                        • What are the max values for hp, fp, and defense modifiers that Civ2 will accept?


                        These are pretty standard ways of modeling a discrete random variable (e.g., win vs. lose) using continuous attributes (like attack and defense). The formulas in the MdS equation don't resemble anything standard in such modeling. But as I have said before, that doesn't imply that the Microprose people wouldn't have used something like this. However, the "tail behavior" of the probability p would be quite different using the MdS specification than these conventional (in statistics) specifications. Meaning that the derivation of extreme probabilities of winning a combat round from attack and defense factors could be quite different with these alternative formulas.
                        If you came up with a more accurate formula for combat -- one that more accurately predicts extremes such as 0d,9h,9f -- I'd love to modify my spreadsheet to use it!


                        matheriffic argle-bargle
                        El Aurens v2 Beta!

                        Comment


                        • #13
                          I like your outside-the-box-thinking here. Your ideas are a shot in the arm!
                          Thanks for your kind words. I hope other people will experiment, and be able to find some more pronounced asymmetries...what I've found so far is limited.

                          I didn't realize the civ engine could read fractional hp values.
                          Well, I'm not exactly sure how one correctly pulls this off in rules.txt, but the same document that describes fractional movement (in the downloads for CivII) ends by saying that 'the same technique can be used for hit points...but it isn't clear there (to me) how one enters the right numbers in rules.txt to pull that off.

                          If you have units that can be eliminated in a single round, you'll be giving Lady Luck a strong role.
                          Well, in some ways, yes, but in other ways no. Whether the attacker (defender) who wins (loses) in one round wins (survives) the combat is after all a binary outcome, regardless of the number of rounds of battle involved. Whether that outcome occurred through a sample of size k rounds, or size 1 rounds, the observable consequences are still a single probability--of final victory or survival. So in that sense, lady luck is no different. But yes--that same unit will have this property that is different from usual CivII combat: It will never win, or survive, a combat damaged--either its got its groovy intact green bar at the top of its shield when the smoke clears, or it is gone. That is unusual, and in certain scenario contexts, perhaps undesirable.

                          This actually raises another technical design question I wonder about. (Please, anyone who knows how to do this, or whether it could be done, let me know!) I know from playing various extremely fine scenarios (Red Front for instance) that events.txt can build a "replacement unit" to replace a killed unit IN A PRESPECIFIED SQUARE (or in one of a prioritized list of squares). But, is there a way to build a unit with events.txt in exactly the same square where some unit was just killed using events.txt--or even perhaps in the nearest city (one would suspect CivII events.txt could at least do this, since victorious spies and evacuating units get sent back to nearest cities by CivII's engine). I ask this because I've toyed with the idea of a events-driven "reduction sequence" for certain units. The idea is that units "killed would result in survivors who would be organized into new units, albeit ones that might be weaker in some respects (though maybe veteran). This is common in many eras of warfare. If any of you are old enough to have played Avalon Hill's 1914 game, you'll recognize the notion of a reduction path for units.

                          What are the max values for hp, fp, and defense modifiers that Civ2 will accept?
                          N.F.I. (pardon my French!)

                          If you came up with a more accurate formula for combat -- one that more accurately predicts extremes such as 0d,9h,9f -- I'd love to modify my spreadsheet to use it!
                          Is there a place that I can find actual play-testing results to use as data to compare to models?...I don't want to do thousands of rounds of play-tests myself, but if I can lay hands on the collective results of all you guys who slogged through that, I know how to do rigorous, likelihood-based comparisons between discrete outcome data and models of that data. That's why they pay me the big bucks. Ahahaaahaahahahahhaaa...urp...(cough)...aha (hiccup)...aha...(urp).
                          "Proud Alumnus of Whatsamatta U."

                          Comment


                          • #14
                            Boco: CCPC is brilliant! I'm in awe of your Excel skill. I'm having fun just setting up pretend battles and seeing the outcomes. I've only had beginning Stats and have only the vaguest understanding of the issues, but I recall reading some articles in which MS was criticized for some sloppy calculations in a number of Excel functions. With binomdist, I the problem seems to be the tail behaviors; but the author was using relatively large values for k (4 or 5 hundred) so it may not be an issue if you're examining, say, 100 trials. I've also seen that MS has been criticized about Excel's RNG, which I assume must be involved in your calculations?

                            Bullwinkle: Now if you could only tell me how to cure the hiccups.

                            Remember, I'm taking 200% terrain as my "reference terrian"--so that's why I have chosen an example of two units with equal chances (74 in 100) of killing each other when the other has a modified def value of 4 (200% of their common basic def 2).
                            Is that how you arrived at .4 HP for the longrifles, or is that the value you determined would last only 1 round? Is this what causes the asymmetry in the terrain bonus?

                            Anyway I hope you get it to work cause it's a really cool idea.

                            Comment


                            • #15
                              Originally posted by valmont
                              Is that how you arrived at .4 HP for the longrifles, or is that the value you determined would last only 1 round? Is this what causes the asymmetry in the terrain bonus?
                              valmont, my choice of "reference terrain" was driven mostly by the scenario I'm working on--on the TX rebellion against Santa Anna's centralist government. In the part of TX where the battles were fought, there's no mountainous terrain; and there's a lot of crap terrain from a defensive viewpoint, with some crappier that others. Thinking in terms of 200% terrain as "normal" or "reference" terrain, that gives me (relatively) lots of downside choices for terrains with different degrees of crappiness. It also makes it easier to get relatively fine terrain bonuses on the upside, and I wanted that too. If my forests are 250% and my "normal" terrain is 200%, then forests give only a 25% advantage relative to whatever my normal terrain is. If instead I were to adopt the usual convention of the normal terrain being 100%, the next available terrain above it is 150%, which is of course a 50% relative advantage to normal terrain. In short, I just want generally more fine-grained relative terrain advantages for this scenario, plus more downside choices.

                              What causes the asymmetry is arranging things in two ways:

                              A....so that a first unit has enough firepower, relative to a second unit's hit points, so that if the first unit wins just one combat round with the second, the second unit dies. This is done by making the fp of the first unit greater than or equal to 10 times the hit points of the secon unit. In my example, I chose fp=4 for the first unit and hp=.4 for the second, which accomplishes this. But fp = 12 for first unit and hp = 1 for the second would have accomplished the same thing (but I'm not sure we can set fp or hp greater than 9, while it seems one may use fractional hp down to 2/10 increments).

                              AND

                              B...so that the reverse is NOT true, that is, so that it will take several combat round wins for the second unit to kill off the first. Three rounds of victory required seems to work best for producing the asymmetry, according to my experiments so far. Letting fp2 be the firepower of the second unit, and hp1 be the hit points of the first, this is arranged by choosing those two parameters so that:

                              2 < 10*hp1/fp2 <= 3.

                              That term in the center is what is called "modified hit points" in the formula given in the MdS post we have referred to.

                              Then you have to search around for attack/defense pairs for your two proposed units, such that you get the kind of response profile to terrains that you want.

                              I am going on a week-long biz trip tomorrow, but when I get back I will post a useful excel table that will allow people to make the most of this asymmetry potential without knowing how to use the formulas, along with instructions for using the table.
                              Last edited by Bullwinkle; January 5, 2005, 21:45.
                              "Proud Alumnus of Whatsamatta U."

                              Comment

                              Working...
                              X