Tale (17): pubsub and optimizations

Tuesday 04 December 2012, 00:05:00 | mud / i.f.

It has been a while since I worked at Tale, my Mud/Interactive Fiction framework. I thought it would be nice to pick it up again. Main focus for now were some technical improvements.

Tale Release 0.8: what has changed?

pubsub using blinker

I've started to use the third party library blinker as synchronous notification library. It provides decoupled signaling (or pub-sub if you wish). For now, it is used for the wiretap function in Tale, but could potentially be used for other synchronous notifications as well. Asynchronous notification must still be done using Deferreds.

VFS

Tale now has a simple virtual filesystem that provides data load and store functionality. Data is still being loaded as resources from the Tale package location itself. It is being written to the OS's user data folder (Tale uses the appdirs package for that). Savegames are also stored using the VFS now, so they end up in that location as well, and no longer inside the story's directory. This paves the way for a fully read-only story directory structure (and possibly for loading stories from a zip archive or similar).

other technical improvements

The command functions no longer get a dictionary ctx argument: now they get it as an object with proper attributes. (less error-prone, and IDEs provide auto-completion for this).

The wait command has been improved, you can now wait for a specific time as well, instead of just a given duration:

>> wait 1 hour and 20 minutes

  Time passes.  You've waited 1 hour and 20 minutes.

>> wait 1 h 10 m

  Time passes.  You've waited 1 hour and 10 minutes.

>> wait till sunset

  You can't wait more than two hours at once, who knows what might
  happen in that time?

>> time

  The game time is: 2012-04-19 16:30:00
  Real time is: 2012-12-04 00:04:17

>> wait till 18:00

  Time passes.  You've waited 1 hour and 30 minutes.

>> wait for myself

  You wait for arch wizard Irmen.

>>

And last but not least, a lot of bugfixes have been done, especially to the 'move' command and when doing stuff on exits.