Download Game! Currently 80 players and visitors. Last logged in:ChizraGlamdringMalcomLiving

BatMUD Forums > Updates > A brief history of 'wear' related changes

 
 
#1
30 Apr 2022 17:39
 
 
Greetings.

Again, a somewhat longer ramble and status update regarding the changes
made to the wear functionality ('wear' and 'eqset' commands) ever since
the autumn of 2021. For those who are not keen on long posts, here's the
"short" summary of it:

The 'wear' functionality was refactored and has been sporadically
further worked on by yours truly since October 2021. Most of the
internal changes should be practically invisible, but the following
functional improvements have been made in total:

* 'wear replacing' now works with mage staves and nun relics as one
would expect. Previously you could not 'replace' those items with
another relic or staff, you had to first 'remove' them.

* 'coy' setting works as expected, instead of seeing the wear/remove
spam of other people when such spam should not be visible. It is
still possible to spam people otherwise, so .. shrug.

* A new 'replacing' modifier called 'noreplace' was added to wear and
eqset commands. This modifier allows users to specify a list of
items that 'replacing' should NOT replace. This can be useful with
things such that you'd rather keep on while swapping equipment.
See the help for wear and eqset for more information.

* The "can not wear" type messages and other diagnostic messages of
wearing had been at some point disabled completely. I believe this
was a bad thing, you would not get no "error" in case you were not
able to put something on. This can be confusing to newbies and
.. well, anyone, honestly.

These messages now appear for 'wear' and 'eqset', but NOT when you
use 'wear replacing' or 'eqset wear replacing' or 'noremove'.

If this becomes an "issue" to some, a setting may be introduced in
the future, but for now I'll just leave it be.

* Some bugs were fixed as well, one minor abuse (had been in game
for over 10 years, though so obscure that nobody probably noticed)
and later one that I had accidentally introduced while refactoring.

* As a side-effect of this refactoring work, an extensive test suite
of 40+ wear combination tests and about 20 eqset tests (more to be
added as / if needed) should now give some assurance that future
changes might not unintentionally break things. Hopefully.


So, that is the short summary. I will now continue with some of the
history and more technical details, and perhaps the caveats of the
current wear implementation used by 'wear' and 'eqset' commands.

...

The impetus for refactoring wear started from the problem of the
most innocent 'coy' setting not working as expected in certain cases.
The old code worked very simplistically when 'wear replacing',
attempting to remove "blocking" items one by one until the item
we wished to wear fit, or we ran out of slots to empty.

This simplistic approach, combined with other factors, caused the
'coy' setting to have no practical effect in those cases.

To fix this, a radical alteration was needed - a method to compute
the set of items to be removed from slots, based on the items
currently being equipped, items desired to be worn and which
slots were already free.

This issue is complicated by various aspects, including the fact
that while we 'wear' armours, we also 'wear' clothing, which are
(mostly) decorative items that inhabit slots, but have kind of
"shadow" slots that take no space from real armours - only other
clothing.

My first attempt was mostly successful, though some quirks remained.
At this point, I was asked about having 'replacing' to work with
certain wear-restricted items such as nun relics and mage staves
that allow only one of them to be worn at a time. I considered the
facts and thought it was too much of an effort.

Several months went by. At one point, a bug-report was received from
mr. Broetchen, who had found a "slight" oversight in the new system,
allowing multiple mage staves to be worn at same time. Oops.

I deployed a quick fix, but was disturbed by it enough to start a
second .. or third(?) round of work. And this time there would be
tests. Lots of tests. (Cue "The Matrix" loading room sequence.)

A test framework was developed for testing 'wear' and 'eqset'; and
a number of tests for checking the logicality various combinations
of wearing and their end results. Over 40 of 'wear' tests now exist
and there will probably be more. 'eqset wear' tests number around
20 at the time of writing. Since the functionality mostly overlaps,
there is no need to test same things on both commands.

While testing, the code evolved again, now aided by the tests.
Comparing the results to old versions of the commands helped to
shape what would need to be done. However, some things would be
ultimately different, especially the results of "invalid" or
"labile" use cases such as:

* Attempting to wear more items to a slot than there are slots.
E.g. you have 2 arm slots, you try to wear 3-4 arm slots worth
of equipment.

* You have 2 arm slots, both occupied by 1-slot items. Then you
'wear replacing' a 1-slot item. Now .. the item that gets
replaced depends on the internal order of the objects in your
"inventory". You can affect the outcome via 'juggle' of the
items, but otherwise the result is from player point of view
somewhat pseudorandom.

Do note that this has always been the case, the new code may
just have different outcome than the old one.

For critical cases the new 'noreplace' modifier of 'replacing'
may be quite useful.

* Eqsets data does not define any order for the items in a set,
so there can be differences and "labile" cases of wearing.
By "labile", I mean that the result is "valid" from logic
point of view, but there may be multiple different outcomes
if the set defines items that occupy same slots.

This again has always been the case, but new code may result
in differences.


Finally, today as I deployed the latest changes for you to ..
enjoy .. a bug was immediately hit and reported by mysterious
mr. Zumbalo. Fortunately it was nothing major and was easily
fixed. After that, I quickly finalized the 'noreplace'
functionality.

So, this is the state of 'wear' now .. hopefully this post has
some informational rant or humour value at the very least.

--
Ggr

 
Rating:
2
Votes:
2
 
 
Ggr
W i z a r d
5y, 307d, 20h, 22m, 48s old
Level:
100 [Wizard]