| # NetHack with Qt interface ## version 1.0.1 (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.1:

- Now also available for Windows 95 and Windows NT
- Use XPM rather than PPM files
- Use Qt 1.40beta (snapshot releases) image smooth-scaling to allow arbitrary tile scaling
- Diskspace usage reduced from 6.0M to 2.1M
- QT_TILEWIDTH and QT_TILEHEIGHT in .nethackrc
- Icons and window captions

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:

- Tiles (graphics) in the inventory and other item-menu windows.
- The player cursor changes colour as your relative hit-points drop.
- The message window greys-out older message.
- The item menus allow a count (click to left of icon - hidden feature).
- Icons for the major attributes and player states.
- Menus (only needed by newbie dungeon fodder).
- Variable size fonts and tiles.
- More space for the map as messages and status are side-by-side.
- You rarely need to put the mouse in a pop-up to interact with it.
- Macros - hidden feature - F1=multi-rest F2=multi-search F3=try-it
- It is much easier to code, so new feature-requests are more easily done.
- Sound support

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

Two binaries are supplied:

- Statically linked QtNetHack 1.0.1
  - Requires no Qt libraries.
  - Easy, but uses more memory (2.7M rather than 1.2M).
- Dynamically linked QtNetHack 0.93
  - Can be used with the stable Qt 1.32 and 1.33 releases.

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 1.0.1, static

For this version, simply install this package by typing (as root or look here):

      cd /
      tar xfvpz .../qnethack-3.2.2.1.0.1.bin.Linux.static.tar.gz

This binary also includes version 0.9 of the fabulous Wizard Patch from Larry Stewart-Zerba.

#### Qt NetHack 0.93, dynamic

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

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

Note that this is a former version of Qt NetHack provided for those not wishing to use a big static binary or to use a snapshot Qt. I would rather not have bug reports for this version.

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

      cd /
      tar xfvpz .../nh3.2.2qt0.93Linux-ELF.tar.gz

This binary also includes version 0.8 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!

### 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.9 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 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.1. You will need the latest snapshot release of the Qt library (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 my source code from the `win` subdirectory of your installation:

    	cd win
    	gunzip .../qnethack-3.2.2.1.0.1.src.tar.gz
    	tar xf .../qnethack-3.2.2.1.0.1.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
    	(or patch -p0 -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.9) are in the `win/Qt/` of the distribution. 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):

- `include/config.h`
- `include/unixconf.h`
- `unix/Makefile.src`

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`.

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:

- Redraw bugs fixed
- `.nethackrc` can now have:
  `QT_FONTSIZE=large`
    To set the font size
  `QT_TILESIZE=large`
    To set the tile size This is obsolete - use QT_TILEWIDTH/QT_TILEHEIGHT
  (thanks to Svante Gerhard)
- Tested with Qt 1.3x

#### Version 0.7:

- Allow out-of-focus string inputs (no need to move the mouse)
- Compiles with Qt 1.0
  - Fixes occasional redraw problems
  - "string" vs. "text" problem fixed

#### Version 0.6:

- Fix crash on save-bones (again, properly this time)
- Add USER_SOUNDS support
- Beeping in Linux binary too.

#### Version 0.5:

- Compiles with Qt 0.99
- Beeping
- Various bug fixes
- Wizard Patch included in Linux binary

#### Version 0.4:

- Source code now patches over standard NetHack 3.2.2 source distribution.
- Checked to compile with Qt 0.97 (no changes required).

#### Version 0.3:

- Source code now patches over standard NetHack 3.2.0 source distribution.
- Bug fixes
  - Two missing help windows now show up.
  - Crash on exit with bonesfiles fixed.

#### Version 0.2:

- Current armour, weapon, amulet, and rings shown in status area.
- Automatic geometry, based on root window size (unless user-specified).
- Automatic font size and tile size, based on geometry.
- Highlighting changed stats (as per X11/Xaw interface). The stats are highlighted for 2 moves. Should this be user-configurable?
- Redraw more efficient when many things moving (eg. when using ESP).
- Yes-no-type prompts now appear in the message window, similar to the X11/Xaw `slow' option. This is configurable in the source. Let me know if you prefer pop-ups, and I'll consider making it user-configurable.
- Bug fixes
  - `Virtual memory exceeded in new' bug fixed.
  - Excess memory usage by text windows fixed.

#### Version 0.1:

- Initial version.