basically tech

16 Slash'EM on Linux: configure, install, setup and play

Tuesday 7th November, 2006

When I tell my World of Warcraft/EverQuest-playing friends that I play Slash'EM, they usually raise their eyebrows and give me a slightly condescending smile before going on to explain how they prefer 3D graphics, interaction, etc. The fact is that comparing WoW/EQ to Slash'EM is like comparing movies to books. Did you read the Harry Potter books? Did you then go and see the movies? Slightly disappointed? Not quite what you expected? Then you'll have an inkling of what I'm on about.

As with reading, some imagination is required. Compared to it's more modern peers, Slash'EM and its relatives are extremely challenging. If you get it wrong, your character dies. Sometimes your character will die in seemingly grossly unfair circumstances. And it's permanent, unlike in certain other games. C'est la vie. This game hasn't been designed to pander to the requirements of the "I want it all and I want it now" crew.

It's a bit sad that such a fine open source game is easier to install on Windows than it is to install onto many Linux systems. So, hopefully this article will address that issue.

What is Slash'EM?

Okay, a little bit of evangelising first. Slash'EM is variant of NetHack. If you need to ask what NetHack is ... well, let's just concentrate on Slash'EM for the time being.

"Slash'EM is a single-player roguelike computer game." What that means is that Slash'EM is a single-player role-playing computer game, much in the vein of Dungeons and Dragons, RuneQuest, Tunnels and Trolls, and the like. Within the game, your character is searching a dungeon for the legendary Amulet of Yendor.

Some traps are deadly!

Slash'EM has many extra features compared to "vanilla" NetHack. There are extra monsters, extra items, extra player classes, extra player races, special player class techniques, extra weapons, extra armour, extra rings, extra spells, extra wands, extra potions ... you get the idea. In addition, the main dungeon is longer, but Gehennom, the special region where the demon lords dwell (located underneath the 50 or so levels of the main dungeon) is shorter, with a special level for each demon lord. Some seasoned campaigners (Not me! Not me! Rob casts "protect from flames" spell) have complained that the NetHack Gehennom is too long and has huge, boring maze-like levels to tramp through before you can finish the quest.

Incidentally, Slash'EM stands for "Super Lotsa Added Stuff Hack - Extended Magic".

Some Slash'EM/NetHack players like to use console mode to play the game:

click to enlarge

I'm not like them. :) This is how I like to play:

click to enlarge

This is much more in the spirit of D&D. ;)

Configuration and installation

The instructions that follow are specifically for the current latest stable release of Slash'EM, version 0.0.7E7F2. I will present detailed instructions on how to install this version of Slash'EM with the GTK and TTY interfaces only, although hopefully the way I present this should make it quite easy to choose other interfaces. I am led to believe that the next release of Slash'EM is going to be significantly different in that the GTK interface will be split into a seperate package. The target system is a Linux workstation.

Compiling and installing Slash'EM is, unfortunately, not a straightforward task of running ./configure ; make ; make install. If it was, I imagine more people would be playing it. Some distros (notably Debian) do provide Slash'EM packages, and the Slash'EM team have provided source RPMs for Fedora Core 3. Of course, the Gentoo people have their own solution.

First, we need the source code for version 0.0.7E7F2. It can be obtained from Sourceforge. There is also a link on the Slash'EM home page.

In your directory of choice, you should now have a gzipped tarfile named se007e7f2.tar.gz. I have mine located in ~/download/slashem.

$ cd ~/download/slashem
$ ls -l

total 5105
-rw-r--r-- 1 rob rob 5218698 2006-11-02 12:30 se007e7f2.tar.gz

$ tar xzvf se007e7f2.tar.gz
$ ls -l

total 5106
-rw-r--r-- 1 rob rob 5218698 2006-11-02 12:30 se007e7f2.tar.gz
drwxr-xr-x 9 rob rob     488 2005-12-04 14:58 slashem-0.0.7E7F2

(If you wish to install anything other than just the GTK and TTY interfaces, I recommend you read slashem-0.0.7E7F2/sys/unix/Install.unx.)

