r/nethack • • Jun 08 '19

programing

idk how to program, im learning , ive heard nethack is easy to mod , so how do i mod nethack, do i need any extra software?

0 Upvotes

4 comments sorted by

9

u/skeeto 1 Ascension: Val-Hum-Mal-Cha Jun 08 '19 edited Jun 08 '19

Modding NetHack is probably a bit too complicated for someone with no programming experience whatsoever. It doesn't have formal support for modding, rather it's really just a side effect of being open source. To mod NetHack you have to build the entire program from source, not just modify some of the game's distribution files in place.

To build NetHack you'll need a basic C toolchain (compiler, build tool, etc.) and maybe some libraries for your target platform. If you want to modify some of the level layouts you'll also need lex/yacc. The build process varies greatly between platforms, and you can find the instructions for each under sys/ in the NetHack source distribution.

For example, on unix-like system it goes a little like this:

$ sh sys/unix/setup.sh
$ vi include/config.h include/unixconf.h Makefile src/Makefile  # configure to taste
$ make

Only once you can successfully build from scratch are you ready to start modifying the source code. Tweaking numbers (hp, etc.) is easy, but adding whole new features (new monsters, etc.) is challenging. You can use wizard mode to test your changes.

Likely you'll want to capture the changes you make. You can use diff/patch or a source control program like git to do this.

Here's the version I like to play most, already set up to build from source on Linux:

https://github.com/skeeto/nethack-patches

"Mods" can be added by placing them in the patches/ directory and rebuilding.

3

u/[deleted] Jun 08 '19

You did not hear that Nethack was easy to mod. I don't think you've ever even played it.

-1

u/[deleted] Jun 08 '19

?????