# NetHack

NetHack is an open source single-player roguelike video game, first released in 1987 and maintained by the NetHack DevTeam. The game is a fork of the 1982 game Hack, itself inspired by the 1980 game Rogue. The player takes the role of one of several pre-defined character classes to descend through multiple dungeon floors, fighting monsters and collecting treasure, to recover the "Amulet of Yendor" at the lowest floor and then escape.
As an exemplar of the traditional "roguelike" game, NetHack features turn-based, grid-based hack and slash and dungeon crawling gameplay, procedurally generated dungeons and treasure, and permadeath, requiring the player to restart the game anew should the player character die. The game uses simple ASCII graphics by default so as to display readily on a wide variety of computer displays, but can use curses with box-drawing characters, as well as substitute graphical tilesets on machines with graphics. While Rogue, Hack and other earlier roguelikes stayed true to a high fantasy setting, NetHack introduced humorous and anachronistic elements over time, including popular cultural reference to works such as Discworld and Raiders of the Lost Ark.
It is identified as one of the "major roguelikes" by John Harris. Comparing it with Rogue, Engadget's Justin Olivetti wrote that it took its exploration aspect and "made it far richer with an encyclopedia of objects, a larger vocabulary, a wealth of pop culture mentions, and a puzzler's attitude." In 2000, Salon described it as "one of the finest gaming experiences the computing world has to offer".

## Gameplay

Before starting a game, players choose their character's race, role, sex, and alignment, or allow the game to assign the attributes randomly. There are traditional fantasy roles such as knight, wizard, rogue, and priest; but there are also unusual roles, including archaeologist, tourist, and caveman. The player character's role and alignment dictate which deity the character serves and is supported by in the game, "how other monsters react toward you", as well as character skills and attributes.
After the player character is created, the main objective is introduced. To win the game, the player must retrieve the Amulet of Yendor, found at the lowest level of the dungeon, and offer it to their deity. Successful completion of this task rewards the player with the gift of immortality, and the player is said to "ascend", attaining the status of demigod. Along the path to the amulet, a number of sub-quests must be completed, including one class-specific quest.
There are three major antagonists in NetHack: the Luciferesque god Moloch, who stole the Amulet of Yendor from the creator god Marduk; the high priest (or priestess) of Moloch, who holds the Amulet of Yendor; and the most prominent antagonist, the Wizard of Yendor, who will stalk the player throughout the rest of the game after the first encounter by resurrecting and attacking them periodically. The game's final bosses in the Astral Plane are the Riders: three of the Four Horsemen of the Apocalypse, Death, Famine and Pestilence. It is often proposed that the player character represents the fourth horseman, War.
The player's character is, unless they opt not to be, accompanied by a pet animal, typically a kitten or little dog, although knights begin with a saddled pony. Pets grow from fighting, and they can be changed by various means. Most of the other monsters may also be tamed using magic or food.

### Dungeon levels

NetHack's dungeon spans about fifty primary levels, most of which are procedurally generated when the player character enters them for the first time. A typical level contains a way "up" and "down" to other levels. These may be stairways, ladders, trapdoors, etc. Levels also contain several "rooms" joined by corridors. These rooms are randomly generated rectangles (as opposed to the linear corridors) and may contain features such as altars, shops, fountains, traps, thrones, pools of water, and sinks based on the randomly generated features of the room. Some specific levels follow one of many fixed designs or contain fixed elements. Later versions of the game added special branches of dungeon levels. These are optional routes that may feature more challenging monsters but can reward more desirable treasure to complete the main dungeon. Levels, once generated, persist throughout a single game, in contrast to the non-persistent levels in Moria-style games.

### Items and tools

