Page 1 of 1

Per-slot armor rating

Posted: 13 Jan 2018, 13:29
by akortunov
Inspired by Daggerfall and Wizardry 8: https://github.com/akortunov/openmw/tree/armorclass
Screenshot_20180113_155604.png
Vanilla Morrowind (OpenMW too) calculates the mean armor rating and uses it to reduce damage for any slot, which takes the damage.
With this feature OpenMW takes actual armor rating for slot, which takes the damage. For example, cuirass will not protect from arrow in the head. Shield magic effect supposed to increase armor rating for all bodyparts. If there is no armor in slot, the Unarmored skill is used.

Notes:
1. I have no GMSTs to localize strings
2. This feature is not aimed to be merged upstream (without discussion, at least).

Feel free to provide any feedback.

Re: Per-slot armor rating

Posted: 13 Jan 2018, 13:55
by AnyOldName3
This was something I wanted to have eventually in my somewhat far-fetched vision for a future VR version of OpenMW where it mattered where you hit someone. In my envisaged version it would also require knowing which parts of a mesh are actually armour and which are exposed skin so you could get a sneaky jab into a soft bit, but I don't think that's necessary until way after VR OpenMW is a thing.

In the short term, though, I'm not even sure that our hit detection system knows which part of an actor has been hit and that's obviously a prerequisite for this feature.

Re: Per-slot armor rating

Posted: 13 Jan 2018, 14:21
by akortunov
AnyOldName3 wrote: ↑
13 Jan 2018, 13:55
I'm not even sure that our hit detection system knows which part of an actor has been hit.
It does not know. For now, we use collision box for hit detections. When NPC takes hit, we choose which slot to hit randomly (in Npc::onHit()).
I suppose mentioned games behave in the similar way.

From the other hand, we generate blood particles in the hit point somehow.

UPDATE: the Npc::onHit() has the hitPosition parameter. Can we determine which armor part to select, using this parameter?
As rough approximation instead of random generator:
1. Take the distance from hit position to some bodyparts position (e.g. chest, groin, feet, etc.)
2. Select minimum value
3. Select the related slot (e.g. if the nearest bodypart is Chest, select the cuirass slot)

Of course, this approach is not good for some mods with extravagant armor (e.g. boots covering Head bodypart).
Also AI is not supposed to take advantage from this feature yet.

Re: Per-slot armor rating

Posted: 13 Jan 2018, 15:51
by Chris
akortunov wrote: ↑
13 Jan 2018, 14:21
UPDATE: the Npc::onHit() has the hitPosition parameter. Can we determine which armor part to select, using this parameter?
Probably not. That's the position where the hit box intersects the NPC's capsule collision shape, and there's no easy way to map that to the limb. You'd need to give a basic collision shape to each of the body parts and test collisions against those to see what's actually hit (some kind of 'accurate hit detection" mode).

Re: Per-slot armor rating

Posted: 18 Jan 2018, 06:47
by Kageseigi
Wow, locational damage is one of my big wishes for Morrowind. While it may not help the player yet, is there a way to favor the odds of hitting a specific body part based on the attacker's attributes (such as Luck or Intelligence... or maybe Agility) to simulate their ability to notice if and where the opponent is wearing no/light armor?

Or is there an ability to replace a character's hitbox with multiple invisible objects/hitboxes, then apply the damage taken from those objects to the character's associated location?

Re: Per-slot armor rating

Posted: 18 Jan 2018, 21:19
by Thunderforge
Is locational damage a thing in Oblivion or Skyrim? Just wondering if we can use those as inspiration for how that might work in a post-1.0 feature or if we’d be making it up on our own.

Re: Per-slot armor rating

Posted: 18 Jan 2018, 22:04
by Capostrophic
It isn't.

Re: Per-slot armor rating

Posted: 18 Jan 2018, 22:58
by AnyOldName3
The later Elder Scrolls games don't have locational damage, and indeed don't even have enough body parts for it to be added nicely as a mod. The Fallout games on the same engine do, though. It's a critical part of VATS and is in the original games, so Bethesda would not have been clever if they removed it.

Re: Per-slot armor rating

Posted: 17 Apr 2018, 19:13
by akortunov
Chris wrote: ↑
13 Jan 2018, 15:51
That's the position where the hit box intersects the NPC's capsule collision shape.
That would be enough for me. The problem is that is true only for ranged combat. For melee combat that position is somewhere INSIDE target capsule. That is a quite weird.

Anyway, I uploaded the prototype for limb detection.