Up to Main Index                              Up to Journal for June, 2015

                      JOURNAL FOR THURSDAY 4TH JUNE, 2015
______________________________________________________________________________

SUBJECT: Disgruntled Exits
   DATE: Mon 15 Jun 21:45:16 BST 2015

It seems that the 'new new start' with WolfMUD has been quite well received. A
few people were a little annoyed - impatient? - that it was missing some of
the previous prototype features such as networking and data files.

One of the main criticisms - which I agree with - is the implementation of
Exit attributes for locations. Currently exits are implemented as an array of
Thing interfaces:


  exits [len(directionNames)]has.Thing


I chose to implement exits this way for flexibility. As with many choices such
as this there are various trade-offs to consider. Implementing exits this way
an exit can lead to *ANY* Thing, as long as the Thing has an Inventory
attribute in which to place the arriving player. The destination thing does
not even have to have an Exit attribute itself. The downside to this is that
you have to move backwards and forwards between an Exit attribute, the
attribute's parent Thing and the Parent Thing's Inventory attribute. What is
worse you have to do this for the source AND destination locations when
changing location. If you are just interacting with something locally, for
example picking something up or examining something you still have to do this
whole exercise twice - once for the player and once for whatever they want to
interact with.

This backwards and forwards between attributes and Things affects all of the
currently implemented commands - so I understand why people criticised the
implementation. Not from a sucking up CPU cycles point of view but from a bad
code smell point of view that would only become worse over time as development
progresses.

So last Wednesday and Thursday I spent some time working on alternatives to
address the problem and nip it in the bud.

My first attempt was to change the references from Things to Exit attributes.
This has the advantage of directly referencing the other Exits without having
to find parent Things but we still need to find Inventory attributes. Also
this didn't seem to be reducing code effort that much for the commands.

So I abandoned that attempt - stashed it away safely in git - and tried
another approach. This time I tried changing the exits to reference Inventory
attributes. This should remove a lot of code effort implementing commands as
well as being more efficient. I say should because I'm still working on this
approach as it touches a *lot* of code.

I know already I won't be able to work on this Wednesday but Thursday is
looking pretty likely...

--
Diddymus


  Up to Main Index                              Up to Journal for June, 2015