Who

Ultrarogue

In 1986, I nearly failed out of college because I spent so much time playing
urogue.

That’s not the game’s fault, of course. No doubt if it wasn’t urogue it would
have been some other addictive little distraction that I found more
interesting than my classes. But nonetheless, urogue (“UltraRogue v 1.03”),
Herb Chong’s little creation, was my bete noir, and so it has always
maintained a barren little corner in my heart. If you haven’t played it
yourself, that’s not surprising. In the decades-long legal battles over who
owned Unix, all of the rogue games became part of the collateral damage. There
were a number of versions of the game, all descended from the original
AT&T rogue, with varying names: UltraRogue. Advanced Rogue. SuperRogue.
XRogue. You can think of them all as simply being “rogue, with More Stuff.”
Their legal status was uncertain. Even the people who owned them didn’t really
know whether distribution of them was OK.

The Game

Rogue, for those of you not familiar with it, is a text-based non-real-time
role playing game. Your avatar on screen is a little at-sign, “@”, who
wanders around a crudely-drawn dungeon whacking monsters, represented by
letters, on the head. Along the way your avatar will find magic scrolls,
strange potions, magic rings, and the like. Your ultimate goal is to find that
fabled artifact, the Amulet of Yendor.

UltraRogue (and friends) add More Stuff to this, such as character classes, so
you can be a magic-user, or priest, or fighter. They add a much larger group
of monsters, including greater gods and demons who are greedy for mithril and
might summon you at a moment’s notice. They add stores, where you can buy
equipment. They add more and different types of equipment, and more artifacts
in addition to the Amulet.

Compared to today’s rogue-like games (Nethack, Angband, Diablo) the dungeons
are simple; every level may have at most 9 rooms. Picture a tic-tac-toe board.
Every section of the board might have a room (or, possibly, a dead end). All
rooms are connected, although sometimes doors are hidden. This makes
progressing through the game mindless in an extremely satisfying way.

The difficulty curve goes from insanely easy to insanely hard somewhere around
level 20 of the dungeon. The deepest I have ever made it is to around level
50, collecting 4 artifacts along the way. It doesn’t particularly bother me
that I can’t “win”. Winning isn’t the point of playing. It’s like knitting.
You play it just because.

The Source Code

The code for all of the Rogue Plus More Stuff games was nearly identical.
Apart from subtle feature set differences, the main way you could tell you
were looking at one rather than another was by who had ripped off and thrown
away the AT&T TRADE SECRET copyright notice and replaced it with their
own names.

Nonetheless, in the 80’s I somehow ended up with the source code for both
urogue 1.03 and Advanced Rogue 5.8. In the mid-90’s, I ported both of them to
then-current versions of Linux and BSD Unix, mostly so that I could play them.

Porting them is somewhat painful. All of the function signatures were (of
course) K&R style, rather than ANSI C. They used ancient and long-obsolete
forms of varargs macros, and deprecated interfaces to curses, the screen
drawing package.

Perhaps the most evil portions of the code centered around save and restore.
UltraRogue didn’t really have data “structures” per se. They were more “data
vague suggestions”. Everything was a global. When you wanted to save the game,
the program found the top of the data segment (using sbrk(0)) and wrote the
entire data segment into a file.

Then when you restored later, the program read the file into memory and reset
the data segment pointer to point to the blob of garbage you had just read in,
using brk().

It is, in short, a minor miracle that save and restore ever worked at all,
even at the time they were written.

I rewrote the save and restore code and got it working. I replaced the
ridiculous memory management tricks with straightforward code that serialized
all the interesting things in memory onto disk. Then at restore time, you just
them back in in an orderly fashion. But it was still fragile, because I got
bored about halfway through serializing every one of the hundreds of globals
(per app), and decided to think of a better way to do it. What I eventually
settled on – but never got around to implementing, because I had a day job –
was that with about a day and a perl script, I could probably move all of
those globals on to the heap. Once you have things on the heap, the technique
of just dumping everything to a file and reading it back in again as a single
lump becomes more reasonable.

On a whim, I decided to write to Herb Chong, putative author of urogue, to see
if he’d let me release my patches to the ‘net. Surely, I shouldn’t be the only
person to enjoy this bounty? Could I release the source to keep these relics
alive?

And now, you can play them too. It appears that the Roguelike Restoration
Project has succeeded where I have failed,
in that they’ve manged to get clearance to distribute the source code. They’ve
also done a lot of the same cleanup that I did years ago. There’s still a lot
of work left for them to do (particularly in save/restore), but I’m planning
on offering them my changes. We’ll see how it goes.

They’ve made a number of changes to the urogue interface that I don’t like.
But I suspect that most of my irritation with the UI comes from the fact that
it’s not exactly like I remember, which presumably won’t matter to anyone
other than me. Their version of Advanced Rogue is actually much closer to my
Platonic ideal of urogue than is their version of urogue.