$ cd slashem-0.0.7E7F2/sys/unix
$ chmod u+x setup.sh
$ ./setup.sh
$ cd ../../src
$ vi Makefile

I'm assuming the use of vi or vim as an editor. Please just substitute your text editor of choice.

Code which requires changing is displayed in red and code which has been changed, i.e. is the way we want it, is displayed in blue.

We are going to edit slashem-0.0.7E7F2/src/Makefile:

On line 34, change

   SHELL=/bin/sh
to
   SHELL=/bin/bash
(This is purely an optional change; I do it for completeness' sake.)

Uncomment lines 127 and 128, changing:

   # CFLAGS = -O2 -fomit-frame-pointer -I../include
   # LFLAGS = -L/usr/X11R6/lib
to:
   CFLAGS = -O2 -fomit-frame-pointer -I../include
   LFLAGS = -L/usr/X11R6/lib

If you're using xorg 7.0 or higher, change the LFLAGS variable you just uncommented on line 128 from:

   LFLAGS = -L/usr/X11R6/lib
to:
   LFLAGS = -L/usr/lib

We also need to comment out the default CFLAGS and LFLAGS variables on lines 147 and 148. Change:

   CFLAGS = -O -I../include
   LFLAGS =
to:
   #CFLAGS = -O -I../include
   #LFLAGS =

On line 190, change:

   WINGTKCONFIG=PKG_CONFIG_PATH=/usr/devel/lib/pkgconfig pkg-config gtk+-2.0
to match the correct pkgconfig path for your system. On mine, this is:
   WINGTKCONFIG=PKG_CONFIG_PATH=/usr/lib/pkgconfig pkg-config gtk+-2.0
(There should be a file named /usr/lib/pkgconfig/gtk+-2.0.pc or it won't compile.)

Comment out lines 294 and 295:

   # Use these declarations if you only want to support the TTY windowing system
   WINSRC = $(WINTTYSRC)
   WINOBJ = $(WINTTYOBJ)
should become:
   # Use these declarations if you only want to support the TTY windowing system
   #WINSRC = $(WINTTYSRC)
   #WINOBJ = $(WINTTYOBJ)

Uncomment lines 304 and 305:

   # GTK windowing system (only useful if not installing setuid or setgid)
   # WINSRC = $(WINTTYSRC) $(WINGTKSRC) $(PROXYUTLSRC)
   # WINOBJ = $(WINTTYOBJ) $(WINGTKOBJ) $(PROXYUTLOBJ)
should change to:
   # GTK windowing system (only useful if not installing setuid or setgid)
   WINSRC = $(WINTTYSRC) $(WINGTKSRC) $(PROXYUTLSRC)
   WINOBJ = $(WINTTYOBJ) $(WINGTKOBJ) $(PROXYUTLOBJ)

Uncomment line 339, and comment out line 340, so that:

   # WINTTYLIB = -lncurses
   WINTTYLIB = -ltermlib
becomes:
   WINTTYLIB = -lncurses
   #WINTTYLIB = -ltermlib

Comment out line 375:

   # Use this declaration if you only want to support the TTY windowing system
   WINLIB = $(WINTTYLIB)
so it looks like:
   # Use this declaration if you only want to support the TTY windowing system
   #WINLIB = $(WINTTYLIB)

And uncomment line 382:

   # GTK windowing system (only useful if not installing setuid or setgid)
   # WINLIB = $(WINTTYLIB) $(WINGTKLIB)
so it looks like:
   # GTK windowing system (only useful if not installing setuid or setgid)
   WINLIB = $(WINTTYLIB) $(WINGTKLIB)

Save the changes and exit the file.

As you went through the Makefile, you would have seen the huge range of options available to you. It's worth noting that we have been amending options for UNIX-like systems only, and that this source code supports options for building on Mac, OS/2, Windows and DOS.

We've got three more files to edit:

$ cd ../include/
$ vi config.h

Now we're editing slashem-0.0.7E7F2/include/config.h.

Remove the first set of comments from line 57, so that:

   /* #define GTK_GRAPHICS */      /* GTK Interface */
becomes:
   #define GTK_GRAPHICS       /* GTK Interface */

Set your account name to be the wizard. Change the entries on lines 202 and 205 from wizard to your username:

   #ifndef WIZARD          /* allow for compile-time or Makefile changes */
   # ifndef KR1ED
   #  define WIZARD  "wizard" /* the person allowed to use the -D option */
   # else
   #  define WIZARD
   #  define WIZARD_NAME "wizard"
   # endif
   #endif
should look something like
   #ifndef WIZARD          /* allow for compile-time or Makefile changes */
   # ifndef KR1ED
   #  define WIZARD  "rob" /* the person allowed to use the -D option */
   # else
   #  define WIZARD
   #  define WIZARD_NAME "rob"
   # endif
   #endif
Obviously, substitute your account name for "rob"!

What is the -D option? If you're the game administrator (traditionally named wizard on older UNIX systems) then you can use the -D option to start the game in debug mode. It may as well be you!

Me, a wizard?  No, I'm just the game administrator.

We may as well use the best compression available for our savegames. These settings are on lines 228-239. Change:

   #ifdef UNIX
   /* path and file name extension for compression program */
   # define COMPRESS "/usr/bin/compress" /* Lempel-Ziv compression */
   # define COMPRESS_EXTENSION ".Z"             /* compress's extension */

   /* An example of one alternative you might want to use: */
   /* # define COMPRESS "/usr/local/bin/gzip" */   /* FSF gzip compression */
   /* # define COMPRESS_EXTENSION ".gz" */      /* normal gzip extension */

   /* # define COMPRESS "/usr/bin/bzip2"   *//* bzip2 compression */
   /* # define COMPRESS_EXTENSION ".bz2"   *//* bzip2 extension */
   #endif
to:
   #ifdef UNIX
   /* path and file name extension for compression program */
   /*# define COMPRESS "/usr/bin/compress"*/ /* Lempel-Ziv compression */
   /*# define COMPRESS_EXTENSION ".Z"*/             /* compress's extension */

   /* An example of one alternative you might want to use: */
   /* # define COMPRESS "/usr/local/bin/gzip" */   /* FSF gzip compression */
   /* # define COMPRESS_EXTENSION ".gz" */      /* normal gzip extension */

   # define COMPRESS "/bin/bzip2"   /* bzip2 compression */
   # define COMPRESS_EXTENSION ".bz2"   /* bzip2 extension */
   #endif

Note that bzip, gzip, and compress often reside in /bin on many modern systems. Make sure you get the path right.

Uncomment #define DLB on line 249, changing it from:

   /*
    *      Data librarian.  Defining DLB places most of the support files into
    *      a tar-like file, thus making a neater installation.  See *conf.h
    *      for detailed configuration.
    */
   /* #define DLB */             /* not supported on all platforms */
to:
   /*
    *      Data librarian.  Defining DLB places most of the support files into
    *      a tar-like file, thus making a neater installation.  See *conf.h
    *      for detailed configuration.
    */
   #define DLB              /* not supported on all platforms */

Save your changes and exit slashem-0.0.7E7F2/include/config.h

$ vi unixconf.h

Now we're going to edit slashem-0.0.7E7F2/include/unixconf.h

We need to make some changes to lines 35-41.

   /* define any of the following that are appropriate */
   #define SVR4            /* use in addition to SYSV for System V Release 4 */
                           /* including Solaris 2+ */
   #define NETWORK         /* if running on a networked system */
                           /* e.g. Suns sharing a playground through NFS */
   /* #define SUNOS4 */    /* SunOS 4.x */
   /* #define LINUX */     /* Another Unix clone */
should become:
   /* define any of the following that are appropriate */
   /*#define SVR4*/            /* use in addition to SYSV for System V Release 4 */
                           /* including Solaris 2+ */
   /*#define NETWORK*/         /* if running on a networked system */
                           /* e.g. Suns sharing a playground through NFS */
   /* #define SUNOS4 */    /* SunOS 4.x */
   #define LINUX      /* Another Unix clone */

Another Unix clone, eh? Tsk. :)

On line 198, uncomment #define TIMED_DELAY, such that:

   /* #define TIMED_DELAY */       /* usleep() */
changes to:
   #define TIMED_DELAY        /* usleep() */

On line 213, change:

   #define MAIL                    /* Deliver mail during the game */
to:
   /*#define MAIL*/                    /* Deliver mail during the game */

For various reasons, I've never used mail delivery in-game. I understand that the process involves a mail daemon approaching to give you a scroll of mail. This is triggered by mail arriving in your system mailbox. You need to let Slash'EM know where to look for new mail by setting the MAIL variable. You could also set the MAILREADER variable so that Slash'EM can shell to it when you read the scroll. You can disable the mail daemon by turning off the mail option within the game, if you've enabled it in the source code. I won't enable it here, but if you want to experiment with it, that's fine, just leave it enabled. Have a read further down unixconf.h and see what your options are. In particular, note the MAILCKFREQ value on line 263.

Save your changes to slashem-0.0.7E7F2/include/unixconf.h and exit.

$ cd ..
$ vi Makefile

The final file we're going to edit is slashem-0.0.7E7F2/Makefile.

We're going to change a bunch of stuff from lines 20-30:

   GAMEUID  = games
   GAMEGRP  = bin

   # Permissions - some places use setgid instead of setuid, for instance
   # See also the option "SECURE" in include/config.h
   GAMEPERM = 04755
   FILEPERM = 0644
   EXEPERM  = 0755
   DIRPERM  = 0755
   VARFILEPERM = 0644
   VARDIRPERM  = 0755
should look like this:
   GAMEUID  = root
   GAMEGRP  = users

   # Permissions - some places use setgid instead of setuid, for instance
   # See also the option "SECURE" in include/config.h
   GAMEPERM = 0755
   FILEPERM = 0644
   EXEPERM  = 0755
   DIRPERM  = 0775
   VARFILEPERM = 0664
   VARDIRPERM  = 0775

This will give ownership of the data and executables to root, and allow members of the users group to save game files.

Next uncomment line 100

   # CNF_SHARE_DATND = $(CNF_SHARE_GTKND)
should look like:
   CNF_SHARE_DATND = $(CNF_SHARE_GTKND)

And finally, comment out line 104:

   CNF_SHARE_DATND =
should look like:
   #CNF_SHARE_DATND =

Just before we exit this particular Makefile, just scroll down to lines 42-52 of the file. You'll see the (default) locations of where the game is going to be installed.

The game directory is /usr/local/slashemdir. This is also the var directory, where the logfile and save directory are located and where the bones from previous unsuccessful attempts to retrieve the Amulet of Yendor are stored. (More on that later.) The final variable, the SHELLDIR, is where the slashem executable is stored (/usr/local/bin).

Save the changes you made to slashem-0.0.7E7F2/Makefile and exit the file.

Now we'll compile the code and install the game. You will require development software such as gcc, make and pkgconfig installed. You'll also need the development libraries for GTK+ and X11.

$ make all
$ su
# make install

Hopefully, you should have got through those three stages without any errors: the make all command should end with a Done. If not, please double-check the changes you made in the four files you edited. If it gets too messy, you still have the orginal source, so starting from scratch is always an option!

Lets quickly check that everything is where it should be. Exit from your su session first.

# exit
$ ls -l /usr/local/bin

total 4
-rwxr-xr-x 1 root users 1376 2006-11-03 12:25 slashem

$ ls -l /usr/local/slashemdir

total 14989
-rw-r--r-- 1 root users  166802 2006-11-03 12:25 Guidebook.txt
-rw-r--r-- 1 root users  108616 2006-11-03 12:25 credit.xpm
-rw-r--r-- 1 root users    1203 2006-11-03 12:25 gtkrc
-rw-r--r-- 1 root users    4875 2006-11-03 12:25 license
-rw-rw-r-- 1 root users       0 2006-11-03 12:25 logfile
-rw-r--r-- 1 root users  490566 2006-11-03 12:25 nhshare
-rw-r--r-- 1 root users  323835 2006-11-03 12:25 nhushare
-rw-rw-r-- 1 root users       0 2006-11-03 12:25 perm
-rw-rw-r-- 1 root users       0 2006-11-03 12:25 record
-rwxr-xr-x 1 root users    8094 2006-11-03 12:25 recover
-rw-r--r-- 1 root users   82274 2006-11-03 12:25 rip.xpm
drwxrwxr-x 2 root users      48 2006-11-03 12:25 save
-rwxr-xr-x 1 root users 2217727 2006-11-03 12:25 slashem
-rw-r--r-- 1 root users 8652347 2006-11-03 12:25 x11big3dtiles
-rw-r--r-- 1 root users 2888635 2006-11-03 12:25 x11bigtiles
-rw-r--r-- 1 root users  362616 2006-11-03 12:25 x11tiles

It might be worth a quick skim through the guide book!

$ less /usr/local/slashemdir/Guidebook.txt

Setup

Now we need to set up the game so that it starts the way we want.

First, lets see what happens if we just run slashem without any changes.

$ /usr/local/bin/slashem

click to enlarge

So far, so good. It's using the GTK GUI.

Create a character. I'm going to choose a human male neutral monk. Monks are tough, a good choice for a beginner (I'm not very good at this game, by the way :) ). I also like to choose wizards, but they are pretty weak to start with. Choose what you like, though.

