Up to Main Index                           Up to Journal for January, 2020

                   JOURNAL FOR MONDAY 27TH JANUARY, 2020
______________________________________________________________________________

SUBJECT: What you want isn’t always what you need
   DATE: Mon 27 Jan 20:06:33 GMT 2020

I’ve been working on the Health attribute again. First I had to refresh my
memory as to what I was doing. The best way to do that was to read the code
for my outstanding changes that had not been committed yet. While doing so I
realised what I was doing was overly complicated. To recap, I was planning on
having both absolute and relative health values:


  Health: MAX=30 CURRENT=25


         Name: a ring
        Alias: +COPPER:RING
       Health: MAX=+5
  Description: This is a small finger ring made of copper.
  %%
         Name: a glass vial
        Alias: +GLASS:VIAL
       Health: CURRENT=+15
  Description: This is a small glass vial filled with a faintly pink liquid.


These examples show a line for a player’s current and maximum health, a ring
of health that increases the wearer’s maximum health by 5 points and a potion
of healing that increases the drinker’s current health (up to their maximum)
by 15 points. In the first example the values are absolute, in the second and
third examples the values are relative. I had already made changes to the
RecordJar encoder and decoder to support signed values and fixed up other
relevant code.

What I realised when reading through all my changes was that this was all
totally unnecessary. For the Health attribute the values are always going to
be relative unless the attribute is directly on a Player or Mobile — in which
case they will be absolute. Therefore we just always treat the values as
relative unless we are getting the current/maximum health for a Player or
Mobile. We no longer have to worry about is the value signed or not, we just
use its context. Coming to this realisation simplifies the code and processing
of the Health attribute a lot. The same will apply to the Mana (or generic
resource pool — haven’t decided what to call it yet) when it is implemented.

I’ve undone most of my changes and simplified the Health attribute, although
you can’t actually do much with it yet.

In other news…

I’ve updated to using Go 1.13.6 although Tuesday 28th should see Go 1.13.7
released to address some security issues.

The new Raspberry Pi 4 has been powered up and is running Raspbian. I still
need to configure things how I like. I also plan on testing its performance
against the Raspberry Pi 3. The compilation time of Go from source will be
interesting, as will compiling WolfMUD — for me at least, but I'll share my
findings.

The Raspberry Pi 4 has not been hooked up to a screen yet as I don’t have the
correct adapter. I have dozens of adapters for HDMI, DVI and VGA which is very
reminiscent of the adapter collection I have for serial ports :) The one I’m
missing is male HDMI to male DVI — I think, need to double check.

--
Diddymus


  Up to Main Index                           Up to Journal for January, 2020