Skip to Content

1106h, October 26th 2019

1106h, October 26th 2019 is a log tagged with Racket, qtMUD, and programming. It was released on Oct 26, 2019.

So I’ve decided that I’m going to try and write a MUD engine in Racket, instead of using a hodge-podge of Org-mode files to handle my personal data. What? A MUD instead of personal data files?

Well, I plan on having the MUD use text files as its data store (don’t need to scale, since it’s for me) and accessible only locally (though capable of sending and receiving remote requests, just not in a MUD sense.)

So, the MUD is more of an interface for the information, but I’ve had experience with that before, and at one point even used a modded Minecraft server as an “office” for several folk I worked remotely with.

Anyway, part of the desire to switch is because while Org-mode is very powerful, it’s a camel: a horse designed by commitee. Very few of its features work the way I’d like, and I feel like I spend a lot of time trying to rework how I want ot handle data into an Org-mode friendly way. Not to speak of the time I take then trying to get that data into my static site generator.

Better, I think, to just write myself an interactive personal information manager. That way, I can handle writing the data schema and functions that interact with them in the exact ways I want.

Now, I’ve given this a jab back in the early summer, but using Elisp and through the paradigm of creating an ActivityPub webserver. I’d like to shift that to using Racket and through the paradigm of a MUD, instead.

Why a MUD? I’m sure there’s a more legitimate reason than this, but superficially: I grew up playing MUDs, not surfing the web. I love them. I think they’re under-used as a means of communication and community.

(What is a MUD? A “multi-user dimension” (or dungeon, if you’re old). Basically, a text-based online role-playing game, where instead of 3d graphics, you get textual descriptions of the game world and events.)

Before I can make a MUD engine in Racket, though, I need to learn Racket! From using Elisp, I don’t think I’ll have to learn much about the basic concepts, since it’s also a Lisp-sorta language. But the syntax will be different.

So, I think the first thing I’ll do with Racket, after going through the first tutorial, is port over my ems-library.el Elisp script, which is a few functions for handling a reading list.

Then I’ll probably dive straight into trying to set up a socket server and the other parts of a basic MUD engine. (I’ll explain those when I get to them.)

Update: I went ahead and copied some of the main functions from ems-library.el to qtmud/modules/library.rkt. Here’s the Racket code:

(struct library-item (title
		      author
		      description
		      source
		      rating
		      opinion))
(define library-log
  (hash 'to-read (make-hash)
	'have-read (make-hash)))
; Functions


(define (create-library-item title author description source rating opinion)
  (library-item title author description source rating opinion))

(define (create-item-to-be-read title author description source)
  (create-item-in-log
   (create-library-item title author description source #f #f)
   'to-read))

(define (create-item-in-log item log)
  (hash-set! (hash-ref library-log log) (library-item-title item) item))

(define (read-log log)
  (hash-ref library-log log))

(define (read-title-from-log title log)
  (hash-ref (hash-ref library-log log) title))

(define (update-title-as-have-read title rating opinion)
  (create-item-in-log (read-title-from-log title 'to-read) 'have-read)
  (set-library-item-rating! (read-title-from-log title 'have-read) rating)
  (set-library-item-opinion! (read-title-from-log title 'have-read) opinion)
  (delete-title-in-log title 'to-read))

(define (delete-title-in-log title log)
  (hash-remove! (hash-ref library-log log) title))

Here’s some resources I found searching online, that are ahead of what I need, but I’m going to put here for lack of a better place:

Resources: