QZ qz thoughts
a blog from Eli the Bearded
Page 2 of 146

Roguelike


A few weeks ago I read an article at Ars Technica on the history of roguelike games. It certainly brought back memories.

Sometime, probably in 1993 or 1994, I found and got very into playing Moria, one of the major early roguelikes. I've played that game on a variety of computers and computing devices over the years. It was the impetus for learning how to write keyboard marcros for me in the mid-1990s. I delved into the code in the late 1990s and early 2000s. My personal version (with a very lame webpage) has a targeting patch, for more accurate spell / thrown object attacks, which I didn't write but found and applied, plus changes to the map generation that I did author. There might be other changes in there that I don't remember.

The Magic Missile strikes the Giant White Mouse.  -more-
                                                             ############ #
Elf                ##########                                           # #
Mage               #        #                                           # #
Apprentice         # ###### #                             ############### ###
             ####### #    # ###############################.........rrr##   ###
STR :      6         #    #                      '       .@..........rr#### ##
INT :  18/59 #########    ##########       :     ##########.........rrr#  # ##
WIS :     13                    #### #   #########        ########.#####  # ##
DEX :     14                #####    #                                    #
CON :      9                #     ####                                    ###
CHR :     17                # #%##%                                         %
                       %#%%%%.%%####%#%                                    %%
LEV :      2           %..............%%%#%%%%%                           %%
EXP :     21           #..............'   ' ' % %                         # +
MANA:      5           %..............#%#%%#%   #                         % #%%
CHP :     14           ....!..........#       # ##################+#####%## #
                       #..............#       #                    '        %
AC  :      9           ################       ########################%###%##
GOLD:      1

                                                                 50 feet

Yikes! That's a lot of mice for a level two character to face. Those guys breed fast.

{"Giant White Mouse"        ,0x0020000AL,0x00000000L,0x2072,    1,  20,
   8,   4, 11, 'r', {1,3}   , {25,0,0,0}                ,    1}

The Giant White Mouse in code form. 0x0020000A: 0x00200000 "explosive" breeder, 0x00000008 20% random movement, 0x00000002 normal move and attack; 0x00000000: knows no spells; 0x2072: 0x2000 can be seen with infra vision, 0x0070 hurt by fire, frost, and poison, 0x0002 hurt by slay animal. It is worth at most 1 xp; tends to sleep a lot; but can notice the player from 8 squares away; has an armor class of 4; moves at speed 11, out of a range of 9 to 13; is shown with letter r; starts out with 1d3 health; has only one attack, #25 in that table (which is {1,2,1,2}: a normal attack, described as "bites you", that does for 1d2 damage); and is typically found on dungeon level 1.

I also played it extensively on an early Palm Pilot. No keyboard on that, you had to use a stylus to scribble special shorthand in to enter letters. A novel input system at the time, but it certainly changed mcb to cast the second spell from the third spell book into more of an adventure. But it allowed me to play the game on the go. My daughter was born in the early 2000s and my wife was attending graduate school at the time. I frequently would have an afternoon hour or two in a car with a napping baby waiting for my wife to finish a class. Moria on the go was just the thing.

A decade or so later I got a PocketCHIP hackable computer. The "CHIP" part of it was designed as a Raspberry Pi alternative better suited for embedding in portable hardware. The goal was (a) under ten bucks, (b) built-in storage, (c) built-in bluetooth and wifi. This way you could add $20ish in other parts and have a product you could reasonably expect to retail at $90 to $100. Raspberry Pis at the time were $25, with no built-in storage, blue tooth, or wifi but did have built-in HDMI and ethernet, better for non-portable uses like living behind your TV. Anyway, the "Pocket" part of the PocketCHIP is an add-on board that includes a battery, touchscreen, and keyboard, and was at least partially aimed at being a portable hackable game system. It has a terrible keyboard and a small display, but it does score high on hackable. (The company went out of business, but you can still find new-old-stock on ebay.) Discussion about the system on the official forums went to roguelikes, and I tried Moria. It didn't work because Moria is strongly tied to an 80x24 screen, but then I remembered the Palm version got around that. I tracked down the Palm version source code and started to patch Moria for PocketCHIP sized screens. I never worked all the bugs out before someone else found a way to get 80x24 with an alternative terminal program. That was the last time I delved into Moria source.

There doesn't seem to be a Moria port for Android, although it is playable in Termux. The virtual keyboard play method is even less fun / forgiving than the "Graffiti" shorthand of PalmOS, so that's not a lot of fun. The comments on Ars Technica article pointed to a well-liked roguelike game developed specifically for Android, Andor's Trail which, while still an incomplete game, is rather fun to play.

Gornaud mines battle
You are affected by Weak Poison (2 rounds)
Scaled venomfang hits you for 0 hp!
Your attack misses
    {
        "id":"scaled_venomfang",
        "name":"Scaled venomfang",
        "iconID":"monsters_snakes:3",
        "maxHP":35,
        "maxAP":10,
        "moveCost":5,
        "monsterClass":"reptile",
        "attackDamage":{
            "min":2,
            "max":4
        },
        "spawnGroup":"gornaud_2",
        "droplistID":"cave_serpent",
        "attackCost":3,
        "attackChance":150,
        "blockChance":90,
        "damageResistance":2,
        "hitEffect":{
            "conditionsTarget":[
                {
                    "condition":"poison_weak",
                    "magnitude":1,
                    "duration":2,
                    "chance":"50"
                }
            ]
        }
    }

It's open source and I've perused some of the source. JSON data structures for items and monsters are so much different (notably verbose, thus faster to read) from the C struct tables of Moria. I'm still not sure how the quests actually work, although I have seen the data structure for how quest messages and NPC dialog for quests is stored.

It makes me want to write a new game again. I've long thought about forking Moria into a different game with a more modern setting. I have a rough idea of the code modernizations I'd like to apply.

  • Remove the excess of #ifdef for compiling on various non-Unix systems and similar #define messiness.
  • Track monsters individually allowing them to have actual inventory and preventing monster overflow (the "Compacting monsters" message).
  • Make level generation predicable for a given game, so that you always have the same places. Right now only level 0 is predicatable.
  • Greatly curtail mining, because not-a-mine anymore.
  • Greatly expand the use of "traps" to move between maps. Moria currently uses staircases up and down to move between levels, and traps to implement entering stores.
  • Allow stores to use more screen space if available. Increase store inventory.
  • Enable function pointer callbacks on items and monsters for rare special effects. Enable function pointer callbacks on traps for map movement.