Hit Locations, Armor versus Weapon Types

 
Post new topic   Reply to topic    mudlab.org Forum Index -> Design
View previous topic :: View next topic  
Author Message
Mabus



Joined: 17 Mar 2009
Posts: 8

PostPosted: Wed Aug 05, 2009 5:51 am    Post subject: Hit Locations, Armor versus Weapon Types Reply with quote

I have been working on a non-auto timed combat system for our game for a while, and have the code for timing working just spiffy (but still subject to further changes).

But, I was rather perplexed when I figured out that hit locations in CoffeeMUD were only determined if Injury() was called, so I decided to change what I thought was a backward system from the one that I envisioned.

So I delved in and began rewriting combat to target a specific location before the success roll would happen. This lead me to thinking about some old ADnD table about "Armor versus Weapons" from back in the '80s, and I became sidetracked (again) into also determining armor worn on the location, which is all based on the race of the target.

I am getting all of the data I need back just fine now, and (using nested switch statements with armorType() and damageType() integers) I am getting ready to add the changes based on the armor/damage type.

Now that that is out of the way...

The factors I can see (and have been working on in a spreadsheet) in Armor versus Weapon-Type are:

1) Damage Modification.
2) Critical Hit Modification.
3) Damage to Armor.
4) Damage to Weapon.
5) Various Strings for Message Modification.

And the question is:

What other variables could you see in a weapon (or other damage) strike versus specific armors?

Any input appreciated.
Back to top
View user's profile Send private message
Author Message
KaVir



Joined: 11 May 2005
Posts: 565
Location: Munich

PostPosted: Wed Aug 05, 2009 8:09 am    Post subject: Reply with quote

I assume you have different damage types, so that a sword can cut and a hammer can bash? And presumably armour has a different effectiveness against each damage type, so that a copper breastplate gives better protection against a sword blow than a lightning bolt?

A problem I found with damage modification based on armour was that if armour reduced damage by a flat value, it scaled extremely poorly. But if armour reduced the damage by a percentage, it would never entirely soak the damage, so you couldn't display messages about the the blow bouncing off their helmet or breastplate - and I wanted those messages, because I think they look cool. So I ended up first soaking a percentage of the damage and then soaking a (small) flat amount of the remainder.

Have you considered the idea of damage conversion? For example, if you slash someone with a longsword and they're wearing heavy armour, the armour would soak up some of the damage, but the remaining damage might also be converted from cutting damage to bashing damage.

Will you have layered armour, so that you can wear a breastplate over a chainmail shirt? If so, will they be combined, or will the weapon pass through each layer separately?