NetHack features a variety of items: weapons (melee or ranged), armor to protect the player, scrolls and spellbooks to read, potions to quaff, wands, rings, amulets, and an assortment of tools, such as keys and lamps.
NetHack's identification of items is almost identical to Rogue's. For example, a newly discovered potion may be referred to as a "pink potion" with no other clues as to its identity. Players can perform a variety of actions and tricks to deduce, or at least narrow down, the identity of the potion. The most obvious is the somewhat risky tactic of simply drinking it. All items of a certain type will have the same description. For instance, all "scrolls of enchant weapon" may be labeled "TEMOV", and once one has been identified, all "scrolls of enchant weapon" found later will be labeled unambiguously as such. Starting a new game will scramble the items' descriptions again, so the "silver ring" that is a "ring of levitation" in one game might be a "ring of hunger" in another.

### Blessings and curses

As in many other roguelike games, all items in NetHack are either "blessed", "uncursed", or "cursed". The majority of items are found uncursed, but the blessed or cursed status of an item is unknown until it is identified or detected through other means. Such statuses can be changed (blessed to uncursed, uncursed to cursed, and vice versa) depending on player interaction.
Generally, a blessed item will be more powerful than an uncursed item, and a cursed item will be less powerful, with the added disadvantage that once it has been equipped by the player, it cannot be easily unequipped. Where an object would bestow an effect upon the character, a curse will generally make the effect harmful, or increase the amount of harm done. However, there are very specific exceptions. For example, drinking a cursed "potion of gain level" will make the character literally rise through the ceiling to the level above, instead of gaining an experience level.

### Character death

As in other roguelike games, NetHack features permadeath: expired characters cannot be revived.
Although NetHack can be completed without any artificial limitations, experienced players can attempt "conducts" for an additional challenge. These are voluntary restrictions on actions taken, such as using no wishes, following a vegetarian or vegan diet, or even killing no monsters. While conducts are generally tracked by the game and are displayed at death or ascension, unofficial conducts are practiced within the community.
When a player dies, the cause of death and score is created and added to the list where the player's character is ranked against other previous characters. The prompt "Do you want your possessions identified?" is given by default at the end of any game, allowing the player to learn any unknown properties of the items in their inventory at death. The player's attributes (such as resistances, luck, and others), conduct (usually self-imposed challenges, such as playing as an atheist or a vegetarian), and a tally of creatures killed, may also be displayed.
The game sporadically saves a level on which a character has died and then integrates that level into a later game. This is done via "bones files", which are saved on the computer hosting the game. A player using a publicly hosted copy of the game can thus encounter the remains and possessions of many other players, although many of these possessions may have become cursed.
Because of the numerous ways that a player-character could die between a combination of their own actions as well as from reactions from the game's interacting systems, players frequently refer to untimely deaths as "Yet Another Stupid Death" (YASD). Such deaths are considered part of learning to play NetHack as to avoid conditions where the same death may happen again.
NetHack does allow players to save the game so that one does not have to complete the game in one session, but on opening a new game, the previous save file is subsequently wiped as to enforce the permadeath option. One option some players use is to make a backup copy of the save game file before playing a game, and, should their character die, restoring from the copied version, a practice known as "save scumming". Additionally, players can also manipulate the "bones files" in a manner not intended by the developers. While these help the player to learn the game and get around limits of permadeath, both are considered forms of cheating the game.

### Culture around spoilers

NetHack is largely based on discovering secrets and tricks during gameplay. It can take years for one to become well-versed in them, and even experienced players routinely discover new ones. A number of NetHack fan sites and discussion forums offer lists of game secrets known as "spoilers".

### Interface

