Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Install the nethack util binaries and their documentation. #80

Merged
merged 2 commits into from
Sep 24, 2020

Conversation

heiner
Copy link
Contributor

@heiner heiner commented Sep 23, 2020

Using those, we can define our own custom levels, e.g.

  1. Use the tar-like tool dlb to extract nhdat.
  2. Add a mylevel.des file as per 5. Creating a new level in
    https://nethackwiki.com/wiki/Beginner%27s_guide_to_NetHack_sources
    (the .des files are part of the NLE installation, but not in nhdat as they are sources).
  3. Compile that file using lev_comp, producing mylevel.lev.
  4. Add the new level to dungeon.def (also part of the NLE installation).
  5. Run makedefs -e and dgn_comp dungeon.pdf to produce dungeon.
  6. Re-assemble the new set of files using dlb which includes dungeon and mylevel.des.

Example

From patch_nhdat.sh in this commit:

HACKDIR=$(python -c 'import pkg_resources; print(pkg_resources.resource_filename("nle", "nethackdir"), end="")')

TMPDIR=/tmp/patch_nhdat
mkdir $TMPDIR

mkdir $TMPDIR/dat
cd $TMPDIR/dat
cp $HACKDIR/dat/dungeon.def .
patch --ignore-whitespace <<'EOF'
--- dungeon.def      2019-03-01 15:21:08.000000000 +0100
+++ dungeon.def 2020-09-23 19:17:51.000000000 +0200
@@ -15,6 +15,7 @@
 #

 DUNGEON:       "The Dungeons of Doom" "D" (25, 5)
+LEVEL:         "mylevel" "none" @ (1,1)
 ALIGNMENT:     unaligned
 BRANCH:                "The Gnomish Mines" @ (2, 3)
 LEVEL:         "rogue" "R" @ (15, 4)

EOF
$HACKDIR/makedefs -e  # Looks for ../dat/dungeon.def.
$HACKDIR/dgn_comp dungeon.pdf

cp $HACKDIR/dat/oracle.des mylevel.des
patch --ignore-whitespace <<'EOF'
--- mylevel.des       2019-03-01 15:21:08.000000000 +0100
+++ mylevel.des     2020-09-23 19:01:56.000000000 +0200
@@ -5,7 +5,7 @@
 # Oracle level
 #

-LEVEL: "oracle"
+LEVEL: "mylevel"

 ROOM: "ordinary" , lit, (3,3), (center,center), (11,9) {
   OBJECT:('`',"statue"),(0,0),montype:'C',1
EOF
$HACKDIR/lev_comp mylevel.des

mkdir $TMPDIR/contents
cd $TMPDIR/contents
$HACKDIR/dlb xf $HACKDIR/nhdat
cp -f ../dat/dungeon ../dat/mylevel.lev .
$HACKDIR/dlb cf nhdat *

# Now copy nhdat somewhere to use it.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 23, 2020
@heiner heiner requested a review from rockt September 23, 2020 11:56
Copy link
Contributor

@rockt rockt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exciting! LGTM.

@heiner heiner force-pushed the install-utils branch 2 times, most recently from 3b13978 to babade4 Compare September 23, 2020 12:53
Using those, we can define our own custom levels, e.g.

1. Use the tar-like tool dlb to extract nhdat.
2. Modify/add a .des files as per "5. Creating a new level" in
   https://nethackwiki.com/wiki/Beginner%27s_guide_to_NetHack_sources
3. Compile that file using lev_comp.
4. Re-assemble the new set of files using dlb.
@heiner heiner force-pushed the install-utils branch 2 times, most recently from 86958b1 to 68d3997 Compare September 23, 2020 16:33
This creates a copy of the oracle level on dungeon level 1.
@heiner heiner merged commit cb423f9 into master Sep 24, 2020
@heiner heiner deleted the install-utils branch September 24, 2020 11:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants