Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: armor coverage research  (Read 1342 times)

derigo

  • Bay Watcher
    • View Profile
armor coverage research
« on: May 11, 2010, 01:04:42 am »

This was a report recently posted on the bug tracker by Knight Otu.  I did a lot of testing and I thought you modders might be interested in the results, so I'm posting it here.

Here's the bug tracker link:
http://www.bay12games.com/dwarves/mantisbt/view.php?id=1821

Knight Otu's original report:
Spoiler (click to show/hide)


Toady's comments on the subject: (fairly hard to understand Toady here)
http://www.bay12forums.com/smf/index.php?topic=18536.0

My findings:
Spoiler (click to show/hide)
Conclusions:

-The only way to protect [STANCE], [GRASP], or [HEAD] parts (feet, hands and head) is with armor worn on them specifically.
-[LIMB]s are correctly protected by UBSTEP and LBSTEP
-The ONLY way to protect parts that are not [LIMB],[STANCE],[GRASP],[HEAD] or [UPPER/LOWERBODY] parts (such as facial features, toes, fingers, throat, vestigial wings, any cosmetic custom parts, etc)is by exploiting the bug reported by the OP. You need a robe, or a dress; a body armor with UBSTEP:MAX and LBSTEP:MAX.
-dwarves getting nibbled to death by many foxes is hilarious
Logged

derigo

  • Bay Watcher
    • View Profile
Re: armor coverage research
« Reply #1 on: May 11, 2010, 12:58:35 pm »

OK I've played with these values a great deal now and I want to try to translate toady's post into something more readable.  First of all, Toady's comments in that thread ONLY apply to body armor, aka ITEM_ARMOR items.  Other items have slightly different rules.  Secondly I'm going to approach if from the armor's perspective rather than from the body part's perspective.  Toady almost certainly approached it how he did because thats how his algorithm works.  Its counter-intuitive and hard to read for most mortals, though. ;p

Body armor is worn on the upper body and so it protects the upper body.  By changing the UB/LBSTEP values, you can extend the armor to cover other parts of the body as well.  Steps ignore UPPERBODY's and LOWERBODY's in their count, even with a step of 0, body armor will protect a connected LOWERBODY.  Wierdly configured creatures with multiple lowerbodies or somesuch are not currently supported. 

The trick is to figure out which kind of STEP to use to cover the parts you want to cover.  To use LBSTEP:
- a part must be a [LIMB]
- a series of [LIMB]s including the part must connect from the upper or lower body to a [STANCE] part (like a foot).

UBSTEP will cover any parts connected to the upperbody that do not qualify for LBSTEP.  Arms for instance, are [LIMB], but they don't have a [STANCE] part at the end, they have hands instead.  As such they do not qualify for LBSTEP coverage (unless the creature is quadrupedal).

Once you know which step to use, just count how many body parts away from the upperbody a given part is to determine how many UB/LBSTEPs you need.  Remember, UPPERBODY and LOWERBODY parts don't count as steps, so the UPPER_LEG parts are only 1 LBSTEP from the upper body. 

As of 31.03, neither UBSTEP nor LBSTEP are able to cover hands, feet, or heads, aka parts with the  [GRASP],[STANCE], or [HEAD] token.  To cover these parts, you have to use ITEM_GLOVES, ITEM_SHOES, or ITEM_HELM armors instead.

As of 31.03 UBSTEP is bugged.  Although it cannot cover hands, feet, or heads, it CAN cover parts beyond those parts such as fingers, and facial features.  Also, inexplicably, the UBSTEP coverage can go THROUGH LBSTEP coverage (without covering it), and cover toes.  As an example, a body armor with [UBSTEP:4] or higher (the highest is MAX), will cover
step 1: the upper arm
step 2: the lower arm
step 3: the hand (but body armor doesn't protect hands, so it doesn't actually cover)
step 4: the fingers

similarly, it will cover facial features:
step 1: the head (but body armor doesn't protect heads, so it doesn't actually cover)
step 2: all facial features(the throat is actually a child of the head, so it is also covered)
no more parts