NetHack was originally created with only a simple ASCII text-based user interface, although the option to use something more elaborate was added later in its development. Interface elements such as the environment, entities, and objects are represented by arrangements of ASCII or Extended ASCII glyphs, "DECgraphics", or "IBMgraphics" mode. In addition to the environment, the interface also displays character and situational information.
A detailed example:
The player (the '@' sign, a wizard in this case) has entered the level via the stairs (the '<' sign) and killed a few monsters, leaving their corpses (the '%' signs) behind. Exploring, the player has uncovered three rooms joined by corridors (the '#' signs): one with an altar (the '_' sign), another empty, and the final one (that the player is currently in) containing a potion (the '!' sign) and chest (the '(' sign). The player has just moved onto a square containing a silver ring. Parts of the level are still unexplored (probably accessible through the door to the west (the '+' sign)) and the player has yet to find the downstairs (a '>' sign) to the next level.
Apart from the original termcap interface shown above, there are other interfaces that replace standard screen representations with two-dimensional images, or tiles, collectively known as "tiles mode". Graphic interfaces of this kind have been successfully implemented on the Amiga, the X Window System, the Microsoft Windows GUI, the Qt toolkit, and the GNOME libraries.
Enhanced graphical options also exist, such as the isometric perspective of Falcon's Eye and Vulture's Eye, or the three-dimensional rendering that noegnud offers. Vulture's Eye is a fork of the now defunct Falcon's Eye project. Vulture's Eye adds additional graphics, sounds, bug fixes and performance enhancements and is under active development in an open collaborative environment.
* NetHack for Microsoft Windows in "tiles mode"
* Vulture's Eye offers an isometric perspective.
* NetHack on OPENSTEP/NeXTSTEP

## History and development

NetHack is a software derivative of Hack, which itself was inspired by Rogue. Hack was created by students Jay Fenlason, Kenny Woodland, Mike Thome, and Jonathan Payne at Lincoln-Sudbury Regional High School as part of a computer class, after seeing and playing Rogue at the University of California, Berkeley computer labs. The group had tried to get the source code of Rogue from Glenn Wichman and Michael Toy to build upon, but Wichman and Toy had refused, forcing the students to build the dungeon-creation routines on their own. As such, the game was named Hack in part for the hack-and-slash gameplay and that the code to generate the dungeons was considered a programming hack. After their classes ended, the students' work on the program also ended, though they had a working game. Fenlason provided the source code to a local USENIX conference, and eventually it was uploaded to USENET newsgroups. The code drew the attention of many players who started working to modify and improve the game as well as port it to other computer systems. Hack did not have any formal maintainer and while one person was generally recognized to hold the main code to the current version of Hack, many software forks emerged from the unorganized development of the game.
Eventually, Mike Stephenson took on the role as maintainer of the Hack source code. At this point, he decided to create a new fork of the game, bringing in novel ideas from Izchak Miller, a philosophy professor at University of Pennsylvania, and Janet Walz, another computer hacker. They called themselves the DevTeam and renamed their branch NetHack since their collaboration work was done over the Internet. They expanded the bestiary and other objects in the game, and drew from other sources outside of the high fantasy setting, such as from Discworld with the introduction of the tourist character class. Knowing of the multiple forks of Hack that existed, the DevTeam established a principle that while the game was open source and anyone could create a fork as a new project, only a few select members in the DevTeam could make modifications to the main source repository of the game, so that players could be assured that the DevTeam's release was the legitimate version of NetHack.

### Release history

The DevTeam's first release of NetHack was on 28 July 1987.
The core DevTeam had expanded with the release of NetHack 3.0 in July 1989. By that point, they had established a tight-lipped culture, revealing little, if anything, between releases. Owing to the ever-increasing depth and complexity found in each release, the development team enjoys a near-mythical status among fans. This perceived omniscience is captured in the initialism TDTTOE, "The DevTeam Thinks of Everything", in that many of the possible emergent gameplay elements that could occur due to the behavior of the complex game systems had already been programmed in by the DevTeam. Since version 3.0, the DevTeam has typically kept to minor bug fix updates, represented by a change in the third version number (e.g. v3.0.1 over v3.0.0), and only releases major updates (v3.1.0 over v3.0.0) when significant new features are added to the game, including support for new platforms. Many of those from the community that helped with the ports to other systems were subsequently invited to be part of the DevTeam as the team's needs grew, with Stephenson remaining the key member currently.
Updates to the game were generally regular from around 1987 through 2003, with the DevTeam releasing v3.4.3 in December 2003. Subsequent updates from the DevTeam included new tilesets and compatibility with variants of Mac OS, but no major updates to the game had been made. In the absence of new releases from the developers, several community-made updates to the code and variants developed by fans emerged.
On 7 December 2015, version 3.6.0 was released, the first major release in over a decade. While the patch did not add major new gameplay features, the update was designed to prepare the game for expansion in the future, with the DevTeam's patch notes stating: "This release consists of a series of foundational changes in the team, underlying infrastructure and changes to the approach to game development". Stephenson said that despite the number of roguelike titles that had emerged since the v3.4.3 release, they saw that NetHack was still being talked about online in part due to its high degree of portability, and decided to continue its development. According to DevTeam member Paul Winner, they looked to evaluate what community features had been introduced in the prior decade to improve the game while maintaining the necessary balance. The update came shortly after the death of Terry Pratchett, whose Discworld had been influential on the game, and the new update included a tribute to him. With the v3.6.0 release, NetHack remains "one of the oldest games still being developed".
A public read-only mirror of NetHack's git repository was made available on 10 February 2016. Since v3.6.0, the DevTeam has continued to push updates to the title, with the latest being v3.6.7 on 16 February 2023. Version 3.7.0 is currently in development.
As of 2020, the official source release supports the following systems: Windows, Linux, macOS, Windows CE, OS/2, Unix (BSD, System V, Solaris, HP-UX), BeOS, and VMS.