click to enlarge

Next, you'll get a welcome screen.

click to enlarge

Read the welcome, close it. URGHH! What's this? What is this little d and $ sign? I don't want this! Mind you, look at the armour class: 2, pretty good for a level one character!

click to enlarge

Let's quit this game so that we can make some changes. You wouldn't normally use the quit option, since quit in Slash'EM means "quit playing with this character", and if you've just had a good run, you'll lose the character, plus all the progress and experience that character has.

While we're discussing exiting the game, please note that saving is not like saving in an FPS. It won't give you the option to return to the game, it will save your game where you are and exit.

Right now we want to quit. If you save, you'll end up with a save game which is not useable (a bug, I guess) in the big 3d tiles format. Furthermore, if you save, you will have a saved game file, and Slash'EM will not either use it or overwrite it, so you'll be unable to save any more games, so don't save the game.

(Note: this only seems to happen when starting new games using the GTK GUI, but starting them in TTY format. I'm not sure why. Once a game has been started using the big 3D tiles, saving then restarting in "pure" TTY, such as running it in an Xterm, doesn't appear to be a problem.)

If for some reason you end up with an unuseable saved game, just delete it before starting a new game:
$ rm /usr/local/slashemdir/save/<savefile>.bz2
where savefile is in the format user id + login name (with no spaces in between).

