NetHack with Qt interface

version 1.0.2
(for NetHack 3.2.2)

by Warwick Allison

warwick@troll.no

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's new?

Version 1.0.2:

old changes...

What does it look like?


(click for larger version)

Where do I get it?

Currently, a Linux binary and a Windows 95/NT binary are supplied, but since all the sources for Qt are available under X11, any platform running X11 should be able to run Qt NetHack - see the compilation instructions below.

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 under X11. 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 enables this feature - see include/config.h once you have applied the patch, and look for USER_SOUNDS for an explanation of how to disable it if you want to.

You will also want to collect some sound samples to try it out, and a .nethackrc attaching them to messages. This package contains the .au files that I use, and my ~/.nethackrc. Many of the sounds are from the nhsound package, which you can find referenced on the NetHack Home Page. Note: Nethack runs as the user games, so be sure that user can read your ~/.nethackrc or it will be ignored.

Installing a Linux binary

Supplied binaries:

Follow the instruction in one of the following section, and 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.

Qt NetHack

To install this version, you first need to install the libraries of the Qt toolkit. QtNetHack requires the latest stable Qt version.

Install Qt and test that it works (eg. build the example programs) before proceeding.

Note that since nethack runs setuid, you must list the Qt lib directory in /etc/ld.so.conf, or the equivalent on your platform, as the dynamic linker will refuse to honor $LD_LIBRARY_PATH for security reasons.

Install this package by typing (as root or look here):

  cd /
  tar xfvpz .../qnethack-3.2.2.1.0.2.bin.Linux.tar.gz
This binary also includes version 0.95 of the fabulous Wizard Patch from Larry Stewart-Zerba.

No root access?

If you don't have root access to your Linux machine, you can still install Qt NetHack by:
  cd somewhere
  tar xfvpz .../whichever.tar.gz
  vi usr/games/nethack
Edit HACKDIR=blah/nethackdir to point to somewhere you have write-access to, eg.:
     HACKDIR=$HOME/lib/nethackdir
Move usr/games/lib/nethackdir to wherever you said above, eg:
  mv usr/games/lib/nethackdir $HOME/lib
Move usr/games/nethack to somewhere in your $PATH, eg:
  mv usr/games/nethack $HOME/bin/nethack
Done!

KNethack

To install this version, you first need to install KDE - see www.kde.org, or contact your Linux distributor to ask for it to be distributed as a standard part of your operating system.

Install this package by typing (as root or look here):

  cd /
  tar xfvpz .../qnethack-3.2.2.1.0.2.bin.Linux.tar.gz
This binary also includes version 0.95 of the fabulous Wizard Patch from Larry Stewart-Zerba.

No root access?

If you don't have root access to your machine, you can still install KNethack by:
  cd ~/.kde
  tar xfvpz .../whichever.tar.gz
  cp -r opt/kde/* .
  rm -r opt
  vi share/applnk/Games/knethack.kdelnk
Edit Exec=blah to be:
    Exec=.kde/bin/knethack -d .kde/share/apps/knethack -caption "%c" %i %m
Done!

Installing the Windows 95/NT binary

Run this self-exracting archive to extract Qt NetHack to the top level of one of your drives (eg. C:\). You will then have a program \games\qnethack\nethack.exe This binary also includes version 0.95 of the fabulous Wizard Patch from Larry Stewart-Zerba.

The Windows 95/NT Qt NetHack binary uses exactly the source code provided for the X11 version (of course, it uses the Win32 nethack main engine code, not the Unix code). The recompile, you will need a C++ compiler for Windows 95/NT such as Visual C++, Borland C++, Symantec C++, or Watcom C++, and a professional Qt license.

Installing via Source Code

If you want, you can use the source code to build Qt NetHack 1.0.2. You will need to install Qt 1.40 (see www.troll.no), and you will need to install the full sources of NetHack 3.2.2

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

	cd win
	gunzip .../qnethack-3.2.2.1.0.2.src.tar.gz
	tar xf .../qnethack-3.2.2.1.0.2.src.tar
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
	(if that fails, try patch -p0 -s < win/Qt/nhqt.patch
	 or patch -p1 -s < win/Qt/nhqt.patch )
This will reconfigure the standard NetHack sources to be able to build a Qt version. Patches to configure for Linux, and the Wizard Patch (version 0.95) are in the win/Qt/ of the distribution. For other operating systems, you will probably need to edit the following files, just as you would have to when 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.

To enable KDE support, install KDE, then see the Makefile.src (copied to src/Makefile when you setup) and look for "KDE". Make the prescribed changes and then from the top-level, type:

	make kdeinstall

If you make any changes, then 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.

Compiling for Windows 95/NT is similar, but follow the instructions in sys/winnt/Install.nt

THANKS!

Thanks to the NetHack DevTeam for the greatest game ever made; and of course, thanks to my employer Troll Tech for the Qt I used to write the interface!

What's old

These used to be "What's New".

Version 0.93:

Version 0.7:

Version 0.6:

Version 0.5:

Version 0.4:

Version 0.3:

Version 0.2:

Version 0.1: