2022 TODO

No looking back. Burn our 2021 ships behind us. Forward is death or glory.

  • Ship Haunted Dungeon. Work on other games which are not CRPG/roguelike for a while.
  • Write more Scheme, maybe publish some of it. If Scheme's so efficient, why am I such a bum who can't ship?
  • Playtest & ship my new tabletop RPG.
  • Boardgames? I've been thinking about condensing some of my ideas into a more concrete, boardgame model. Print or software, I dunno yet.
  • Read more, watch less garbage/browse the web less. I didn't do too badly on reading in 2021:
    • Fujino Omori: Is It Wrong To Try To Pick Up Girls In The Dungeon light novel. I loved the anime, and played the mobile game for like 2 years, it's being adapted too slowly for my taste, so I read the books some. It's amusing easy-reader trash about JRPG fantasyland, and I don't care.
    • Tim Pratt: The Wrong Stars. Started on the sequel and it sucked, DNF.
    • Michael Warren Lucas: Drinking Heavy Water, Butterfly Stomp Waltz
    • Alastair Reynolds: Shadow Captain, Bone Silence, The Prefect, Elysium Fire, Beyond the Aquila Rift (had read several in earlier mags/collections, but many were "new"), Revelation Space, Redemption Ark. Look. I'm aware that's too many. But I want to read the new one, so I have to catch up and I'd forgotten everything in the RS setting.
    • Rudy Rucker: Million Mile Road Trip (been sitting on tsundoku for too long)
    • Neal Stephenson: Cryptonomicon (reread after 22 years). Dude, Neal used to be able to write a doorstop I liked reading.
    • Andy Weir: Project Hail Mary
    • Martha Wells: Fugitive Telemetry
    • random old pulps from the '40s-80s off archive.org. Complete Manly Wade Wellman in Weird Tales has been a nice trip, lot of Fritz Leiber and Roger Zelazny.
  • Top of my tsundoku:
    • Hannu Rajaniemi: The Quantum Thief
    • Alastair Reynolds: Absolution Gap, Chasm City, Inhibitor Phase and then I will be free! I might go a year or more without another Reynolds book oh sweet mother of fuck yes.
    • Rudy Rucker: Juicy Ghosts, have read the short story
    • Martin Gardner: The Last Recreations
    • Isaac Bonewits: Real Magic an Introduction (research for better game design!)
    • Black Magic Omnibus vol.1 & vol.2
    • Andrzej Sapkowski: Time of Contempt. I read up thru Blood of Elves a couple years ago (prompted by the TV show, yes), and keep picking up the next one and stopping. I dunno why, they're pretty similar to my D&D-type fantasy campaigns.
  • Do some more software & project maintenance. A lot of my stuff that I have in various places is either unmaintained, broken, or just unadvertised in any way. Might set aside one work day a week to this.
  • Actual contract work. I'm never going back to an office in my life. I should be #1 online earner, but I really can't be arsed to talk to recruiters, clients, get the job, and do it, a lot of the time. Probably should be slightly more than zero productive citizen.

TODO App

I'm yet again frustrated by the state of checklist TODO apps. I had a perfect one once, ToDo on the Palm Pilot; aesthetically it was of its time, but for usability on a stylus-based PDA it was perfect. Everything since then has been a compromise.

Must:

  1. Run locally on iPhone and Mac.
  2. Sync automagically, preferably with iCloud and/or Dropbox.
  3. Have multiple lists, though does not need nested folders.
  4. Show a list of items I can check on/off.
  5. Be able to show or hide checked items, delete checked items with a command.
  6. Be able to reorder by hand (or sort with a command).
  7. Start up instantly right back where I was.
  8. Be usable while drunk, stoned, tired, or hungry. UI cannot be a giant pile of fiddly little switches.

Nice to Have:

  1. Due dates/expire dates.
  2. Priority tags.
  3. Search screen to show "What's next?", showing date, priority, list, item in that order.
  4. Notifications. But local notifications require a recent app launch, so you might miss stuff; or interacts with calendar which many people find annoying; or uses push notifications, which costs real money past a small number of users.
  5. Emoji & color tags, photos, long notes, etc.

Must Not:

  1. Give my information to Google, Microsoft, Facebook, or other evil mega-corporation who will weaponize my shopping for killer drones or advertising, or both. I'm dubious of Apple & Amazon, but at worst they seem to be venal, not evil.
  2. Be subscription-based.

Don't Care:

  1. Other platforms. Android, Linux, Windows, I don't use these so they're not a pain point for me. If mulle-objc works out, I could think about that.
  2. Pomodoro, GTD, and other fetishistic rituals.

State of the Field

  • Clear was good on iOS, but it's been "dead"/rebooting at Impending for 2 years already, and they won't be making a new Mac version.
  • Apple's Reminders is awful on the Mac (try finding the "show all" button, and keeping your list in order).
  • Things, Trello, OmniFocus, etc. are too slow & heavy for a grocery list.
  • Text files in Editorial or Drafts don't have usable (finger-sized) checkboxes.
  • Wunderlist got bought by Microsoft and destroyed as per usual. They're getting to be as bad a product graveyard as Yahoo! was.
  • RememberTheMilk is not super useful until you pay $40/year, which is not what a dumb todo list should cost.

What Am I Doing?

Thinking about this. I could write the app I want, release it for $5 on each platform, use Marzipan to make it use the same codebase. In theory, this is pretty easy; I can write a database-backed table view thing in a week. Making it nice is a while longer. Marketing is my least favorite thing, who do I use to get it in front of millions of people?

But I'd have to pay Apple to get back into the sharecropping business, and deal with their shitty Xcode tools and the rotting corpse of developer.apple.com which got fucked over by Apple marketing so you can't get to the FUCKING DOCUMENTATION. @invalidname went to work for them and got sucked into the black hole.

Writing a Doorgame

So, how did I write this? Mystic BBS has a Pascal-based scripting, but I didn't really like using that; it's very powerful, but a pain in the ass to code/compile/test on, and it's just different enough from normal FreePascal to annoy me. And then tried to use Mystic's "integrated Python", which just doesn't work; I tried everything to make it find Python. And it's 2.7, so bleh. BUT: Adding a doorgame with the menu system lets you specify any executable, including a Python 3.7 script, and pass in a few command-line arguments about user and directories, so that's what I did (though the server I'm using only has Python 3.6, which hasn't been a problem yet, but be aware)…

The BBS handles all the redirection from network to stdin/stdout, otherwise I could use inetd for the same thing, but then I'd have to deal with all the login and networking state. Doing this as a door simplifies programming back to 1970s level!

I'll eventually open source it, but while I'm iterating and early on, I want to keep some of my secrets.

ANSI Color

There's ANSI color everywhere, of course. curses is fucking awful and archaic, and built to handle many incompatible terminals, which isn't a problem anymore. Mystic uses the same trick I'm using, and many others back in the day: Strings have escape codes |XX in them. Mystic uses numbers for colors, which is awful, and has hundreds of BBS-specific strings, which I have no need of. So all I did is this:

# set to 1200, 9600, etc. to simulate modem transmission rate
kModemSpeed = 0
kLinesPerScreen = 24

kAnsiEsc = "\x1b["

#      0   1   2   3   4   5   6   7   8   9   10
kAnsiBoxLine =  ["─",   "│",    "┌",    "┬",    "┐",    "├",    "┼",    "┤",    "└",    "┴",    "┘",]
kAnsiBoxDouble =["═",   "║",    "╔",    "╦",    "╗",    "╠",    "╬",    "╣",    "╚",    "╩",    "╝",]
kAnsiBoxHeavy = ["━",   "┃",    "┏",    "┳",    "┓",    "┣",    "╋",    "┫",    "┗",    "┻",    "┛",]

# ansiFilter, called by write/writeln, replaces |XX with escape codes:
kAnsiEscapeCode = {
    "CD": kAnsiEsc+"J",         # Clear Down
    "CL": kAnsiEsc+"2K",            # Clear Line
    "CS": kAnsiEsc+"2J"+kAnsiEsc+"H",   # Clear Screen
    "DI": kAnsiEsc+"2m",            # Dim
    "ES": "\x1b",               # Escape ASCII 27
    "GG": "\x07",               # Bell ASCII 7
    "HR": kAnsiBoxDouble[0] * 79,       # Horizontal Ruler
    "LI": kAnsiEsc+"1m",            # Light/Bright
    "PI": "|",              # Pipe char |
    "RE": kAnsiEsc+"0m",            # Reset Attributes
    "UN": kAnsiEsc+"4m",            # Underscore

    "FK": kAnsiEsc+"30m",           # Foreground Black
    "FR": kAnsiEsc+"31m",           # Foreground Red
    "FG": kAnsiEsc+"32m",           # Foreground Green
    "FY": kAnsiEsc+"33m",           # Foreground Yellow
    "FB": kAnsiEsc+"34m",           # Foreground Blue
    "FM": kAnsiEsc+"35m",           # Foreground Magenta
    "FC": kAnsiEsc+"36m",           # Foreground Cyan
    "FW": kAnsiEsc+"37m",           # Foreground White

    "LK": kAnsiEsc+"1;30m",         # Foreground Light Black
    "LR": kAnsiEsc+"1;31m",         # Foreground Light Red
    "LG": kAnsiEsc+"1;32m",         # Foreground Light Green
    "LY": kAnsiEsc+"1;33m",         # Foreground Light Yellow
    "LB": kAnsiEsc+"1;34m",         # Foreground Light Blue
    "LM": kAnsiEsc+"1;35m",         # Foreground Light Magenta
    "LC": kAnsiEsc+"1;36m",         # Foreground Light Cyan
    "LW": kAnsiEsc+"1;37m",         # Foreground Light White

    "BK": kAnsiEsc+"40m",           # Background Black
    "BR": kAnsiEsc+"41m",           # Background Red
    "BG": kAnsiEsc+"42m",           # Background Green
    "BY": kAnsiEsc+"43m",           # Background Yellow
    "BB": kAnsiEsc+"44m",           # Background Blue
    "BM": kAnsiEsc+"45m",           # Background Magenta
    "BC": kAnsiEsc+"46m",           # Background Cyan
    "BW": kAnsiEsc+"47m",           # Background White
}

