Codex Gamicus

Template:Roguelike You might be interested in a variant called PC Hack... which is not documented on this page.

Hack is a free, open source roguelike game for Unix. A mysterious DOS port also exists. The game is a clone of Rogue, but Hack 1.0.3 has additional features including persisent levels, a pet, several character classes, and a larger collection of monsters. The goal of the game remains the same: descend through the dungeon, attacking ("hacking") monsters or evading them, and return to the surface with the Amulet of Yendor. The game is difficult and dangerous. It helps that there are some useful magical items in the dungeon, but each scroll, potion, wand and ring starts out unidentified (as it would in Rogue), so players know not whether each one is useful or harmful.

Hack appeared in the 1980s when Unix systems generally could not draw graphics. Thus Hack achieves screen orientation by drawing a map of the dungeon using text characters. The hero is @, monsters are mostly uppercase and lowercase letters, and objects are punctuation.

The dungeon[]

The dungeon of Hack is very similar to that of Rogue. It is randomly generated so it changes from game to game. The player must explore to learn where everything is, but the player automatically memorises a map of locations already seen. At the start, the dungeon consists of rectangular rooms connected by dark rooms. Some rooms are lit, but in corridors and dark rooms, the hero can only see one square around them. The hero can see farther in lit rooms, but can retreat into corridors to prevent monsters from surrounding the hero. No dungeon level is larger than a typical 80-character-by-24-character terminal; staircases connect to deeper levels (generated when the player first arrives). Eventually, the dungeon levels become dark mazes. Somewhere down there is the Amulet. All of this is almost exactly the same as it was in Rogue.

However, Hack adds a feature called persistent levels. Rogue only remembered one level at a time; going down to the next level (or up if carrying the Amulet) effectively caused the game to erase the previous level. Hack instead saves the level to disk. Players can follow staircases in both directions and use them to retreat to familiar levels, to retreat multiple times if they want. Players carrying the Amulet walk up through familiar levels.

In Hack, the feature of persistent levels is always on. In contrast, while some variants of Angband have persistent levels, it is an option that only a few players turn on, and only when they want to make the game more difficult; it is traditional in Angband to return to particular dungeon depths and have a new dungeon level (with more monsters and treasure) generated each time.

Development of Hack[]

In 1982, Jay Fenlason put together the original Hack for Unix after he was unable to obtain Rogue source code. In 1984 and 1985, Andries Brouwer modified it, versions 1.0 through 1.0.3. These versions are available under a BSD free software license. After 1985, development of Hack stalled. However, one team started and continues to maintain a popular variant called NetHack.

Hack 1.0.3 became one of the traditional games of BSD Unix; it has endured for over two decades even as Unix has changed. One can find copies of it today included in NetBSD and OpenBSD and readily available for FreeBSD, Debian, and Gentoo; these copies contain adaptations to make them run on modern Unix.

DOS Hack 1.21 uses these typical DOS characters to draw the dungeon. Instead of an @ sign (char 40), the adventurer is a smiley face (char 01).

There also exists a DOS port called "Hack 1.21"; its copyright and author is presently unknown. The game is a binary (a HACK.EXE file) with no source code. This appears to be a variant of Jay Fenlason's Hack, but also has some added features including color. The DOS version also requires the hero to use a light a torch or lamp to see around them in dark areas; both Hack 1.0.3 and NetHack provide this vision to every Unique to this version, the hero must choose and buy their starting inventory in a shop

Players hacking in Hack today are most likely either playing a modernised Hack 1.0.3 on Unix, or the Hack 1.21 binary on DOS.

Source code[]

Being a free game, Hack has public source code (though some modified versions might not). One can often find the C language source files in /usr/src/games/hack on a NetBSD or OpenBSD system. A read of the def.objects.h file should answer questions about what those unidentified objects do.


This is the shop that appears at the start of DOS Hack 1.21. This is a unique feature of the DOS version.

After shopping, the player enters the dungeon. The DOS version replaces the usual @ sign hereo with a smiley.

A wall trap unique to the DOS version closes on the eastmost room.

Game data[]



  • Several versions by Andries E. Brouwer:
    • Hack 1.0.3 of 23 July 1985
    • Hack 1.0.2 of 1 to 14 April 1985
    • Hack 1.0.1 of January 1985
    • Hack 1.0 of 17 December 1984
  • Jay Fenlason originally wrote Hack in 1982, but it was never widely distributed (if at all).

('s_Hack referes to "PDP-11" and "PC/IX" Hack; both of those need to be added to the above.)


External links[]