Up to Main Index                          Up to Journal for November, 2018

                   JOURNAL FOR TUESDAY 27TH NOVEMBER, 2018
______________________________________________________________________________

SUBJECT: $CLEANUP and $RESET panics fixed, new tester, disabling zones
   DATE: Tue 27 Nov 19:43:20 GMT 2018

The weekend before last I said I was going to try and push out the changes for
barriers which I had been working on. As it turned out that never happened.
The problems related to $RESET were more serious and complex that I first
thought and required a lot of time just to understand the issues. Originally I
said:

  "Yet another bug I discovered was that $RESET would sometimes throw a nil
  panic. This is proving to be another illusive and hard to reproduce bug."

I had thought there was a data race corrupting items, but the race detector
was happy and didn’t complain. The problem was actually around events and how
they were being handled, and effected the $RESET and $CLEANUP commands as well
as the JUNK command. Debugging and understanding the issue was problematic, so
I created a tester to do some random automated testing for me :)


  %%
        Ref: M1
       Name: a tester
  Inventory:
      Reset: AFTER→1s
    OnReset: The tester walks in.
    Aliases: TESTER
     Action: AFTER→1s
   OnAction: SNEEZE
           : EXAMINE CHEST
           : EXAMINE BAG
           : EXAMINE SACK
           : EXAMINE BALL
           : EXAMINE POUCH
           : GET CHEST
           : GET CHEST
           : GET BAG
           : GET BAG
           : GET SACK
           : GET SACK
           : GET BALL
           : GET BALL
           : GET POUCH
           : GET POUCH
           : DROP CHEST
           : DROP BAG
           : DROP SACK
           : DROP BALL
           : DROP POUCH
           : PUT BALL SACK
           : PUT BALL BAG
           : PUT BALL CHEST
           : PUT BALL POUCH
           : PUT CHEST SACK
           : PUT CHEST BAG
           : PUT CHEST POUCH
           : PUT BAG SACK
           : PUT BAG CHEST
           : PUT BAG POUCH
           : PUT SACK BAG
           : PUT SACK CHEST
           : PUT SACK POUCH
           : PUT POUCH SACK
           : PUT POUCH CHEST
           : PUT POUCH BAG
           : TAKE BALL SACK
           : TAKE BALL BAG
           : TAKE BALL CHEST
           : TAKE BALL POUCH
           : TAKE BAG SACK
           : TAKE BAG CHEST
           : TAKE BAG POUCH
           : TAKE SACK BAG
           : TAKE SACK CHEST
           : TAKE SACK POUCH
           : JUNK BALL
           : JUNK BAG
           : JUNK SACK
           : JUNK CHEST
           : JUNK POUCH
           : JUNK TESTER

  This is a tester, ready to try and break anything and everything for you.
  %%


You can log in and mess with the tester’s toys if you want to, or just watch
it play. Here is the tester in action working hard:


  Fireplace
  You are in the corner of the common room in the dragon's breath tavern. A
  fire burns merrily in an ornate fireplace, giving comfort to weary
  travellers. The fire causes shadows to flicker and dance around the room,
  changing darkness to light and back again. To the south the common room
  continues and east the common room leads to the tavern entrance.

  You see a tester here.
  You see a curious brass lattice here.
  You see a small sack here.
  You see an iron bound chest here.
  You see a small bag here.
  You see a small green ball here.

  You can see no immediate exits from here.
  >
  The tester studies a small green ball.
  >
  You see a tester rummage around in a small sack.
  >
  You see a tester junk a small bag.
  >
  You notice a small bag that you didn't see before.
  >
  You see a tester get a small sack.
  >
  You notice a small sack that you didn't see before.
  >
  You see a tester get a small green ball.
  >
  You see a tester rummage around in an iron bound chest.
  >
  You see a tester put something into a small sack.
  >
  There is a bright flash and a small green ball appears.
  >
  You see a tester rummage around in an iron bound chest.
  >
  You see a tester put something into a small bag.
  >
  You see a tester rummage around in an iron bound chest.
  >
  You see a tester junk an iron bound chest.
  >
  You notice an iron bound chest that you didn't see before.
  >
  The tester studies a small sack.
  >
  You see a tester get an iron bound chest.
  >
  The tester studies a small green ball.
  >
  You see a tester get a small bag.
  >
  You notice a small bag that you didn't see before.
  >
  The tester studies a small green ball.
  >
  You see a tester junk a small green ball.
  >
  There is a bright flash and a small green ball appears.
  >

I created a ‘quiet’ zone with just one location, the fireplace at the tavern,
and kept a few objects: chest, bag, sack, ball and lattice. The chest had the
pouch in it, and the pouch had a ball in it. The tester, when placed in this
location, randomly plays with items - examining them, getting and dropping
them, putting things into containers and taking them out again, and junking
items.

The zone is available as ‘data/zones/quiet.wrj’ and is on the public dev
branch. By default the zone is disabled. To aid in testing I’ve added a new
‘Disabled’ field to the zone header record. This field can be set to TRUE or
FALSE. If the field is omitted it defaults to FALSE. This allows zones to be
enabled or disabled easily for testing. It also allows switching between
different versions of a zone while it is being worked on. You could even
switch zones for special occasions - for example add pumpkins all over the
place for Halloween.

If you enable the ‘quiet’ zone for testing you should disable any other zones.
Also the cleanup, reset and action rates are all set to only 1 second for
rapid testing. Using the ‘quiet’ zone I was able to reproduce the problems I
was seeing quiet easily.

I was in mid flow working on all of this when I was hit by a nasty bout of
flu. This delayed the fixes and barrier even longer. I have now managed to
catch up with most of my outstanding changes. The public dev branch has been
updated and contains the following which includes fixed for the nil panics:


  - data: Test quite zone, disabled by default.
  - zones,docs,data: Add boolean 'Disabled' field to zone header record
  - attr/cmd: Fix nil pointer panic in $CLEANUP/$RESET/JUNK commands
  - attr: Cleanup outstanding reset check in Reset.Reset
  - cmd: Cancel Actions/Cleanup earlier in junk.dispose
  - attr: Fix Player.Check JUNK veto
  - cmd: Fix comment typo
  - attr: Correct freed slices and counters in Inventory.Free
  - attr: Remove extra period from sentance in Exits.List


Now I can work on barriers again and get them finished.

--
Diddymus


  Up to Main Index                          Up to Journal for November, 2018