Phlog Collection 2025-11-04

I haven't set up an automated way to push my Gopher phlogs from Cyberhole Online up here yet, so I'm just going to manually paste for the moment. So this may be a bit random.

mdh@Aegura:~/Code/CodeJS/Cyberhole/gopher/hole/phlog% cat `ls -1 *.txt|sort -r`|pbcopy

i=== Digital Mark's Phlog ===
2025-11-04 19:06:46 UTC
Momentary Thoughts About Game Design

I've been making games for 46-ish years, and I still don't know how to
make a "compelling narrative". Sometimes I have good gameplay and "kill
the thing" plots.

A few times I've worked at studios and had a writer who could produce
lore text, but we still didn't have much story.

That's why my games are mostly interface first, what does the technology
let me do, then work out some game logic behind it.

I generally reject the narrativist view of games. Games are interaction
+ challenge = fun. Books and movies are characters + plot = fun. Visual
novels combine book style with illustrations and a homeopathic level of
interaction, maybe one choice every 10-20 minutes for most. Modern MMOs
& mobage are largely predefined characters on a rails plot, with a
shooting or action game in between. Designers for these hate the idea
of you having your own character or making plot choices.

What I find interesting is exploring a world, fighting, and building. So
Atari 2600 games are still fascinating; the absolute focus on gameplay
was required by the limitations of the machine. Luanti (and that "mines
craft" game that's like it) is endlessly fun. Juice Galaxy is amazing,
just weird blobby monsters, toys, and vehicles in procgen world. AAA
titles are basically all crap, they have characters I can't stand, doing
things I don't want to do, minutes of fun after hours of hitting X.

Text adventures are in a weird space, where there's varying levels of
exploration or plot railroad, varying levels of character predefinition.
Hitchhiker's Guide to the Galaxy is fun once (possibly frustrating for
months), but it's very linear and you are Arthur Dent, of the late
Earth. Zork and Colossal Cave Adventure are still fun, because there's
no fixed path to solve everything, and you're not defined by the game.

A lot of people do like the excruciatingly long cutscenes and "Press F
to Pay Respects" pseudo-gameplay, I'm well aware I'm an outlier. But
that's why I make my games for me. If someone else has fun, too, that's
a sweet bonus!

2025-10-31 05:10:56 UTC
Cyber Mudhole

Starting on the Lisp Game Jam Autumn 2025
https://itch.io/jam/autumn-lisp-game-jam-2025

Plan is to put up a Terminal that talks to a MUD written in my Kawa
servlet platform.

I wrote a long, mostly aspirational, list of MUD commands inspired by
LambdaMoo and TinyMUD; it's not very like my old combat-oriented
Circle MUD. I doubt I'll get more than a fraction of the commands
done, but if multiple players can move around and say and emote, it's
good enough.

The way this works is there's a Java servlet container, and a single
servlet that takes POST requests for commands, then returns all your
chat history since last call. If it polls every so often with empty
command, it should look real-time-ish, and connection keep-alive
should prevent it from hammering the server.

The servlets are in Kawa Scheme, which compiles to normal enough Java
classes. I'll put the whole framework up on gitlab or whatever as I
get towards the end, it's definitely changing a lot each update right
now.

2025-09-02 13:03:13 UTC
Phlogging Like a Typewriter

One thing that occurs to me when writing gopher phlogs, is the 70-
column limit feels like typing on paper. Get near the end and I have
to guess if the next word will fit or not, and whack the carriage
return DING all the way back. I haven't got in the habit of hyphen-
ating words but I did it right there!

Is the physical act of typing different when you don't have auto
word wrap on? I could vi :set tw=70, but I don't.

2025-09-02 12:32:03 UTC
Mystic Dungeon beta

I have a barely-working version of the Mystic Dungeon, my dungeon
exploration game. Everything in the game system works again,
and I've added three new stores (one you won't find for a while!),
and some secrets to find outside of town.

Right now messaging is incredibly spammy and ugly, using up the full
screen if you move fast. Just wait a few seconds and the messages
will dissipate. I'll fix those in the next pass.

You can save [F3] and load [F2] and it's saved to local storage.

https://cyberhole.online/dungeon

Have fun, and let me know what you think!

2025-08-18 08:34:55 UTC
Amazing (converting MysticDungeon games)

I've now managed to convert one of the MysticDungeon.club games, see
front page of https://cyberhole.online/