Wierder it also covers the toes in the following manner:
step 0: the lower body
step 1: the upper leg (but this is a LBSTEP part, so it doesn't actually cover)
step 2: the lower leg (same)
step 3: the foot (but body armor doesn't protect feet, so it doesn't actually cover)
step 4: toes


On to other kinds of armor.  Helms are very simple.  They don't use UBSTEP or LBSTEP.  They only protect the [HEAD].  They do NOT protect facial features, or any child parts of the head.

Gloves and shoes also don't use UBSTEP or LBSTEP.  They both can use a similar token UPSTEP.  It works just like LBSTEP for body armor except it must terminate in an UPPERBODY by connecting through [LIMB]s.  Just like how body armor can't protect hands, feet, or heads,  gloves can't protect upper or lower bodies.  So a glove with [UPSTEP:MAX] will cover the hand and the entire arm, but not the upper body, or anything past it.  And a shoe with [UPSTEP:MAX] will cover the foot and the entire leg, but not the lower body or anything past it.  Since fingers and toes are not [LIMB]s, they are not protected at all by gloves or boots, regardless of UPSTEP.  This may be a bug (31.03).

Pants are a little different.  They don't use UBSTEP or UPSTEP.  They use LBSTEP only.  As a result, only parts that qualify for LBSTEP in normal body armor can be protected by parts.  That is, again, [LIMB]s that connect in a series to a [STANCE] (foot) part.  Because pants don't use UBSTEP, any vestigial non-STANCE parts connected to the lower body can not be protected by pant.  So for instance, a tail, or genitals, knee spikes, or any part that is not a LIMB, can not be protected by pants.  In order to protect such parts, you need upper body armor with an  appropriate UBSTEP.  This is confusing and counterintuitive in my opinion.  I mean, what protects YOUR genitals?     


The lesson here:  in 31.03, the best thing to do with adamantine, armor wise, is to make lots and lots of adamantine robes, helms, gloves, and boots.  Skip armor completely, just make robes.  Layer on a bunch of them.  At that point you'll be invulnerable.   

In a less broken sense, always remember to include robes or dresses (or both) in your military's uniform, nothing else vanilla protects your fingers, toes, or facial features.


Logged

Knight Otu

  • Bay Watcher
  • ☺4[
    • View Profile
Re: armor coverage research
« Reply #2 on: May 11, 2010, 01:17:59 pm »

Thanks for the throughout research! What else I'm taking from all this is that armor placement needs a more direct, transparent and predictable raw treatment (since I'm trying to gather material for a raw suggestions thread, I have some ideas in that regard). I mean, the up/ub/lbstep is somewhat readable once you know how it works, but you need to know how it works, and errors in how it works can always creep in (as they did).
Logged
Direforged Original
Random Raw Scripts - Randomly generated Beasts , Vermin, Hags, Vampires, and Civilizations
Castle Otu

derigo

  • Bay Watcher
    • View Profile
Re: armor coverage research
« Reply #3 on: May 11, 2010, 02:15:20 pm »

I understand why Toady did it this way.  He needed an algorithm that is flexible enough to incorporate all different kinds of bodies.  To fix the problems, all he really needs to do is make the end points(hands,feet, head) cutoff points for the UBSTEP search, and add the UBSTEP token (or one very similar to it) to all the other parts so that gloves can protect fingers, helms can protect mouths, shoes can protect toes, and pants can protect genitals. ;p

Its very very important to realize that UPSTEP has MUCH more in common with LBSTEP than it does with UBSTEP.  I'd wager its the exact same algorithm in reverse.

As to the thoroughness of my research?  What can I say?  Its hilarious watching a dwarf get chewed to death by foxes!

A suggestion for the raws?  Even with all this complicated step dancing around, we're still fairly limited in the kinds of armor we can make by the fact that we can't defined new classes of armor.  Toady even mentions it in a comment in the raws for greaves.  There's no way to make armor that ONLY covers legs.  At best it has to start at the lower body, and travel down.  It seems to me he could save himself a lot of trouble by letting the armor define more explicitly what parts it covers.  How about adding a [PROTECTS:BY_CLASS:<bodypart>] token or something along those lines instead of this STEPping wackiness?   
« Last Edit: May 11, 2010, 02:26:38 pm by derigo »
Logged

Knight Otu

  • Bay Watcher
  • ☺4[
    • View Profile
Re: armor coverage research
« Reply #4 on: May 11, 2010, 03:17:19 pm »

A suggestion for the raws?  Even with all this complicated step dancing around, we're still fairly limited in the kinds of armor we can make by the fact that we can't defined new classes of armor.  Toady even mentions it in a comment in the raws for greaves.  There's no way to make armor that ONLY covers legs.  At best it has to start at the lower body, and travel down.  It seems to me he could save himself a lot of trouble by letting the armor define more explicitly what parts it covers.  How about adding a [PROTECTS:BY_CLASS:<bodypart>] token or something along those lines instead of this STEPping wackiness?
That's about where my ideas currently go, taking some cues from some of the new body part tokens. There needs to be some flexibility in where the armors can "expand", which as you say Toady recognized. I'd hope my suggestion can keep the functionality without using STEPping (which may step to places we don't want).

A mask might look like this:
   [POSITION:BY_CATEGORY:HEAD:FRONT:100]
   [ADD_PROTECT:CHILD_BP:BY_CATEGORY:HEAD:ALL:FRONT:80]
Worn on the head, protecting the whole front, and all child body parts, covering 80% (even the heaviest mask has some slits and holes).

Greaves might look like this:
   [POSITION:BY_CATEGORY:LEG_UPPER:OR_CATEGORY:LEG:AROUND:80]
   [ADD_PROTECT:CONNECTED_BP:BY_CATEGORY:LEG_LOWER:ALL:AROUND:80]
Worn on the upper legs (or legs, if the creature doesn't make such distinctions), also protecting any connected lower legs, and protects 80% of the leg.
There may need to be distinctions on whether a given armor can cover more than one/all body parts of a type (as greaves probably should), and a single one (as masks should).
Logged
Direforged Original
Random Raw Scripts - Randomly generated Beasts , Vermin, Hags, Vampires, and Civilizations
Castle Otu

derigo

  • Bay Watcher
    • View Profile
Re: armor coverage research
« Reply #5 on: May 11, 2010, 04:02:04 pm »

Yeah you can definitely tell that toady made the armor system as it stands before he made these BP POSISTION tokens.  Its too juicy not to want to extend the idea.  It's also a terribly complicated prospect to think about changing it to work this way though...   

I originally had all kinds of criticisms and stuff, but the more I look at this the more I like it.   Since we're selecting parts by category, its pretty damned flexible by nature.  It lets you apply different amounts of coverage to different body parts, which is awesome.  As to distinguishing between covering all or one of a part, just add another field at the end that accepts ALL or ONE and maybe PAIR. 

Its too much to ask to have an OR_CATEGORY inner argument like that.  Just make them discreet statements.  It'll take up a little more space, but it'd certainly be healthier code.  like so:
 
   [POSITION:BY_CATEGORY:LEG_UPPER:AROUND:80]
     [ADD_PROTECT:CONNECTED_BP:BY_CATEGORY:LEG_LOWER:ALL:AROUND:80]
   [POSITION:BY_CATEGORY:LEG:AROUND:80]

Indicating that the armor can be work on a LEG_UPPER, in which case it will also cover a LEG_LOWER, or it can be worn on a LEG, in which case it won't bother.  Then you could do fun things like this!

[ARMOR_ITEM:WARMER]
   [POSITION:BY_CATEGORY:LEG_LOWER:AROUND:30]
   [POSITION:BY_CATEGORY:ARM_LOWER:AROUND:30]
   [POSITION:BY_CATEGORY:TAIL:AROUND:30]
   [POSITION:BY_CATEGORY:HEAD:AROUND:30]
     [ADD_PROTECT:CONNECTED_BP:BY_CATEGORY:EAR:ALL:AROUND:100]
   [POSITION:BY_CATEGORY:NECK:AROUND:90]

Maybe even throw in some GLOSS to change the name depending on where it's worn.  This idea, while fun, would certainly add yet another complication to the military equipment assignments.   
Logged