If you're calculating the hit location before they hit, then you can also use it for miss messages, which looks pretty nice - for example a dodged blow to the head might describe you ducking under the attack, while a blow to the legs might describe you leaping over it. Don't forget to factor in the damage type though, as you can hop back from a slash but not really from a thrust (you'd more likely sidestep instead).

You'll likely want some way to distinguish between "miss" and "all damage was soaked by armour" if you don't already, as the latter won't help against touch attacks, sweeps, etc.

How will shields work? Will they be treated as parrying weapons, or as armour (or as both)? Will your "damage to weapon" factor also apply to parries?

In regard to your "damage to armour" factor, you may want to distinguish between damage types if you don't already, at least to a certain degree. For example, if I hit your breastplate with a firebolt I'm not going to dent it, but I might melt it. Presumably damaged armour would also be less effective?
Back to top
View user's profile Send private message Visit poster's website
Author Message
Mabus



Joined: 17 Mar 2009
Posts: 8

PostPosted: Wed Aug 05, 2009 9:21 am    Post subject: Reply with quote

KaVir wrote:
I assume you have different damage types, so that a sword can cut and a hammer can bash?

Yes, 12 separate damage types exist.

KaVir wrote:
And presumably armour has a different effectiveness against each damage type, so that a copper breastplate gives better protection against a sword blow than a lightning bolt?

That is part of what I need to code.

This initial change is going to handle melee damage. Further changes to the code will take into effect many other circumstances (magical, area affect, etc.). I also plan on adding a "casting penalty" to various armor-types later, which will be class and skill dependent.

KaVir wrote:
A problem I found with damage modification based on armour was that if armour reduced damage by a flat value, it scaled extremely poorly. But if armour reduced the damage by a percentage, it would never entirely soak the damage, so you couldn't display messages about the the blow bouncing off their helmet or breastplate - and I wanted those messages, because I think they look cool. So I ended up first soaking a percentage of the damage and then soaking a (small) flat amount of the remainder.

That is an interesting solution. I found myself doing the same for a multi-tiered crafting skill to lower weapon speeds (% + flat value).

KaVir wrote:
Have you considered the idea of damage conversion? For example, if you slash someone with a longsword and they're wearing heavy armour, the armour would soak up some of the damage, but the remaining damage might also be converted from cutting damage to bashing damage.

That is a wonderful idea. If you don't mind I am going to jot that down and it may find its way into a future revision.

KaVir wrote:
Will you have layered armour, so that you can wear a breastplate over a chainmail shirt? If so, will they be combined, or will the weapon pass through each layer separately?

Since we do have layered armor it is something to consider.

I have decided (at least in the initial system) to use the "main" armor layer, and ignore the layers above and below. This will change, but I feel it best to get a working (and well commented) system in before I extend it to recognize the other layers.

KaVir wrote:
If you're calculating the hit location before they hit, then you can also use it for miss messages, which looks pretty nice - for example a dodged blow to the head might describe you ducking under the attack, while a blow to the legs might describe you leaping over it. Don't forget to factor in the damage type though, as you can hop back from a slash but not really from a thrust (you'd more likely sidestep instead).

The messaging is paramount, as the live game is heavily role-play oriented, and I plan on various messaging. These strings can be chosen easily in the switch statements.

KaVir wrote:
You'll likely want some way to distinguish between "miss" and "all damage was soaked by armour" if you don't already, as the latter won't help against touch attacks, sweeps, etc.

Since the system uses message-types I am already checking that the malicious, damage causing types are also caused by a weapon.
Code:
if((msg.target()==affected)
&&(msg.targetMinor()==CMMsg.TYP_DAMAGE)
&&(msg.value()>0)
&&(affected instanceof MOB)
&&(msg.source() instanceof MOB)
&&(msg.targetMessage()!=null)
&&(msg.targetMessage().indexOf("<DAMAGE>")>=0)
&&(text().startsWith(msg.source().Name()+"/")))

And later:
Code:
if((msg.tool()!=null)
&&(msg.tool() instanceof Weapon))

This will limit the current code to just weapons, where both the source and target are MOBs and where damage is at least 1. One other check checks to see if it is "hand to hand" (natural) weaponary, and sets the damage type according to the check.
KaVir wrote:
How will shields work? Will they be treated as parrying weapons, or as armour (or as both)? Will your "damage to weapon" factor also apply to parries?

Blocking with a shield and parrying are both existing skills that read the message-types and modify based on success with the skill. I will (for now) continue to let them handle this, and instead consider the armor worn on the hands (if one of the hands are the hit location).

That may change, but not for now.
KaVir wrote:
In regard to your "damage to armour" factor, you may want to distinguish between damage types if you don't already, at least to a certain degree. For example, if I hit your breastplate with a firebolt I'm not going to dent it, but I might melt it. Presumably damaged armour would also be less effective?

I hadn't thought of adding in armor-condition into the calculations. That could make an interesting set of circumstances (lowered dexterity, chance of critical fumble, etc.). Another idea for an extension.

Thank you very much for taking the time to present me with some very interesting ideas. I really appreciate it.
Back to top
View user's profile Send private message
Author Message
KaVir



Joined: 11 May 2005
Posts: 565
Location: Munich

PostPosted: Wed Aug 05, 2009 10:39 am    Post subject: Reply with quote

Mabus wrote:
Yes, 12 separate damage types exist.

Which 12, out of interest? And do you allow individual weapons to inflict multiple damage types?

I currently have cut, stab, crush, heat, cold, shock, poison and mental. I've been seriously considering adding sonic and acid, as they're needed in a number of places, but it's such a pain to retroactively add new damage types that I've ended up using workarounds (eg dual heat/poison for acid, dual crush/mental for sonic). I'm not particularly happy with that, as it can have some odd side-effects (such as acid attacks causing metal armour to turn red-hot).

I've also had trouble applying the damage types to swarm creatures. A swarm of bees inflict poison damage, but they're unlikely to get through the pelt of a huge bear - however giving the bear resistance from poison would also protect him from the stinger of a giant scorpion. I did consider simply having a 'swarm' damage type, but I think that's over simplifying the problem. Likewise an exploding fireball would likely wipe out the entire swarm, but a flaming torch wouldn't be much more effective than a fly-swat. I'm now thinking that perhaps each attack should indicate a size, separate from its damage type.

Mabus wrote:
KaVir wrote:
Have you considered the idea of damage conversion? For example, if you slash someone with a longsword and they're wearing heavy armour, the armour would soak up some of the damage, but the remaining damage might also be converted from cutting damage to bashing damage.

That is a wonderful idea. If you don't mind I am going to jot that down and it may find its way into a future revision.

Help yourself - it's one of those things I would probably add if I were start over, but it's a pain to go back and change everything now. You'll want to differentiate somehow between the cutting and bashing damage though, otherwise the feature won't actually do anything. If you've got layered armour, it could be that lower layers of padding are better able to soak the crushing damage. You could perhaps also distinguish between lethal and non-lethal damage, so that the damage which passes through armour represents bruises that heal faster than open wounds. Of course particularly powerful blows (and certain damage types) might still pass through the armour completely.

Mabus wrote:
Since we do have layered armor it is something to consider.

I have decided (at least in the initial system) to use the "main" armor layer, and ignore the layers above and below. This will change, but I feel it best to get a working (and well commented) system in before I extend it to recognize the other layers.

You may find it's quite a bit of work to add retroactively, at least from a game-balance perspective.
Back to top
View user's profile Send private message Visit poster's website
Author Message
Mabus



Joined: 17 Mar 2009
Posts: 8

PostPosted: Wed Aug 05, 2009 6:16 pm    Post subject: Reply with quote

KaVir wrote:
Which 12, out of interest? And do you allow individual weapons to inflict multiple damage types?

"NATURAL", //0
"SLASHING", //1
"PIERCING", //2
"BASHING", //3
"BURNING", //4
"BURSTING", //5
"SHOOTING", //6
"FROSTING", //7
"GASSING", //8
"MELTING", //9
"STRIKING", //10
"SONIC"}; //11

The first 11 are stock CM. I added Sonic for some bard class (and siren song type attack) ideas I have been working on. Have pondered adding mental and spiritual, but haven't coded anything requiring them as yet.

No multiple-type exists on a weapon currently (though weapons could have secondary properties allowing flaring, added damage, to-hit changes for specific armors, etc.), though any skill or command could use more then one type in its message.

KaVir wrote:
I currently have cut, stab, crush, heat, cold, shock, poison and mental. I've been seriously considering adding sonic and acid, as they're needed in a number of places, but it's such a pain to retroactively add new damage types that I've ended up using workarounds (eg dual heat/poison for acid, dual crush/mental for sonic). I'm not particularly happy with that, as it can have some odd side-effects (such as acid attacks causing metal armour to turn red-hot).

Since I am working in Java I have to be careful to watch for those "unintended consequences" of inheritance, so I can understand that.
KaVir wrote:
I've also had trouble applying the damage types to swarm creatures. A swarm of bees inflict poison damage, but they're unlikely to get through the pelt of a huge bear - however giving the bear resistance from poison would also protect him from the stinger of a giant scorpion. I did consider simply having a 'swarm' damage type, but I think that's over simplifying the problem.

Sadly, no swarms in our code. I could whip some up, but I haven't come across the need for them yet. First builder on our game that requests them would get them. Not sure how I would handle the damage, but I have a few ideas how I could code the swarms.
KaVir wrote:
Likewise an exploding fireball would likely wipe out the entire swarm, but a flaming torch wouldn't be much more effective than a fly-swat. I'm now thinking that perhaps each attack should indicate a size, separate from its damage type.

Each skill is an extension of StdAbility in CM. It can have it's own variables, as well as code that is completely its own. A "fireball" would likely do a check for number of MOBs in room, subtract caster group members (on a success, might want to hit them and the caster on a partial failure) and run a for loop to generate damage and messaging.

KaVir wrote:
Help yourself - it's one of those things I would probably add if I were start over, but it's a pain to go back and change everything now. You'll want to differentiate somehow between the cutting and bashing damage though, otherwise the feature won't actually do anything. If you've got layered armour, it could be that lower layers of padding are better able to soak the crushing damage. You could perhaps also distinguish between lethal and non-lethal damage, so that the damage which passes through armour represents bruises that heal faster than open wounds. Of course particularly powerful blows (and certain damage types) might still pass through the armour completely.

Thank you.

I love ideas that combine realism with playability and player choices.

KaVir wrote:
You may find it's quite a bit of work to add retroactively, at least from a game-balance perspective.

I am finding designing. coding and adding the whole combat system to be "quite a bit of work". I enjoy the challenge, and the players (what small few we have) know we are in "perpetual alpha".

I could make each layer check call a sub method, once the hit location is determined, and place any modifications there.

For now I will stick with using the main armor layer, until I am sure it is "working as intended". Reading my code comments is like reading a novel, as everything is commented. Future modification will be easier then writing the initial code, as other then the generated Javadocs not much of the stock combat code was commented.
Back to top
View user's profile Send private message
Author Message
KaVir



Joined: 11 May 2005
Posts: 565
Location: Munich

PostPosted: Wed Aug 05, 2009 7:36 pm    Post subject: Reply with quote

Mabus wrote:
"NATURAL", //0
"SLASHING", //1
"PIERCING", //2
"BASHING", //3
"BURNING", //4
"BURSTING", //5
"SHOOTING", //6
"FROSTING", //7
"GASSING", //8
"MELTING", //9
"STRIKING", //10
"SONIC"}; //11

