Up to Main Index                              Up to Journal for July, 2021

                      JOURNAL FOR SUNDAY 18TH JULY, 2021

SUBJECT: Events and actions released to experiment branch
   DATE: Sun 18 Jul 20:00:49 BST 2021

Last week was very busy workwise. I did get time to work on the experiment and
have finished the first release of the event system with actions enabled. Now
I can work on implementing clean-ups and resets. This time around it shouldn’t
take a month of Sundays to implement…

There are additional changes besides events — either fixing problems, cleaning
up or providing the groundwork for events.

The hard-coded zones from the loader have been removed. It’s now possible to
load any zone files found under the data/zones directory. The loader also
respects the DISABLED field in the zone header record — this makes switching
between different zones crafted for testing easier. Server logging has been
cleaned up and the world loader is more chatty about what it’s doing to aid

The horrible ‘magic’ init dance in core/commands.go has been removed. It is
replaced with a RegisterCommandHandlers function. This has sorted out many
issues I was running into due to cyclic initialisation loops. State can now
parse sub commands via a new State.subparse method. The subparse method
enables commands to invoke other commands while reusing the current actor and
message buffers. This is useful for scripting and for commands that want to
use functionality already implemented in other commands. Messages from all of
the commands invoked are batched together requiring only one delivery per

The MOVE command has been updated to work with non-players properly. This
means mobiles[1] can now wander around randomly via action events. I’m still
not sure if Thing.Who should be just for players or if mobiles should be moved
from Thing.In to Thing.Who? I think they will stay in Thing.In as it allows
for anything not a player to move — wagons, trains, platforms etc…

Item initialisation has been improved. There is now a Thing.Enable method for
setting up a Thing in the game world. This has allowed the initialisation of
doors to be moved out of the loader. Enable is also where events are initially
registered for items. Enable will also set Thing.Where of an item to that of
its parent inventory — so that items know where they are.

I’m not sure how useful this last one is as Where is only the UID of the
parent and not a pointer to the actual parent Thing. This means we still can’t
reach backwards up the inventory chain to find the parent inventories :( The
GET, DROP, PUT, TAKE and QUIT commands have been updated to keep the Where
reference in sync with where the item actually is.

For events there is a new Thing.Events and a matching eventKey type to index
it. Events are scheduled and aborted using new Thing.Schedule and Thing.Abort
methods. Events cannot be suspended just yet — nearly done but people wanted
updates, so… for now events are aborted when you get an item and scheduled
when the item is dropped again. Suspending and resuming events should be in
the next update.

Everything is now out on the experiment Git branch.


  [1] Mobile - anything that moves that is not a player. Often abbreviated as
      just ‘mob’, but people are probably more familiar with the term ‘NPC’ or
      non-player character[2]. I’m old school, still like mobile ;)

  [2] Although ‘mob’ still seems to be popular with Minecraft players :)

  Up to Main Index                              Up to Journal for July, 2021