Combat System

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Sirridan
    Knight
    • May 2009
    • 560

    Combat System

    I'm trying to figure out a good basic melee/ranged combat system (physical damage) for Thornwind.

    I have a few things to consider:

    1. What role do weapons play?
    2. What role does armor play? Do certain types of armor protect versus certain types of weapons better, and worse for others?
    3. Do some weapons get better damage bonuses than others?
    4. How will shields work? Do they just add flat armor modifiers, or give a deflection chance?

    I'm thinking of it this way:

    1. Weapons play the obvious role of doing damage, and various types of weapons do better versus some things than others. Larger weapons get better benefits from strength, and +dam bonuses.

    2. Armor lowers damage from blows. Some weapons can bypass types of armor more easily than some. (IE cloth is 80% less effective vs slashing/piercing, ringmail is 60% less effective vs piercing and arrow types, plate is 90% effective against blunt attacks)

    3. Also touched in 1, a big hammer gets a better bonus damage from high str than a dagger.

    4. I don't think shields should give an AC bonus unless it blocks a hit. Some hits would be deflected, some just blocked. (Ex a deflected sword blow does no damage, a blocked one does damage as if the AC of the shield was applied).

    I could get really realistic here and have armor damage and shield damage and even breakage, but I think that's just too much and would take away from game play fun, and also harder to code.

    ------

    The Usual D&D approach to armor is if you beat their armor class, you do full damage. Armor class is a combination of the ability to dodge, and the ability of your armor to absorb a blow. For some magical (and non-magical) armors, damage is reduced by a flat amount on a successful attack (Damage reduction). However D&D can get a bit random, where many attacks miss, and successful ones do a larger amount of damage to compensate.

    In my opinion, it's more fun to hit a lot, even if the hit's aren't as huge. I'm thinking armor does the following:

    1. Heavier armor may reduce your movement ability, making it harder to dodge blows. To compensate, blows that land do less damage. Shields can be used to further prevent hits.

    2. Armor reduces damage on a asymptotic curve, when you're wearing a suit of full plate, adding an extra inch of metal probably won't help much, likewise halving your armor may greatly increase damage taken.

    3. Critical hits happen when you find a gap in the armor (skill) or a weakpoint (chance), or hit a vital area (either).

    4. The actual damage curve used would be based on some attack rating - defense rating (armor). If the value is positive, should the attacker do extra damage, or just full damage? And likewise, if the curve is negative, should it report that the attacks are ineffective, or just do a very, very small amount of damage? Personally I'm leaning towards more damage or a higher crit chance if the curve is positive, and non-effective attacks if it's negative.

    Anyone have any thoughts or suggestions?
  • Nick
    Vanilla maintainer
    • Apr 2007
    • 9634

    #2
    As far as *bands go, I would recommend looking at the combat systems of Steamband (for different effects of different weapon types and weights) and Oangband (for the use of damage dice vs to-hit, and offensive and defensive use of shields).
    One for the Dark Lord on his dark throne
    In the Land of Mordor where the Shadows lie.

    Comment

    • Magnate
      Angband Devteam member
      • May 2007
      • 5110

      #3
      Originally posted by Sirridan
      Anyone have any thoughts or suggestions?
      Yes. For the love of your favourite deity, PLEASE ensure that you separate the concepts of damage avoidance and damage absorption. The terrible kludge that is AC is IMO Angband's worst surviving hangover from D&D. Heavy armour allows you to absorb much more damage, but of course dramatically reduces your ability to avoid blows. Ditto heavy shields. Light armour provides a little absorption while only mildly reducing your evasion. Etc.

      This has been done quite well in Crawl IMO, and doubtless other roguelikes too.

      I would go further and distinguish between slashing, piercing and crushing damage - but you may decide that's too much detail.
      "Been away so long I hardly knew the place, gee it's good to be back home" - The Beatles

      Comment

      • Sirridan
        Knight
        • May 2009
        • 560

        #4
        Originally posted by Magnate
        Yes. For the love of your favourite deity, PLEASE ensure that you separate the concepts of damage avoidance and damage absorption. The terrible kludge that is AC is IMO Angband's worst surviving hangover from D&D. Heavy armour allows you to absorb much more damage, but of course dramatically reduces your ability to avoid blows. Ditto heavy shields. Light armour provides a little absorption while only mildly reducing your evasion. Etc.

        This has been done quite well in Crawl IMO, and doubtless other roguelikes too.

        I would go further and distinguish between slashing, piercing and crushing damage - but you may decide that's too much detail.
        I intend to. Here's what I'm mulling over right now:

        Shields - All shields have a base avoidance rating (because of size), the weight-vs-strength causes this to increase or decrease (if it's too heavy, you can move it effectively). Dex also modifies how shields work, if you're as strong as a titan and clumsy as a drunk, you won't be able to put your shield in the way even if it moves as easily as a feather. In addition, shields can be bypassed, a big dragon's claw will smash through a wooden shield, so maybe items should be able to be destroyed.

        Armor - Some armor protects versus some types of damage better than others. Heavy armor lowers your ability to avoid damage but protects you versus blows that land, and vice versa.

        Weapons - Someone's wearing leather armor? A spear may pierce leather, as will arrows but may not do much against plate. Hammer's may be slowed by padded armor and ringmail, but will dent up plate.

        Stats for armor

        Defense - How well it protects you from critical hits
        Deflection - How well it deflects weapons (swords glance off plate)
        Absorbtion - How well damaging blows are mitigated and absorbed

        Each of these stats may be different versus each type of weapon damage (piercing, slashing, blunt)

        I'm also strongly considering removing the XdY system of damage, it's too random in my opinion and limiting.

        Example:

        Longsword
        3 Slashing - Receives 50% damage bonus
        1 Piercing - Receives 25% damage bonus

        What does this mean? Bonus damage such as +todam (think angband) str bonuses, and other damage bonuses? Well the slashing portion of the damage receives 50% of this, and the piercing portion receives 25%.

        Assume through enchantments and strength you gain +12 damage rating. You attack a mage wearing plain clothing (no armor), and a warrior wearing ringmail (defends against slashing, but not piercing)

        You would deal full damage to the mage (3 slashing + 50% of 12, and 1 piercing + 25% of 12, for a total of 9 slashing and 4 piercing).

        Against the warrior, you would do the 9 slashing, reduced greatly by armor, and the 4 piercing, reduced slightly by armor. Of course what if he was using craptastic rusty chainmail and you're using an awesome magic sword? Maybe you'll cut right through the armor and hurt him pretty bad, but if its normal metal versus normal metal, you won't deal slashing damage at all, the armor would stop it all. However the impact from the sword hit still does *something*, but it would be lessened and be considered blunt damage.

        If anyone doesn't know:

        Avoidance - Avoiding blows, if they don't land, they don't hurt.
        Mitigation - Mitigation lowers damage.

        High avoidance/low mitigation - Most hits don't land, but hits that do hurt a lot. Creatures that can one-shot you are extremely dangerous (essentially the chance you can be hit is the chance you'll die per round)

        High mitigation/low avoidance - Most hits land but don't hurt that much, however many opponents may overwhelm you and destroy you.

        -----

        What I need to do is figure out how to handle the values on weapons and armor. Flat numbers are easy, but could be overpowered, such as you have so much flat absorbtion, you don't die.

        I'm going to work on the numbers tomorrow, and see if I can come up with a good framework for combat. I'll post results as they arrive.

        Comment

        • Sirridan
          Knight
          • May 2009
          • 560

          #5
          More combat ideas...

          Okay, first thing I realized is that in one blow, a longsword will do either slashing or piercing damage, not both. By default the player will automatically attack with what causes the largest amount of damage, and if it is mitigated somehow, try the other way.

          Example: Longsword (3pierce 2slash) attack some unknown monster. You pierce first, causing 1 damage, apparently this monster resists piercing, so next attack you slash, causing the full two. Further attacks against that creature will result in slashing.

          If however slashing still did less even though piercing was resisted, you would continue to pierce because it would do more damage.

          Monsters will act similarly, trying different things to abuse player weaknesses. Social monsters may spread their information to others (lets say you weaken an orc scout and he runs into a larger group, all of them would then know the player's weaknesses.) In addition, hive mind monsters on a level all know the same knowledge at all times.

          What I'm trying to do now is figure out the curve to modifiy damage. The modification would be on the y axis, and the x axis would be the difference between the attack/defense value. A positive difference (attack>defense) increases damage, while a negative difference decreases it.

          Comment

          • Sirridan
            Knight
            • May 2009
            • 560

            #6
            I have a combat table I like, it goes up to 50 on either direction so I'll do bounds checking before hand.

            Code:
                    public static double[] AttackDefenseTable = {
                        0.00, 0.07, 0.14, 0.20, 0.26, 0.32, 0.36, 0.39, 0.42, 0.44, 
                        0.46, 0.48, 0.50, 0.52, 0.54, 0.56, 0.58, 0.60, 0.62, 0.64,
                        0.66, 0.68, 0.70, 0.72, 0.74, 0.75, 0.76, 0.77, 0.78, 0.79, 
                        0.80, 0.81, 0.82, 0.83, 0.84, 0.85, 0.86, 0.87, 0.88, 0.89, 
                        0.90, 0.91, 0.92, 0.93, 0.94, 0.95, 0.96, 0.97, 0.98, 0.99, 
                        1.00, 1.01, 1.02, 1.03, 1.04, 1.05, 1.06, 1.07, 1.08, 1.09, 
                        1.10, 1.11, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, 1.18, 1.19, 
                        1.20, 1.21, 1.22, 1.23, 1.24, 1.25, 1.26, 1.28, 1.30, 1.32, 
                        1.34, 1.36, 1.38, 1.40, 1.42, 1.44, 1.46, 1.48, 1.50, 1.52, 
                        1.54, 1.56, 1.58, 1.61, 1.64, 1.68, 1.74, 1.80, 1.86, 1.93, 
                        2.00 };
            As you can see, from 1.00 (atk/defense are equal) damage goes up or down slowly depending on the difference, this curves up to 2 quickly or down to 0 the closer you get to 50.

            Comment

            • Sirridan
              Knight
              • May 2009
              • 560

              #7
              Am I overcomplicating this?

              There are a few enums not shown here, but mostly this is what I have for items so far. Visible object is implemented at home.

              My question is if i'm overcomplicating items, on one hand it gives more variety to have multiple types of damage/damage reduction. On the other hand, it causes increased complexity for both player and developer.

              What do you guys think?

              Code for constructors, getters, setters is not shown.

              Code:
                  class ItemProperties
                  {
                      int _item_immunities;   //flag
                      int _gives_resists;     //flag
                      int _gives_immunities;  //flag
                      int _attack_bonus;
                      int _damage_bonus;
                      int _armor_bonus;
                      int _parry_bonus;
                      int _deflection_bonus;
                      int _dr_blunt;
                      int _dr_slash;
                      int _dr_pierce;
                      int _stat_bonus;
                      int _stats_affected;    //flag
                      int _stats_sustained;
                      int _weight_reduction;  //%
                  }
                  abstract class Item
                  {
                      protected VisibleItem _vi;
                      protected ItemType _type;
                      protected int _weight;    //pounds / 10
                      protected int _value;
                      protected int _rarity;
                      protected int _depth;
                      protected string _name;
                      protected ItemProperties _properties;
                  }
                  class Weapon : Item
                  {
                      int _dmg_pierce;
                      int _dmg_blunt;
                      int _dmg_slash;
                      int _crit_bonus;
                      int _parry;
                      bool _2handed;
                  }

              Comment

              • zaimoni
                Knight
                • Apr 2007
                • 590

                #8
                Well...it depends (if all that complexity is needed up-front, or if changing these is going to be painful later then no).

                As this should be C# by context (not that anyone is going to guess from looking at this source), none of my other comments should be at all relevant.
                Zaiband: end the "I shouldn't have survived that" experience. V3.0.6 fork on Hg.
                Zaiband 3.0.10 ETA Mar. 7 2011 (Yes, schedule slipped. Latest testing indicates not enough assert() calls to allow release.)
                Z.C++: pre-alpha C/C++ compiler system (usable preprocessor). Also on Hg. Z.C++ 0.0.10 ETA December 31 2011

                Comment

                • Pete Mack
                  Prophet
                  • Apr 2007
                  • 6883

                  #9
                  ItemProperties as you define it looks more like a struct than a class.


                  However, I don't think you will actually want to split the flags out that way.

                  It's often convenient to treat the flags like a relation, not like a bunch of distinct properties. (Take a look at the display code in cmd-know.c and file.c for some examples.)

                  I suspect you will want to make most properties work as genuine C# properties (with get and set), rather than using fixed fields like that.

                  Also: what are _dr_blunt, etc? Are they booleans, or something else?

                  Finally: make sure that you normalize between types of objects and individual objects. From your definition, I can't see where the boundary lies. (Remember that there are two distinct models you want to meet: one is the "properties" (has_a) and one is the actual class model (for Angband, this is essentially a relational model, with pretty good normalization.)


                  "a Scythe of *Slay Evil* (5d3)(+17,+18)(+3) {ESP}"
                  is an inventory object with properties,+3WIS,ESP,20lb,wearable
                  is a (hafted) weapon with properties 5d3,(+17,+18),SLAY_EVIL|SLICE|BLUNT
                  is a visible object with properties gray,'\'

                  Angband is already fairly good wrt the relational stuff, but not so good with the object model. (Hence the complicated display code, etc.)
                  Last edited by Pete Mack; July 14, 2009, 06:02.

                  Comment

                  • Sirridan
                    Knight
                    • May 2009
                    • 560

                    #10
                    I think I've been going in the wrong direction for items and maybe a few other things. Instead of making a complicated class hierarchy for everything, I think I'll simplify that a bit and create a few arrays of things, and item classes will just have references to those arrays so common data isn't duplicated too much.

                    Example: There is an array of weapons, let's say one entry corresponds to longsword. All longswords are alike, although some may be magically enchanted, or cursed. So the item object would have a reference to the longsword, and its attack/damage bonuses in separate fields.

                    I should probably do the same for monsters... it may require some reworking but I bet it will save time in the long run.


                    One more thing, I'll move this to a google code soon, so I won't be clogging up angband forums with non-band stuffs.

                    Comment

                    Working...
                    😀
                    😂
                    🥰
                    😘
                    🤢
                    😎
                    😞
                    😡
                    👍
                    👎