Now we need to create a .slashemrc file. Make sure you create it in the root of your home directory. Here's what mine looks like:

# ~/.slashemrc

OPTIONS=!autopickup
OPTIONS=name:Rob,catname:Miaow,dogname:Woof,horsename:Neigh
OPTIONS=color,hilite_pet,lit_corridor
OPTIONS=help,!news,mail,silent,time
OPTIONS=showexp,showscore,showweight

TILES=name:Small tiles,file:x11tiles
TILES=name:Big tiles,file:x11bigtiles,transparent
TILES=name:Big 3D tiles,file:x11big3dtiles,transparent,pseudo3D
OPTIONS=tiles:Big 3D tiles

If an option is preceded by an exclamation mark, then that turns off the option.

!autopickup means I don't want to automatically pick up everything I come across. I'd advise this since otherwise you'll be picking up the corpses of foes you've slain, chests full of treasure (rather than just the contents) and cursed items.

The various name options are self-explanatory. You start with a pet, normally a kitten or a puppy, (or a horse if you're a knight), and this just names them automatically for you.

I believe the color option forces colours on a pure tty interface.

The hilite_pet option (in graphical mode) draws a red box around your pet. It's useful to prevent you accidentally casting a spell on it.

lit_corridor shows corridor squares seen by by night vision or a light source as lit. For some reason the default is off.

The help option allows more information to be made available for objects which you look at.

!news suppresses reading the Slashem News file. If it's present, it gets presented at the beginning of the game anyway.

mail enables in-game mail delivery, assuming you enabled it when you compiled the software.

silent suppresses terminal beeps. I'm guessing this is a pure TTY mode only option.

time shows the elapsed game time in turns.

showexp, showscore and showweight shows (respectively) your accumulated experience points, your approximate accumulated score, and the weight your character is carrying. showscore doesn't seem to work with the GUI.

The various TILES options tell the game what tiles options there are available. The final option, OPTIONS=tiles:Big 3D tiles forces the Big 3D tiles to be used.

The intricacies of the ~/.slashemrc would probably require an entire article on it's own. If you search for slashemrc on google, you'll find loads of different examples.

If you're using one of the Slash'EM packages which comes with Debian, your ~/.slashemrc will not be recognised unless you set a $SLASHEMOPTIONS variable to point to it in your ~/.bash_profile, like this:

export SLASHEMOPTIONS=~/.slashemrc

I guess this must be one of those "Debian way" things. :)