### Licensing, ports, and derivative ports

NetHack is released under the NetHack General Public License, which was written in 1989 by Mike Stephenson, patterned after the GNU bison license (which was written by Richard Stallman in 1988). Like the Bison license, and Stallman's later GNU General Public License, the NetHack license was written to allow the free sharing and modification of the source code under its protection. At the same time, the license explicitly states that the source code is not covered by any warranty, thus protecting the original authors from litigation. The NetHack General Public License is a copyleft software license certified as an open source license by the Open Source Initiative.
The NetHack General Public License allows anyone to port the game to a platform not supported by the official DevTeam, provided that they use the same license. Over the years this licensing has led to a large number of ports and internationalized versions in German, Japanese, and Spanish. The license also allows for software forks as long as they are distributed under the same license, except that the creator of a derivative work is allowed to offer warranty protection on the new work. The derivative work is required to indicate the modifications made and the dates of changes. In addition, the source code of the derivative work must be made available, free of charge except for nominal distribution fees. This has also allowed source code forks of NetHack including Slash'EM, UnNetHack, and dNethack.

## Online support

Bugs, humorous messages, stories, experiences, and ideas for the next version are discussed on the Usenet newsgroup rec.games.roguelike.nethack.
A public server at nethack.alt.org, commonly known as "NAO", gives players access to NetHack through a Telnet or SSH interface. A browser-based client is also available on the same site. Ebonhack connects to NAO with a graphical tiles-based interface.
During the whole month of November, the annual /dev/null NetHack Tournament took place every year from 1999 to 2016. The November NetHack Tournament, initially conceived as a one-time tribute to devnull, has taken place each year since 2018. The Junethack Cross-Variant Summer Tournament has taken place annually since 2011.

## NetHack Learning Environment

The Facebook artificial intelligence (AI) research team, along with researchers at the University of Oxford, New York University, the Imperial College London, and University College London, developed an open-source platform called the NetHack Learning Environment, designed to teach AI agents to play NetHack. The base environment is able to maneuver the agent and fight its way through dungeons, but the team seeks community help to build an AI on the complexities of NetHack's interconnected systems, using implicit knowledge that comes from player-made resources, thus giving a means for programmers to hook into the environment with additional resources. Facebook's research led the company to pose NetHack as a grand challenge in AI in June 2021, in part due to the game's permadeath and inability to experiment with the environment without creating a reaction. The competition at the 2021 Conference on Neural Information Processing Systems involved agents of various designs attempting to ascend. None of the agents managed this; the results were ranked by median in-game score, with the highest-ranked agent (Team AutoAscend) using a symbolic (non-machine-learning) design.

## Legacy

NetHack has influenced ADOM, Minecraft, Spelunky, Diablo and Mystery Dungeon. The game was part of the video game exhibit "Never Alone", in the Museum of Modern Art's collection, which ran from September 2022 to July 2023.