Interesting, you have 'natural' for all natural weapons? Would that even include claws, spiked tails, etc?

I assume 'melting' is for acid? What are 'bursting' and 'striking'? How do you represent electrical or poison damage?

In most muds you can simply use the damage types for cosmetic messages, but when you add damage-specific soak to armour you need to define them more concretely.

Mabus wrote:
Have pondered adding mental and spiritual, but haven't coded anything requiring them as yet.

I primarily use 'mental' for psionics, but it also represents spiritual attacks - for example the soulblade or spiritblade weapons inflict mental damage, and can therefore be used to hurt ghosts (which are immune to physical damage) or ignore most armour (as most armour doesn't protect against mental damage).

Mabus wrote:
Sadly, no swarms in our code. I could whip some up, but I haven't come across the need for them yet. First builder on our game that requests them would get them. Not sure how I would handle the damage, but I have a few ideas how I could code the swarms.

I find swarms are a pretty nice addition to gameplay, but they do get a bit fiddly to when it comes to combat messages.
Back to top
View user's profile Send private message Visit poster's website
Author Message
Mabus



Joined: 17 Mar 2009
Posts: 8

PostPosted: Wed Aug 05, 2009 9:59 pm    Post subject: Reply with quote

KaVir wrote:
Interesting, you have 'natural' for all natural weapons? Would that even include claws, spiked tails, etc?

"Natural" (not to be confused with the "NATURAL" damage-type) weapons are set per race by myNaturalWeapon(), and can be of any type, but for many races (and even some druid skills) the NATURAL damage-type seems appropriate.

We can define the weapon-type either by using an existing weapon (which we then grant to the MOB), in the MOB code itself, or (as I have done in the case with bulls and minotaurs) in a MOB specific skill (like "Gore" with their horns, which sets up piercing damage for the horns and possible bashing damage for getting knocked down).

KaVir wrote:
I assume 'melting' is for acid? What are 'bursting' and 'striking'? How do you represent electrical or poison damage?

Bursting is internal explosive damage. Striking is for energy bolts, which leads to representing additional types. They are represented by specific message-types.

For example:
Code:
CMLib.combat().postDamage(mob,target,this,damage,CMMsg.MASK_ALWAYS|CMMsg.TYP_ELECTRIC,Weapon.TYPE_STRIKING,"The bolt <DAMAGE> <T-NAME>!");

(From the CM Druid chant "Summon Lightning")

This contains when it could be observed (always, maybe I should change that to visual and sound...) a sub-message type (electric), as well as a weapon type (striking). I really enjoy working with Bo's code, because I have never worked with a system I found as flexible as this.

KaVir wrote:
In most muds you can simply use the damage types for cosmetic messages, but when you add damage-specific soak to armour you need to define them more concretely.

Because of the message types, material types (and now armor types) this can be done rather easily, either in the overall StdArmor (which all armor extends) or in the individual code of the specific armor.

Take the call lightning above:
Code:
case RawMaterial.MATERIAL_METAL:
         affectableStats.setStat(CharStats.STAT_SAVE_ELECTRIC,affectableStats.getStat(CharStats.STAT_SAVE_ELECTRIC)-2);
         break;

(from CM StdArmor)

With this we lower the "save" of the MOB when wearing metal armors versus electricity. Adding another few lines I could make it add damage, lower damage or cause pink daffodils to appear on the ground.

Now that I have coded armor-types it will be easy to modify (or create new methods) for specific message-types.
KaVir wrote:
I primarily use 'mental' for psionics, but it also represents spiritual attacks - for example the soulblade or spiritblade weapons inflict mental damage, and can therefore be used to hurt ghosts (which are immune to physical damage) or ignore most armour (as most armour doesn't protect against mental damage).

As I said, I haven't gotten to them yet. 3 years into this project and we finally can have a log without any errors, enough content to keep levels 1-120 (we go to 200) happy, and many features and additions requested by the players added (oh, I also got a few things of my own in as well). There never seems to be enough time.

I will eventually add both the damage types, as I want to really separate mental actions from ones that require a deity/spiritual actions.
KaVir wrote:
I find swarms are a pretty nice addition to gameplay, but they do get a bit fiddly to when it comes to combat messages.

Going to get me going on that! I am concentrating on this system currently, or I will end up coding swarms, coding where they swarm from, adding the possibility of resources to be gathered from there and then working on an area to add the new creation.

I could see combat messages being an issue. "22 out of 50 bees hit for 44 damage." would be a little rough to make interesting in text. Doable, but would take a little textual tweaking, imagination and time.
Back to top
View user's profile Send private message
Author Message
KaVir



Joined: 11 May 2005
Posts: 565
Location: Munich

PostPosted: Thu Aug 06, 2009 1:57 pm    Post subject: Reply with quote

Mabus wrote:
Bursting is internal explosive damage.

Ah, okay. I would represent that as a 'heat' damage type striking the 'internal' hit location (as other damage types can also hit internally).

Mabus wrote:
Striking is for energy bolts, which leads to representing additional types. They are represented by specific message-types.

So the armour soak isn't based on the damage type, but on the message type?

What exactly is the damage type used for then? Is it just for cosmetics?

Mabus wrote:
I could see combat messages being an issue. "22 out of 50 bees hit for 44 damage." would be a little rough to make interesting in text.

Well that part isn't so bad - you can just describe how the bees fly around Bubba, stinging him repeatedly. I found the difficult part was making attacks against swarms. In the end I simply added hit and kill message for each damage type for each swarm creature, so that (for example) you see a rough number of bees die as you swing your sword through the swarm, or a rough number burst into flames as your fireball passes through the swarm, etc.

However that doesn't work so nicely when you're talking about swarms of big creatures - if you're fighting a mob of peasants, it'd be nice to be able to have regular messages apply against some random guy in the mob, so that you could decapitate one peasant, then kick a second off his feet, grab a third and hurl him into a fourth, etc.
Back to top
View user's profile Send private message Visit poster's website
Author Message
Mabus



Joined: 17 Mar 2009
Posts: 8

PostPosted: Thu Aug 06, 2009 5:37 pm    Post subject: Reply with quote

KaVir wrote:
So the armour soak isn't based on the damage type, but on the message type?

What exactly is the damage type used for then? Is it just for cosmetics?

The armor during weapon melee will depend on the damage-type. Magical effects causing damage will use damage-type and message-type. Whether it was a physical weapon or a skill/spell/chant/song/prayer etc. can be found from the message by finding the message tool().

For an example:
If a mage spell caused a large ball of ice to form, and impact a target, it might use damage-type TYPE_BASHING and message types of MASK_MAGIC with TYPE_COLD.

Upon impact if we had it freeze the target (on a successful impact) we might use damage-type TYPE_FROSTING, as well as message types of MASK_MAGIC with TYPE_COLD.

If instead at impact it was suppose to shatter into shards we could use TYPE_PIERCING as the damage-type, but still know that it was magical and cold (and allowing all resistances the MOB may have) by using message types of MASK_MAGIC with TYPE_COLD.

Each damage-type and message-type can also be checked against (and within) saves, resistances, character statistics and other properties and affects.

Most MOB/Environment interactions in CM use message types (Minor and Major) as well as MOB/Item/Room/Locale/Other variables. Armor-type and damage-type would be Item variables.
KaVir wrote:
Well that part isn't so bad - you can just describe how the bees fly around Bubba, stinging him repeatedly. I found the difficult part was making attacks against swarms. In the end I simply added hit and kill message for each damage type for each swarm creature, so that (for example) you see a rough number of bees die as you swing your sword through the swarm, or a rough number burst into flames as your fireball passes through the swarm, etc.

However that doesn't work so nicely when you're talking about swarms of big creatures - if you're fighting a mob of peasants, it'd be nice to be able to have regular messages apply against some random guy in the mob, so that you could decapitate one peasant, then kick a second off his feet, grab a third and hurl him into a fourth, etc.

Interesting. And looks to be handy for more then "small MOB" swarms (as I was originally picturing it).

I can see a bit of design and coding in my future.
Back to top
View user's profile Send private message
Author Message
shasarak



Joined: 29 Jun 2005
Posts: 134
Location: Emily's Shop

PostPosted: Fri Aug 14, 2009 8:48 am    Post subject: Reply with quote

KaVir wrote:
I've also had trouble applying the damage types to swarm creatures. A swarm of bees inflict poison damage, but they're unlikely to get through the pelt of a huge bear - however giving the bear resistance from poison would also protect him from the stinger of a giant scorpion. I did consider simply having a 'swarm' damage type, but I think that's over simplifying the problem. Likewise an exploding fireball would likely wipe out the entire swarm, but a flaming torch wouldn't be much more effective than a fly-swat. I'm now thinking that perhaps each attack should indicate a size, separate from its damage type.

This sounds like two different attributes to me - area and depth. Bees can't penetrate the hide of a bear because they can't sting deeply enough, even if they sting across a wide area. But trying to stab a swarm of bees doesn't work because the cross-sectional area of the region through which the attack passes is too small, even though the penetration depth is quite large.

There is some connection here with piercing, slashing and crushing attack types. Possibly rather than distinguishing between a pierce and a slash as discrete things, both should be points on a continuous scale, with the slash targeting a wider area (and shallower depth) than the stab?

You could also model bees attacking a bear successfully by actually treating the bee damage as multiple attacks, each of which does a small amount of damage which is successfully soaked up by the flat-damage reduction component of the bear's "armour". That leads on to some sort of consideration of how much of the target is covered by armour (which affects whether or not the flat damage reduction applies) as being distinct from how thick the armour is (i.e. how great the damage reduction is). The effectiveness of human armour is therefore not determined purely by how well the armour can withstand damage, but also by how many weak spots it has and hence the probability of an attack getting between pieces of armour. The bear's natural armour isn't that thick (so it doesn't reduce the damage from being speared all that much) but has good coverage (there are no spots on the body which can't reduce bee-sting damage to zero except maybe the eyes).

This potentially leads on to the way attacks work, in that player characters could perhaps train in ways to overcome specific armour types (giving them combat bonuses because they know how to locate and target the weak spots). Or there could be a trade-off between the accuracy of an attack and the damage it causes - if you lash out as hard as you can you're less likely to hit a weak spot in the armour, but will do more damage if you do hit it.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    mudlab.org Forum Index -> Design All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Powered by phpBB © 2001, 2002 phpBB Group
BBTech Template by © 2003-04 MDesign