We'll start the game again.

$ /usr/local/bin/slashem

click to enlarge

I'll start a new session as I did earlier.

click to enlarge

Some tips for Slash'EM that I wish I'd been told when I first started

  • Explore the menus. Most of the actions are in the Action or Special menus.
  • Use the numeric keypad to move around, it's much quicker than clicking Move then selecting North/South/whatever etc.
  • You can move diagonally.
  • If you come across a chest, stand on the same square as the chest, then check it for traps before looting it.
  • If a chest is locked, and you can't pick the lock or use magic to open it, you can always force the lock.
  • If a door is locked, and you can't pick the lock or use magic to open it, you can always kick it down.
  • If a corridor stops unexpectedly, search for a hidden passage.
  • If no exit to the next level down presents itself, try to figure out from the SlashEM radar where any hidden rooms might be located (the big black areas!) Search for hidden doors in the walls near to that area.
  • You can push boulders. Make sure you push them in the right direction!
  • Don't panic if you're losing a fight. This is turn-based game. Stop and try to think what you best course of action might be. Try running away. The next level up is usually safe, unless you're on the first level, in which case you'll be quitiing the game.
  • Remember to eat. As a rule of thumb, if your pet eats it, it's edible. Eat the next edible dead monster before your pet can get to it! Save any food rations for emergencies.
  • Before descending to the next level of the dungeon, make sure your pet is in a square adjacent to yours, or you'll leave him behind.
  • Remember, some items are cursed. Don't go wearing any old armour or using any old sword you find lying around. Your pet will shy away from cursed items, so watch how he behaves if the item is lying on the floor nearby.
  • Monks are good to start with for beginners.
  • If you insist on playing a wizard (hey, the offensive spells are a laugh!), then remember to rest in a safe place and recuperate your Mana (MP) before going exploring. Wizards can wear armour, but metallic armour will increase the chances of a spell failing - leather is a good compromise, dragon scale armour is the best, but you won't come across that for a long while! Save your wand for emergencies.
  • Drinking from fountains can bring great benefits. It can also cause terrible problems. You need to decide.
  • Humans can only see one square ahead in unlit corridors. Explore everywhere to make sure you really have all the corridors mapped out.
  • Expect to die many, many times. I have never managed to retrieve the Amulet of Yendor. :'(

Useful or interesting links

The Slash'EM Homepage
Differences Between Slash'EM And Nethack
Ali's Slash'EM Page
Ye Olde SlashEM Bestiary
LinuxDevCenter.com -- Slash'EM: The Sum of All NetHacks
LinuxDevCenter.com -- Slash'EM Interview
NetHack Home Page
Yet Another NetHack Site (Lots of spoilers, very useful for anyone who has an ambition to actually complete a game within a normal human lifespan)
Which NetHack Monster Are You?

Home