That wasn't too hard. It's using like 1/2 of the code of the previous
version, and doesn't rely on Node or have to be built, I can just empty
cache and reload a page. But it's a little harder to debug, eslint
doesn't work well on pile-o-random-js.

Amazing's not that impressive, and I'll probably do LostTreasure and
some other small ones, then get the big stuff converted. PortalWorlds
and Dungeon both rely on a shitload of libraries.

The high score server's gone, which is unfortunate. There's a few
options to replace it. A server running Scheme, of course. Or maybe some
web service that I can ajax out to? Cross-site posting is complicated
now.

2025-08-01 03:30:30 UTC
TinyBasicWeb

Now I have a working boot-to-READY prompt BASIC!
It's pretty primitive still, just enough to do interactive
forms, and I plan to put in some web tech (REMOTE and REDIR)
commands which will make it useful for that.

Currently some BASIC microcomputer games will work in it.

So with that basically (o_o) functional, I can focus on
adding more services to the CYBER HOLE.

2025-07-23 02:06:47 UTC
Gopher Holed

And now the CYBER HOLE has my phlog! I can either log in and
write-phlog.zsh, or do it locally and scp into place, refresh and
it's rebuilt by script.

Just finished the Lispy Gopher Show
gopher://gopher.club/1/users/screwtape
(who hasn't been updating his phlog, but like I'm Mr Reliability?)

RIP Ozzy Osbourne. The best and drunkest of us.

2025-04-27 14:39:03 UTC
Dayglo Decade

I was listening to Children of the CPU
https://childrenofthecpu.bandcamp.com

While testing out my write-phlog script.

2025-04-27 13:47:08 UTC
First post

So driven by my Hypertext post
https://mdhughes.tech/2025/04/22/some-of-my-history-of-hypertext/

I needed to set up Gopher again, and not just on SDF or tilde.town.
Talking to Screwtape & CatK got me moving on it.

Currently I'm running Motsognir,
https://motsognir.sourceforge.net
since it works well on BSD; on MacOS, I had to comment out the "dot
feature" to make it compile, but I changed NoTxtPeriod=1, the default is
just wrong, so it's fine.

Which has made it pretty easy to set up CGI (Common Gateway Interface!)
scripts to generate header, footer, and phlog indexes.

And I use shell scripts to start, stop the server, and generate phlog
posts in my format (TIME.txt filename; TIME, TITLE, blank for body); I
would use RFC822 but it's a little more parsing, and the date format is
wrong.

For client, I mostly test in Lynx
https://lynx.invisible-island.net
but also Lagrange
https://github.com/skyjake/lagrange

Which has revealed a few bugs in how I write gophermaps!
In particular, Lynx doesn't care if you list a text file as a dir or
text or binary, it'll render it anyway. Lagrange is very picky, so a
dumb directory doesn't work with it.

Scheme Parent Protocols

Here's a subtle point of using Scheme (Chez, R6RS) records with inheritance:

;; creates a record, two default fields
(define-record-type Foo
    (fields (mutable x) (mutable y))
    (protocol (λ (new) (λ ()
        (new 1 2) )))
)

;; creates a subtype, one specified field
(define-record-type Bar
    (parent Foo)
    (fields (mutable z))
    (protocol (λ (super-new) (λ (z)
        (let [ (new (super-new)) ]
            (new z) ))))
)

(define b (make-Bar 3))
(Foo-x b)
1
(Foo-y b)
2
(Bar-z b)
3

The "new" your subtype protocol (constructor, in any OOP system) gets is a wrapper function that calls the parent protocol, and returns your actual "new". If you don't have a protocol, you just do (make-Bar 1 2 3) and that works.

It's a little annoying that define-record-type doesn't copy accessors forward, leading to either that mess of Foo-x/y, Bar-z, or a long list of (define Bar-x Foo-x) etc., but if I wanted a real object system I already have one. In my use case records are faster, I just didn't understand this quirk, and the docs don't help by calling the constructors "n" and "p".

Old Man in the Woods Way of Argument Parsing

So, my premise is that only developers use command lines anymore. And after years of corporate enslavement, it's nice to run off to the woods, make a log cabin and all your tools yourself.

Therefore the best way to parse arguments in Scheme is:

