NetHack with Qt interface

version 0.7
(for NetHack 3.2.1)

by Warwick Allison

warwick@cs.uq.edu.au

What's new?

Version 0.7:
Version 0.6:
Version 0.5:
Version 0.4:
Version 0.3:
Version 0.2:
Version 0.1:

What is it?

NetHack is a Free graphical one-player roleplaying game with a highly modular window system interface supporting TTY, VGA, Mac, Amiga, and other displays. Qt is a graphical user interface toolkit. So, "NetHack with Qt interface" is a version of NetHack which has a user interface module written using the Qt toolkit.

What does it look like?


(click for larger version)

How is it better than the plain X11 interface?

The Qt interface has these extra features:

The standard NetHack X11 interface is written in C using the Athena Widgets toolkit. The strongest reason for doing it that way was that NetHack is one of the most incredibly portable programs of any kind, and the Athena Widget Set is also available for free on a large number of X11 implementations. The problem is that Athena Widgets (also known as Xaw) is very ugly, difficult to program in, and buggy. The Qt interface toolkit on the other hand is written in C++ and is freely portable to any X11 implementation, but is less widespread, making it inappropriate for the standard NetHack X11 interface.

Sound support

The QtNetHack patch includes experimental support for sounds to be played based on messages. For example, you can arrange for a gong to sound when the message "... cursing shoplifter..." appears. The system maps any regular expression (can be just some text) to a sound. The QtNetHack windowport is the only one providing this method, and it does so using the NAS (Network Audio System) . As distributed, the patch does not actually enable this feature - see include/config.h once you have applied the patch, and look for USER_SOUNDS for an explanation of how to enable it.

You will also want to collect some sound samples to try it out. You might want to start with the nhsound package, which you can find referenced on the NetHack Home Page. I'm not sure what format the files come in in that package, but you should be able to convert it if needed to one of the many sound formats supported by NAS.

If you do use the sound support, please let me know, as I am still wondering whether to bother with it. I find it very helpful to the game (eg. when I `feel feverish', I sound a dire warning, so I don't accidentally miss that vital message).

Where do I get it?

Currently, only a Linux version is supported by me, but since Troll Tech have made the awesome move of providing all the sources for Qt under X11, any platform running X11 should be able to run Qt NetHack - see the compilation instructions below.

First, you need to install the libraries of the Qt toolkit. Note that in general, I use the latest version of Qt, and that is what you should have installed to run QtNetHack. They are available from Troll Tech's FTP site. For the Linux binary version, you actually only need the binary Qt libraries to be installed, but I recommend you get the full package if you are at all interested in writing programs.

Then, you just install this package by typing (as root):

  cd /
  tar xfvpz <wherever-you-put-the-file>/nh3.2.1qt0.7Linux-ELF.tar.gz
You will then have a program /usr/games/nethack (which can usually be run just by typing "nethack"). Note that this will overwrite any previous version of NetHack, as the package places everthing in the standard NetHack directories. Also, it includes the fabulous Wizard Patch from Larry Stewart-Zerba.

To make the game just how I like to play it, create a file in your home directory called .nethackrc and include the following lines there:

#
# Nethack configuration file.
#
OPTIONS=number_pad,menu-style:partial,noautopickup,showexp,time,hilite_pet,toptenwin,name:player

Installing via Source Code

If you want, you can use the source code. You will need the full source of the Qt library, and you will need to install the full sources of NetHack 3.2.1 Also, you must have the NetPBM utilities installed on your system during compilation. NetPBM is available from many places (such as wu-archive) and for many operating systems. In the extreme case that you cannot get them working, you could copy the files from the binary distribution above - wait for the make to fail, then copy the file in by hand - you're on your own with this bit.

Install the NetHack sources, as described here. then unpack my source code from the win subdirectory of your installation:

	cd win
	tar xfz ../../nhqt0.7.tar.gz
In the created Qt subdirectory, you will find a patch file. From the top-level of the NetHack source directory (ie. above the "win" directory where you did the unpacking), type:
	cd ..
	patch -s < win/Qt/nhqt.patch
This will reconfigure the standard NetHack sources to be able to build a Qt version. You will probably want to edit the following files, just as you would have to for installing any NetHack version, to configure NetHack for your operating system (the default is SunOS4): Don't worry, you'll only have to change a few obvious things. If you have problems, I suggest you try to get the X11 version working for your system prior to attempting the Qt version.

You will then have to go to the sys/unix subdirectory and run the setup.sh script and finally run "make install" from the top-level (these steps are required for any Unix build of NetHack):

	cd sys/unix
	./setup.sh
	cd ../..
	make install
After some time, you will have a compiled game for your system. Consider packaging up the binary and uploading it to an FTP site appropriate for other users of your system, but please try to stay up-to-date with my new releases if you do so. As distributed, all files are in the directory /usr/games/lib/nethackdir, plus the script /usr/games/nethack.

Finally, if you make any changes, then please send them to me so that they can be in future releases. Eventually I hope to incorporate the Qt interface into the official NetHack distributions.