glhack(6) Exploring The Mazes of Menace


glhack [options]

glhack -s [options]


glHack is a port of the game NetHack, using hardware acceleration via OpenGL(R) to render the 2D tile graphics. It uses LibSDL as the video and input library. There is good support for software rendering as well.

NetHack is a display oriented Dungeons & Dragons(tm) - like game. The standard tty display and command structure resemble rogue.

To get started you really only need to know two commands. The `?' command will give you a list of the available commands (as well as other information) and the `/' command will identify the things you see on the screen.

To win the game (as opposed to merely playing to beat other people's high scores) you must locate the Amulet of Yendor which is somewhere below the 20th level of the dungeon and get it out. This is not an easy feat!

When the game ends, whether by your dying, quitting, or escaping from the caves, glHack will give you (a fragment of) the list of top scorers. The scoring is based on many aspects of your behavior, but a rough estimate is obtained by taking the amount of gold you've found in the cave plus four times your (real) experience. Precious stones may be worth a lot of gold when brought to the exit. There is a 10% penalty for getting yourself killed.


These are the standard options that NetHack supports.
-u playername
This option supplies the answer to the question "Who are you?". It overrides any name from the options or configuration file, the USER orLOGNAME shell variables, or getlogin(), which will otherwise be tried in order. If none of these provides a useful name, the player will be asked for one. Player names (in conjunction with uids) are used to identify save files, so you can have several saved games under different names. Conversely, you must use the appropriate player name to restore a saved game.

A playername suffix can be used to specify the profession, race, alignment and/or gender of the character. The full syntax of the playername that includes a suffix is "name-ppp-rrr-aaa-ggg". "ppp" is at least the first three letters of the profession (this can also be specified using the -p option). "rrr" is at least the first three letters of the character's race (this can also be specified using the -r option). "aaa" is at least the first three letters of the character's alignment, and "ggg" is at least the first three letters of the character's gender. Any of the suffix parts suffix may be left out.

-p profession
This can be used to determine the character role. You can specify either the male or female name for the character role, or the first three characters of the role as an abbreviation. `@' and random can also be used to mean "choose a random role".
-r race
Likewise this can be used to explicitly request that a race be chosen.

Note: Leaving out any of these characteristics will result in you being prompted during the game startup for the information.

Choose all (remaining) character attributes randomly. It doesn't affect any characteristics that have already been specified by other means.
This option alone will print out the list of your scores on the current version. The -s may also be followed by arguments -p and -r to print the scores of particular roles and races only. It may also be followed by one or more player names to print the scores of the players mentioned, by 'all' to print out all scores, or by a number to print that many top scores.
-dec and -ibm
These command line options are equivalent to the decgraphics and ibmgraphics in-game options, and are provided purely for convenience on systems supporting multiple types of terminals.
-D or -X
These option will start the game in a special non-scoring discovery mode. If the player is the game administrator, -D will start in debugging (wizard) mode instead.
This option suppresses printing of any news from the game administrator.
This option is usually only useful to the game administrator. If it appears, it must be the first argument, and supplies a directory which is to serve as the playground. It overrides the value from NETHACKDIR, HACKDIR, or the directory specified by the game administrator during compilation (usually /usr/lib/games/glhack). The playground must contain several auxiliary files such as help files, the list of top scorers, and a subdirectory save where games are saved.


These are the command line options specific to glHack.

They all begin with a double dash (`--'). Values are normally separated from the option with a space, like "--depth 32".

Alternatively, a value can be placed after an `=' sign without any spaces, like "--depth=32". This should be used if the value begins with a minus (`-') sign, otherwise the number will be mistaken as a new option.

Options that take a value are shown here with example values.

--mode 640x480
Specifies the video mode. Normally glHack will autodetect the mode, but using this option will override that. The default value (when all else fails) is 800x600.
--depth 8
Video depth (bits per pixel). Possible values are 15, 16, 24 and 32, and 8 when using the software renderer. The default value is autodetected.
Play inside a window, rather than fullscreen.
Gamma correction value. Range is -5 to +5, where positive values make the screen brighter, and negative values make it darker. Zero is the default (no adjustment).
--tileheight 64
Choose the tileset, which can be 16, 32 or 64. The default is 32. To get the Isometric 3D tileset, use the value 64.
--fontsize 22
Choose the font size, out of 8, 14, 20 or 22. The default is 20. The given size will be used for all text windows, overriding any wincap settings in the config file.
Show a help page.
Show the current version. This can also be done within the game using the #version command.


Your login name (used as the player name).
Your home directory (used to find the config file).
String predefining several standard NetHack options.
String predefining several glHack-specific options.
Playground directory (see -d option above).

In addition, SHOPTYPE is used in debugging (wizard) mode.


glHack runs set-gid games. This is needed to create/modify the persistent game files. In general, set-gid programs are a lot more secure than set-uid programs. An attacker who successfully compromises a set-gid game executable can only mess around with various game data files (typically those in /var/games and /var/lib/games).

Since glHack is based on NetHack 3.4.0, any security issues with NetHack 3.4.0 (past or future) will almost certainly apply to this release of glHack.

Currently there is only one place in the glHack-specific code that creates or writes to a file: the screenshot code. Taking screenshots is restricted to the game administrator (the "wizard" account).

As far as I know, glHack will never execute another program. The following features of the NetHack 3.4.0 codebase which do execute other programs are disabled in glHack's standard (compile-time) configuration: running a compression utility (COMPRESS), running a shell (SHELL), reading mail (MAIL), and running an external pager (TTY code).


Configuration file for glHack. See the glhackrc(5) manual page for more information.
The static playground. Read-only files are stored here. Files found here will be marked "(STATIC)" in the entries below.
The variable playground. Persistent (read/write) data files are stored here. These files are marked "(VAR)" below.
nhdat (STATIC)
Archive containing all the stuff that NetHack requires to play (level files, text files, help files, etc). The format is DLB (Data LiBrarian) and is NetHack-specific.
license (STATIC)
Rules governing redistribution.
glhack_recover (STATIC)
This program can be used to recover a game after glHack has crashed (assuming the files were not corrupted). It can only be run as the superuser (root).
gl*.png (STATIC)
Images (fonts, tilesets, etc) used by glHack.
gl*.lst (STATIC)
Miscellaneous data files (e.g. tile facing info) used by glHack.
record (VAR)
The list of top scorers.
logfile (VAR)
An extended list of games played.
perm (VAR)
Empty file used for locking purposes.
bonDD.nn (VAR)
Bone files: descriptions of the ghost and belongings of a deceased adventurer.
NNNNname.dd (VAR)
Temporary files for a user who is currently playing glHack, or after glHack has crashed. The `NNNN' part is the numeric userid, followed by the player's name.
save/ (VAR)
A subdirectory containing the saved games.


This program is free software. It is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.