(define debug #f)
(define outfile #f)
(define infiles '())

(define (main argv)
  (set! debug (if (member "--debug" argv) #t #f))  ;; boolean
  (set! outfile (if (member "--out" argv) (cadr (member "--out" argv)) #f))  ;; key-value
  (set! infiles (if (member "--" argv) (cdr (member "--" argv)) #f))  ;; all after --
  (unless outfile (error 'main "No outfile given")) ;; maybe show a whole usage & exit
)

This has some disadvantages. It's only discoverable by reading docs or even code, and you have to write the docs yourself. If you want short args, you have to duplicate lines and maybe set the arg twice.

But it's trivial to set up, you can't really get it wrong, and the amount of effort is appropriate to a developer interface.

(You might complain I'm using globals, you can just change those to let)

For the young over-engineering crowd, there are a variety of arg parsing libraries. And I'm too lazy to demonstrate each of them. But in the set of generates usage, is easy to use, and you'll be able to remember how it works in a year, they all get maybe 1, and need to be 3.

A Schemer in Common Lisp Land

I got my Land of Lisp tshirt (shop is now closed), and thought for my weekend goof-off I'd read thru the book again and try actually using the Common Lisp examples; before I'd just converted it on the fly to Scheme, as I usually do with any Lisp stuff. But doing this exposed me to a fairly annoying environment, so I've been writing up my notes, function equivalents, workarounds. And I'll keep updating this page as I do more with it:

I had thought going in, maybe CL would be usable for some projects. But now, I know there's no way I would try to use this in production.

Formatting Strings in Scheme

Most of the time I use primitive display, or print functions:

;; displays a series of args to stdout
(define (print . args) (for-each display args) (flush-output-port) )

;; displays a series of args to stdout, then newline
(define (println . args) (for-each display args) (newline) (flush-output-port) )

;; displays a series of args to given port
(define (fprint port . args) (for-each (λ (x) (display x port)) args) (flush-output-port port) )

;; displays a series of args to given port, then newline
(define (fprintln port . args) (for-each (λ (x) (display x port)) args) (newline port) (flush-output-port port) )

;; displays a series of args to stderr, then newline
(define (errprintln . args)  (let [ (port (current-error-port)) ]
    (for-each (λ (x) (display x port)) args) (newline port) (flush-output-port port)
))

but sometimes I actually need to format things:

(import (prefix (srfi s19 time) tm: ))

(format #f "~8a ~10:d ~20a" name score
    (tm:date->string (tm:current-date) "~Y-~m-~d ~H:~M:~S") )

Common Lisp format works as described in Chez Scheme, using /#f for destination, and some other Schemes as well; but most Schemes only have the nearly-useless SRFI 28. I'm aware of cat/fox/etc combinatorial formatters, but they're very verbose.

Chez also has date/time functions, but no formatter, so using SRFI 19 - nicely, SRFI 19 mostly does sane things, it's not like C's strftime.

Gambit hits a mark

(see, the X-Men Gambit has perfect aim and a stupid accent, which still makes him more interesting than Hawkeye; and of course I'm Mark and so is Marc)

With much appreciated help from Marc Feeley, got maintest running.

A couple of lessons: I very much think include paths should include the path of the main source doing the including. Chibi's default is correct, Gambit's default is wrong and requires fixing in every user program. It's "more secure", but if you're running source code from a directory, you can probably trust whatever else is in that dir.

main was frustrating: Gambit manual 2.6 (highlighting mine)

After the script is loaded the procedure main is called with the command line arguments. The way this is done depends on the language specifying token. For scheme-r4rs, scheme-r5rs, scheme-ieee-1178-1990, and scheme-srfi-0, the main procedure is called with the equivalent of (main (cdr (command-line))) and main is expected to return a process exit status code in the range 0 to 255. This conforms to the “Running Scheme Scripts on Unix SRFI” (SRFI 22). For gsi-script and six-script the main procedure is called with the equivalent of (apply main (cdr (command-line))) and the process exit status code is 0 (main’s result is ignored). The Gambit system has a predefined main procedure which accepts any number of arguments and returns 0, so it is perfectly valid for a script to not define main and to do all its processing with top-level expressions (examples are given in the next section).

So your code that looks fine with 1 arg will break with 2, depending on the version. (main . argv) works. I'm in the process of making sure every one of my maintests parses args consistently, and every Scheme disagrees.

Gambit's compiler worked very simply once I got the library on the command line; it doesn't seek out & include them the way Chez does, even though it takes what looks like a search path.

The upside of all this is at least now there's one maintained, fast, R7-compatible Scheme compiler. I'm sticking with Chez (R6) for my code, but it's nice having something 100x faster (gut feeling, not benchmarked) than Chibi to test R7 code on.

Gambit is a risky scheme

(puns about "scheme" names are mandatory)

Neat: New version 4.9.4 of Gambit Scheme is out and they have a web site again after like 3 years.

OK: So I start adapting my little module/how do you run example: here

Bad: Not only does the R7 library system not work, their version of this hello example
will load code from fucking github at runtime! NPM viruses & sabotage are baked into the system. See Modules in Gambit at 30

SIGH.

Haunted Dungeon early beta

Hey, it's a new and slightly more usable build (still Mac only) of the Haunted Dungeon! You can now use all the weapons & armor, eat & drink food & potions, might even make it down to floor 2 or 3!

Up in the next few days:

  • Tossing out items. I need to write a new event mode for selecting it, so I didn't feel like it today.
  • Levelling up. Right now you're doomed because you can't heal except by food & potions; or improve, except by very rare (and a long ways down) stat potions.
  • Start getting the actual story into the game. But only the first hints will be in the upper levels, since you can't get far anyway.
  • Main release on Halloween!

Probably next month:

  • Backpack for storing more items. One of the premises of this game is every item's a singleton, there's no stacking. So every item must be useful by itself, and item slot management is hard.
  • Ranged weapons have range.
  • Magic spells.
  • Elemental effects. It's already true that hitting some monsters with sharp or blunt weapons is better, but there's many more interactions when magic gets involved.
  • Much more dungeon dressing, I'm using Vexed's Demonic Dungeon art for that late-'80s, hi-res but low color count effect.

I'd love to get some feedback if it actually works on everyone's machine, because I'm doing some weird tricks to make it launch. As noted on itch, if it doesn't launch, or crashes, try looking at ~/Documents/haunted-dungeon.log, email me with that file.

The game's written in Scheme, running on Chez Scheme, with SDL2 from Thunderchez. Then I have an excessively complex Scheme script that compiles it, and builds a .app structure for Mac, and should also make Linux & Windows builds on those platforms (or in a VM, which is how I do it); been a while since I tried those, but once this is solid I'll include those.

I normally discuss ongoing projects on fediverse, @mdhughes@appdot.net

Script the Scheme REPL with Expect

Routinely I want to open the Chez Scheme REPL in my code dir and load my standard libraries; I've been copy-pasting from a Stickies to get my setup each time, because you can't easily set a common prelude from command line. Finally solved that.

In ~/bin/scheme-repl, I put:

#!/usr/bin/env expect -f
log_user 0
cd "$env(HOME)/Code/CodeChez"
spawn scheme
expect "> "
send -- "(import (chezscheme) (marklib) (marklib-os)"
send -- "  (only (srfi s1 lists) delete drop-right last)"
send -- "  (only (srfi s13 strings) string-delete string-index string-index-right string-join string-tokenize) )\n"
log_user 1
interact

(make sure to change the path to wherever you keep your Scheme scripts, and whatever imports you like)

Added alias s=scheme-repl to my .zshrc

Now I can just hit one letter for shortcut:

% s
(import (chezscheme) (marklib) (marklib-os)  (only (srfi s1 lists) delete drop
-right last)  (only (srfi s13 strings) string-delete string-index string-index-r
ight string-join string-tokenize) )
> (os-path 'pwd)
"/Users/mdh/Code/CodeChez"
>

You can sort of do the same thing with a Chez boot file, but I wasn't able to get it to load libraries from thunderchez, even with --libdirs flag, so screw it.

I'd forgotten everything I ever knew about expect, and the only resources online are exact copies of the same "log into ssh with expect!" (which you should never do! Set up SSH keys for Cthulhu's sake!) tutorial over and over again, so had to read the man page to make even this trivial thing work.

Death to Freenode, Long Live the New Flesh^W^W Libera Chat

So, on Tuesday, Freenode IRC blew up: FAQ
This is where a lot of software development chat happens. So for a rich, Trumpian, bitcoiner, Korean royalty, asshole to take it over by treachery is just unacceptable.

And so the staff and users have moved over to Libera Chat — as of today, it has more online users than Freenode.

Most of the channels I'm in have moved quickly, so I shut off Freenode this morning. If you need me, I'm in and others, as mdhughes.

A few usage & system bot notes:

  • Staff info channel:
  • NickServ: /msg nickserv help
  • ChanServ: /msg chanserv help
  • Channel List Service: /msg alis help list
  • Cloak: join -cloak and /topic