Compile-time options

From NetHackWiki
Jump to navigation Jump to search

Compile-time options are certain features of NetHack that can be enabled or disabled when compiling the game from the source code. In the source code, blocks of code that will be enabled by a compile-time option are separated into "#IFDEF <option> / #ENDIF" blocks; if <option> is disabled, the code in the block will not be compiled into the binary executable file. Most of these can be selected in config.h, in particular, at the end of this file, or on a UNIX system, in a hints file.

The compile-time options listed below are those that visibly affect the end-user experience. In modern NetHack, most compile-time options govern back-end features (such as compression of bones and save files) that do not have a visible effect on the game. Historically, NetHack had a large number of compile-time options that added or removed entire game features, such as foocubi, Tourists, or (going farther back) the whole spellcasting system. This was done for two reasons: to provide users a way to test and potentially opt out of then-new features, and to allow users on systems with limited memory to compile a smaller executable file. The second reason may sound strange to a modern audience, but NetHack, being originally built for UNIX systems, did not fit into the base 640-kilobyte memory of an MS-DOS machine by version 3.0.0.

The number of gameplay-affecting compile-time options decreased over time, as increasing computer memories made the second reason irrelevant and the rise of public servers made a "standard" game more desirable. By 3.4.3, only a few feature-affecting options remained, arguably the most significant being that Elbereth could still be compiled out of the game. By 3.6.1, virtually all such options were removed, with only a few minor tweaks to the game's interface remaining.

Note that some compile-time NetHack options (particularly those that change gameplay features) change the format of the bones and save files and will render these incompatible if they are changed.

Enabling or disabling options

In config.h

The options are mainly controlled by certain lines in config.h, which may look like this one:

#define KOPS		/* Keystone Kops by Scott R. Turner */

The above line enables the Keystone Kops. If it is commented out, then Kops no longer exist in the game, and a shopkeeper who is robbed will have to fend for himself:

/*#define KOPS*/		/* Keystone Kops by Scott R. Turner */

The /* and */ marks define a comment, a part of the source code that the compiler is instructed to ignore. Most newer compilers also accept a single-line comment like so:

//#define KOPS		/* Keystone Kops by Scott R. Turner */

In a hints file

On UNIX systems, the options can be specified in a hints file, eg. sys/unix/hints/linux, by adding lines like this:

 CFLAGS+=-DDUMPLOG

which would define DUMPLOG

3.6.1

Most of the compile-time options in 3.4.3 were made unconditional in 3.6.

TTY_TILES_ESCCODES

Output special console escape codes which act as hints for external programs such as EbonHack. Not enabled by default.

MSGHANDLER

Execute an external program whenever a new message-window message is shown. The program to execute is given in environment variable NETHACK_MSGHANDLER. Not enabled by default.

STATUS_HILITES

Support highlighting of status fields. Enabled by default.

SCORE_ON_BOTL

Enable the showscore-option. Not enabled by default.

EDIT_GETLIN

Make the string input in TTY, Qt4, and X11 so some prompts will remember the previously input text. Not enabled by default.

DUMPLOG

Enable end-of-game dumplogs.

DUMPLOG_FILE

Set the file where dumplogs are saved. Can be set in sysconf.

3.4.3

SINKS

SINKS is enabled by default in NetHack. If it is turned off, sinks do not appear; this may make the game harder, as it is no longer possible to get a random ring or a dishwasher by kicking a sink.

WALLIFIED_MAZE

WALLIFIED_MAZE is enabled by default. If it is turned off, walls cannot be drawn with the more attractive box drawing characters via IBMgraphics or DECgraphics.

REINCARNATION

REINCARNATION is enabled by default. If it is turned off, the Rogue level does not appear.

KOPS

KOPS is enabled by default. If it is turned off, the Keystone Kops do not appear, and a shopkeeper who is robbed will have to kill you himself.

SEDUCE

SEDUCE is enabled by default. If it is turned off, foocubi become level-draining monsters similar to vampires. Unlike most options, SEDUCE does not affect bones/save compatibility.

STEED

STEED is enabled by default. If it is turned off, it is no longer possible to ride horses and other steeds, and saddles do not exist.

TOURIST

TOURIST is enabled by default. If it is turned off, the Tourist role is removed, along with Hawaiian shirts, T-shirts, credit cards (including the Platinum Yendorian Express Card), and expensive cameras.

ELBERETH

ELBERETH is enabled by default. If it is turned off, engraving Elbereth does not repel monsters. Crowning is also removed, because the lawful crowned title is the Hand of Elbereth. There will still be engravings of Elbereth in the Castle and Sokoban levels, since level maps are defined outside the NetHack source code, but they will have no effect.

REDO

REDO is enabled by default. If it is turned off, control-A does not repeat the last command.

EXP_ON_BOTL

EXP_ON_BOTL is enabled by default. If it is turned off, the showexp option does not exist, and it is not possible to show the current experience points on the status display. This option sets a flag that is saved in the save file, and so EXP_ON_BOTL affects bones/save compatibility, even though one might expect that it would not.

SCORE_ON_BOTL

SCORE_ON_BOTL is not enabled by default. If it is turned on, a showscore option is enabled, which shows the current score on the status display when set. Like EXP_ON_BOTL, this option sets a flag that is saved in the save file.

GOLDOBJ

GOLDOBJ is not enabled by default. It enables an experimental feature, still being debugged, by which gold coins are considered an object like any other; currently your gold is stored separately from the rest of your inventory.

AUTOPICKUP_EXCEPTIONS

AUTOPICKUP_EXCEPTIONS is not enabled by default in the NetHack source code, though at least the official Linux binary includes it. If enabled, it is possible to specify, through options, certain objects that will or will not be automatically picked up in spite of the autopickup setting for their object type; using AUTOPICKUP_EXCEPTIONS, one can for instance specify that food rations are to be automatically picked up and cockatrice corpses are not. Without AUTOPICKUP_EXCEPTIONS, this distinction is not possible: either all food items are automatically picked up (by specifying % in pickup_types) or none are.

SHELL

This can be found in unixconf.h. By default this is on, and it allows the user to escape to the command-line shell with !; Disabling this is a good idea on public servers.

This page may need to be updated for the current version of NetHack.

It may contain text specific to NetHack 3.4.3. Information on this page may be out of date.

Editors: After reviewing this page and making necessary edits, please change the {{nethack-343}} tag to the current version's tag or {{noversion}} as appropriate.