def ansiFilter(s):
    """Replaces |XX codes with values defined in `kAnsiEscapeCode`."""
    out = ""
    slen = len(s)
    i = 0
    while i < slen:
        c = s[i]
        i += 1
        if c == "|":
            esc = s[i:i+2]
            i += 2
            out += kAnsiEscapeCode.get(esc, esc)
        else:
            out += c
    return out

def ansiGoto(pt):
    return "%s%s;%sH" % (kAnsiEsc, pt[1], pt[0])

def readln(prompt):
    """Calls input after filtering prompt."""
    return input(ansiFilter(prompt))

def write(s, end=None):
    """Filters `s` and writes to stdout, writes `end` if needed, flushes stdout."""
    if type(s) != str:
        s = str(s)
    lines = 0
    out = ansiFilter(s)
    for c in out:
        sys.stdout.write(c)
        if kModemSpeed:
            time.sleep(1.0/kModemSpeed)
        if c == '\n':
            lines += 1
        if lines >= kLinesPerScreen:
            readln("|RE|FC[MORE]|RE")
            lines = 0
    if end:
        sys.stdout.write(end)
    sys.stdout.flush()

def writeln(s):
    """Calls write with `end='\n'`."""
    write(s, end='\n')

Now if I want someone to talk in bold cyan (which I chose as my standard NPC color), I just
writeln("|RE|LC%s says, \"Mellow greetings, sir!\"|RE" % (npc["name"],))
RE before and after text is important, resetting colors from previous strings.

The one problem is I can't use | in ASCII art, so to generate my big character logos, I write a script mysticFiglet.zsh, making : the vertical char:

figlet -f small "$*"|sed "-es/|/:/g"

Flow Control

The great part about a doorgame is, no event loop. Oh, there's a REPL of sorts:

    def run(self):
        self.running = True
        try:
            #TODO: Python 3.8: while line := self.prompt():
            while self.running:
                line = self.prompt()
                if line == None:
                    break
                words = line.split()
                if len(words) == 0:
                    continue
                self.parseWords(words)
            self.save()
            self.doHelp("?", "_outro")
            return 0
        except (EOFError, KeyboardInterrupt):
            self.save()
            return 0
        except Exception:
            writeln("|GG|RE|BR|FWERROR! Something went wrong.|RE")
            logging.error("", exc_info=True)
            self.save()
            return 1

It just blocks at input (called by readln, called by prompt), and continues on until self.running = False, or an exception is thrown. Whee! The usual game loop makes it impossible to get stateful input without leaving giant memos of current state, so the event loop can keep cycling at 60fps.

Data Files

One solution would be to just make everything in classes, and use Python's pickle to archive everything. But the problem is that's pure binary, you can't easily hack on it or see what's happened, and on load you can't change any values. So instead I only use primitive types and archive everything to and from JSON. Floor maps and Players have a toData() method which produces a JSON-compatible data structure, and their initializers take a data structure and pull out or translate the values they need. It's a little more work, but means I can debug faster and add new fields faster.

The floors use a super-simple data file format, with an ASCII roguelike map and a series of command lines to create NPCs, traps, text, etc. The weapons and armor are listed in an even simpler format, with space-delimited fields.

Both the command lines and item formats are just run thru a tokenizer I wrote, that reads words, "strings", numbers, and [lists]:

type    name        cost    stat    bonus   damage  inflicts    twoh
wpn "Club"      5   Str 0   3   [blunt]     0

becomes:

{'type': 'wpn', 'name': 'Club', 'cost': 5, 'bonus': 0, 'damage': 3, 'inflicts': ['blunt'], 'twoh': 0}