Up to Main Index                               Up to Journal for May, 2020

                      JOURNAL FOR FRIDAY 22ND MAY, 2020
______________________________________________________________________________

SUBJECT: Is there any Body there? Yes! :)
   DATE: Fri 22 May 18:28:21 BST 2020

At long last I have finally pushed the Body update to the public dev branch.

It’s taken a lot longer than I imagined. Much of the wait has been due to the
fact that what I wanted and was in my head wasn’t what I had in code. There
was a lot of documentation to write, code to clean up and a plethora of other
small tweaks and tasks needed to polish the changes.

So what does the update include?

Obviously there is the new Body attribute. The Body attribute can be used to
define body slots for players and mobiles[1][2]. This allows items to be held,
worn or wielded. An important part of the puzzle when adding weapons and
armour for combat — which is where all these changes are heading.

For the moment holding, wearing and wielding items is purely cosmetic. More
work is needed to make weapons and armour functional. Currently any items
defined for a mobile’s inventory are not used yet — weapons are not wielded,
armour and clothing not worn. Related to this, if a player is holding, wearing
or wielding items and logs out the current holding, wearing or wielding state
is forgotten.

The Body attribute does not concern itself with actually holding, wearing or
wielding items. It simply handles anything that is Slottable, which slots are
used by what and which slots are free.

Which Body slots are needed to actually hold, wear or wield an item is taken
care of by the new Holdable, Wearable and Wieldable attributes.

To glue this all together are four new commands: HOLD, WEAR, WIELD and REMOVE.
The remove command stops holding, wearing or wielding an item.

There is a lot of duplicate code for the new attributes and for the new
commands. I’m not sure if it should be refactored into base types or left as
is. If left as is it makes customising a specific attribute or command easier.

Players are automatically upgraded with a default set of body slots:


  Body: ANKLE→2 BACK→1 CHEST→1 EAR→2 ELBOW→2 EYE→2 FACE→1 FINGER→8 FOOT→2
        HAND→2 HEAD→1 KNEE→2 LOWER_ARM→2 LOWER_LEG→2 LOWER_LIP→1 MOUTH→1
        NECK→1 NOSE→1 PELVIS→1 SHOULDER→2 THUMB→2 UPPER_ARM→2 UPPER_LEG→2
        UPPER_LIP→1 WAIST→1 WRIST→2


The default player body is currently hardcoded as I’ve not finished working
out the template system under the /data directory yet :( All of the Body slots
do not have to be used if you want a simpler system. Just don’t use the slots
on any Holdable, Wearable and Wieldable fields when defining items.

The DROP and PUT commands have been updated to automatically REMOVE items
before dropping or putting the item somewhere. If the item cannot be removed
then the GET or PUT will also fail. This keeps the body slot usage in sync
when a held, worn or wielded item is dropped or put somewhere.

The JUNK command will be vetoed for any held, worn or wielded items. This
prevents accidental junking of items you are currently using.

The QUIT command will forcibly remove unique, non-collectable items before
they are forcibly junked and reset. Again this keeps the body slot usage in
sync with items.

The INV/INVENTORY command now shows the item usage:


  >inv
  You currently have:
    a leather jerkin - wearing
    a small green ball
    a dagger - wielded
    a small rock - holding


The ‘holding’, ‘wearing’ and ‘wielding’ usage is actually in green for quick
and easy reference. The message “You are currently carrying” has been changed
to “You currently have” as items can now be held and this could be confusing.

The documentation in docs/zone-files.txt has been updated. The section for the
RESET field now defines the difference between unique, non-collectable items
and those that players can keep and collect — and how each are defined. The
section on Alias/Aliases has been rewritten and now covers alias qualifiers
and bound qualifiers.

What’s next?

I need to update the sample zone files to include examples of weapons, armour
and clothing[3]. All of the NPCs and creatures need to be updated with bodies
and equipment that is actually used[4]. The state of held, worn or wielded
items needs to persist for players across logging out.

Item usage will be via three more new attributes: Holding, Wearing and
Wielding. For mobiles this will specify what items they are initially using.
If all three attributes are not defined for a mobile I may add an automatic
‘WEAR ALL ARMOUR’, ‘WEAR ALL CLOTHING’, ‘WIELD ALL WEAPONS’ sequence to them.
For players the new attributes will record what items are being used and how.

The EXAMINE command needs to be updated so that when you examine another
player, or mobile, a description is automatically built describing them in
their fancy new finery :)

Note to self: You also need to sort out the template situation for player
creation and upgrading…

--
Diddymus

  [1] Mobiles, now abbreviated by millennials to simply Mobs, are the computer
      controlled non-player characters, or NPCs. I’m old school and still call
      them mobiles ;)

  [2] Fun fact: At the moment there is no concept of a mobile in WolfMUD. We
      have players and items only. I disliked the idea of adding a dummy
      Mobile attribute just to tag a mobile. With the new Body attribute we
      can define a mobile as anything with a Body that is not a Player.

  [3] The sample zone files also need to be cleaned up and any test items
      removed or relocated…

  [4] I’d actually like to add references to the zone files. Maybe using the
      at ‘@’ symbol as a prefix. Then you could define templates:


      %%
         Ref: HUMANOID_BODY
        Body: ANKLE→2 BACK→1 CHEST→1 EAR→2 ELBOW→2 EYE→2 FACE→1 FINGER→8
              FOOT→2 HAND→2 HEAD→1 KNEE→2 LOWER_ARM→2 LOWER_LEG→2 LOWER_LIP→1
              MOUTH→1 NECK→1 NOSE→1 PELVIS→1 SHOULDER→2 THUMB→2 UPPER_ARM→2
              UPPER_LEG→2 UPPER_LIP→1 WAIST→1 WRIST→2
      %%


      Then use it just by reference in multiple places:


      %%
         Ref: GUARD
        Name: a city guard
        Body: @HUMANOID_BODY
            ⋮
            ⋮
      %%


      As the ‘@’ reference is on the Body field it would only copy the Body
      field from HUMANOID_BODY. However if the field itself was an ‘@’
      reference it would copy all of the fields from the referenced record.

      At the moment this is just something I’m mulling over.


  Up to Main Index                               Up to Journal for May, 2020