Copyright (c) NetHack Development Team 1990-2002 NetHack may be freely redistributed. See license for details. ============================================================== Instructions for compiling and installing NetHack 3.3 on a Windows NT, 2000, or XP system ============================================================== Last revision: January 13, 2002 Credit for the porting of NetHack to the Win32 Console Subsystem goes to the NT Porting Team started by Michael Allison. Credit for the Win32 Graphical version of NetHack (aka Winhack) goes to Alex Kompel. You can build either the TTY version of NetHack or the Windows Graphical version. In either case you will need: o A copy of Microsoft Visual C V6.0 or later. Things may work with an earlier version of the compiler, but the current code has not been tested with an earlier compiler. o A version of a UUDECODE utility in your path. The Makefiles and the VC Project files assume that a utility called uudecode.exe is in your path. A version of uudecode.exe is required to be in your path when you start the build process because 3 binary files are distributed in uuencoded format and are required. FIRST STEP: The first step in building either version of NetHack is to execute sys/winnt/nhsetup.bat. Specify either TTY, or WIN. For the tty version using the NT Console I/O subsystem: cd sys\winnt nhsetup TTY For the graphical version (WinHack) cd sys\winnt nhsetup WIN The winhacknt subdirectory will be created off the top of the NetHack source tree, and files appropriate for the selected build will be moved to the appropriate place. If you received some warning messages about not having a uudecode utility, you must find a way to uudecode the following files elsewhere and move the decoded version to its target directory: win\win32\mnsel.uu ---> win\win32\mnsel.bmp win\win32\mnunsel.uu ---> win\win32\mnunsel.bmp sys\winnt\nhico.uu ---> win\win32\nethack.ico (NOTE: The build directory is not part of the distribution. It was created when you executed nhsetup.bat as part of the FIRST STEP just above this.) If you wish to build the TTY version, proceed now to "BUILDING TTY VERSION." If you wish to build the graphical version, proceed now to "BUILDING GRAPHICAL VERSION." ------------------------ | BUILDING TTY VERSION | ------------------------ This version of NetHack for Win32 is a tty port utilizing the WIN32 Console I/O subsystem. I. Dispelling the Myths: Compiling NetHack for WIN32 TTY is not as easy as it sounds, nor as hard as it looks, however it will behoove you to read this entire section through before beginning the task. We have provided a Makefile for building NetHack using the following compiler: Microsoft Visual C++ V6.0 SP3 or greater The Makefile was created for use with MS NMAKE which is provided with the Microsoft compiler. The supplied Makefile may work with earlier versions of the Microsoft 32-bit compiler, but that has not been tested. You may find it useful to obtain copies of lex (flex) and yacc (bison, or byacc). While not strictly necessary to compile nethack, they are required should you desire to make any changes to the level and dungeon compilers. To use the distributed NetHack icon, a version of uudecode is required to decode sys\winnt\nhico.uu. II. To compile your copy of NetHack on a 32 bit Windows machine (NT or 2000): (Note: build has not been tested on Windows XP. That isn't to say that it doesn't work, it just hasn't been tried by us.) Setting Up 1. It almost goes without saying that you should make sure that your tools are set up and running correctly. That includes ensuring that all the necessary environment variables for the Microsoft compiler environment are set correctly. ( For example, by executing vcvars32.bat, which is probably in the bin directory of your compilers directory tree. ) 2. Make sure all the NetHack files are in the appropriate directory structure. You should have a main directory with subdirectories dat, doc, include, src, sys\share, sys\winnt, util and win\tty. Other subdirectories may also be included in your distribution, but they are not necessary for building the TTY version for the Win32 console subsystem. You can delete them to save space. Required Directories for a Win32 Console NetHack: top | ------------------------------------------------- | | | | | | | util dat doc include src sys win | | ------ ----- | | | share winnt tty Check the file "Files" in your top level directory for an exact listing of what file is in which directory. In order for the Makefiles to work, all the source files must be in the proper locations. If you downloaded or ftp'd the sources from a UNIX system, the lines will probably end in UNIX-style newlines, instead of the carriage return and line feed pairs used by Windows. Some programs have trouble with them, so you may need to convert them. The compiler should not have any problems with them however. 3. Go to the sys\winnt directory and run the nhsetup.bat batch file. The necessary Makefile movements will be accomplished for you. It will also verify that your directories are set up properly. It will also attempt to uudecode the NetHack icon contained in the file sys\winnt\nhico.uu. You must uudecode this file manually if the batch file fails to do so, or if you have no uudecode utility in your path. 4. Now go to the include subdirectory to check a couple of the header files there. Things *should* work as they are, but since you have probably set up your system in some sort of custom configuration it doesn't hurt to check out the following: First check config.h according to the comments to match your system and desired set of features. Mostly you need to check the WIZARD option. You may include all or as few of the special game features as you wish. 5. Go to the src directory and edit the top of your Makefile. Change the setting of (GAMEDIR) to reflect the directory where you want NetHack to be installed. ie. GAMEDIR = \games\nethackntty The directory you specify *MUST* exist for all remaining steps to be successful. Be sure the directory you want the game installed actually exists. If it doesn't, create it now. Do it before you forget: mkdir \games\nethackntty Optional: If you elected not to use the high-quality BSD random number routines by commenting out RANDOM in ntconf.h, comment out (or set equal to nothing) the RANDOM macro in your Makefile. If you are recompiling after patching your sources, or if you got your files from somewhere other than the official distribution, "touch makedefs.c" to ensure that certain files (onames.h and pm.h) are remade, lest potentially troublesome timestamps fool "nmake". Compiling 6. Now that everything is set up, and with your current directory set to src (as instructed at the start of step 5), run "nmake install". If you get any errors along the way then something has not been set up correctly. The time it takes to compile depends on your particular machine of course, but you should be able to go for lunch and return to find everything finished. The less memory, and slower your machine, the longer the lunch you may take. In any case, it is likely that the command prompt window where you are doing the compiling will be occupied for a while. If all goes well, you will get an NetHack executable. Running NetHack 7. Make sure all of the support files -- Guidebook.txt, license, Defaults.nh, NetHack.exe, nhdat, and recover.exe -- were copied to the game directory. If not, move them there yourself. Defaults.nh is actually distributed in the sources as sys/winnt/winnt.cnf, but the Makefile should take care of moving it and renaming it correctly. Edit Defaults.nh to reflect your particular setup and personal preferences, by following the comments. As with all releases since 3.2.1, HACKDIR defaults to the same directory as that where the NetHack.exe executable resides. You only need to set HACKDIR in Defaults.nh if, for some reason, you wish to override that (be careful). 8a. Running from the command prompt: If you add the directory containing the NetHack executable to your PATH, you can just type "nethack" or "nethack -umike" to start it up. Alternatively, you can explicitly invoke it with a command such as "c:\games\nethackntty\nethack" (specifying whatever drive and directory your NetHack executable resides in) each time. 8b. Running from a Windows shortcut (win95 or NT4.x) If you will be running it by launching it from program manager or from a shortcut, just use the following information when setting up the icon or shortcut. Description : NetHack 3.3.1 Command Line : C:\GAMES\NETHACKNTTY\NETHACK.EXE (changing the directory to the appropriate one of course) 9. Play NetHack. If it works, you're done! Notes: 1) To install an update of NetHack after changing something, enter "nmake" from the src directory. If you add, delete, or reorder monsters or objects, or you change the format of saved level files, delete any save and bones files. (Trying to use such files sometimes produces amusing confusions on the game's part, but usually crashes.) If you made changes to any of the level compiler software, you may have to delete dgn_flex.c, dgn_yacc.c, lev_flex.c, and lev_yacc.c from the util directory to ensure that they are remade. 2) The executable produced by this port is a 32-bit, flat-address space, non-overlayed .exe file, which should run on any true Win32 environment. ------------------------------ | BUILDING GRAPHICAL VERSION | ------------------------------ This version of NetHack is a Win32 native port built on the Windows API. I. Dispelling the Myths: Compiling WIN32 is straightforward, as long as you have Visual C correctly installed. It is also assumed that you changed your directory to sys\winnt and executed: nhsetup win as described at the top of this document. II. To compile your copy of NetHack on a Windows NT/2000/XP machine: Setting Up 2. Make sure all the NetHack files are in the appropriate directory structure. You should have a main directory with subdirectories dat, doc, include, src, sys\share, sys\winnt, util, win\win32, and at this point, you should also have winhacknt (created by nhsetup.bat executed from sys\winnt.) Other subdirectories may also be included in your distribution, but they are not necessary for building the graphical version of NetHack (you can delete them to save space if you wish.) Required Directories for a Win32 Console NetHack: top | -----------------------------------------/ /--------------- | | | | | | | | | util dat doc include src sys win build binary | | ------ ----- | | | share winnt win32 Those last two (build and binary) are created during the building process. They are not disributed as part of the NetHack source distribution. nhsetup.bat creates the build directory and moves a few files into it, including the Visual C project files. The "binary" directory will house everything you need to play the game after building is complete. Check the file "Files" in your top level directory for an exact listing of what file is in which directory. In order for the build process to work, all the source files must be in the proper locations. Remember that nhsetup.bat moves many files around to their intended locations. 3. Start the Visual C IDE. In the Visual C IDE Menus, choose: File | Open Workspace 4. In the Visual C "Open Workspace" dialog box, navigate to the top of your NetHack source directory. In there, highlight "nethack.dsw" and click on Open. 5. Once the workspace has been opened, you should see the following list in the Visual C selection window: + dgncomp files + dgnstuff files + dlb_main files + levcomp files + levstuff files + makedefs files + recover files + tile2bmp files + tilemap files + winhack files 6. On the Visual C menus, choose: Project | Set Active Project | winhack 7. On the Visual C menus once again, choose: Build | Build winhack.exe This starts the build. If all goes well, you will have a playable game of netack in the "binary" directory. In any case, it is likely that the IDE message window where you are doing the compiling will be occupied for a while. If all goes well, you will get an NetHack executable called winhack.exe in the "binary" directory, along with all the support files that it needs. Running NetHack 7. Make sure all of the support files -- Guidebook.txt, license, Defaults.nh, winhack.exe, nhdat, tiles.bmp, and recover.exe -- were copied to the binary directory. (If not, find them in the tree and move them there yourself if they exist. If they don't exist, something has gone wrong) Defaults.nh is actually distributed in the sources as sys/winnt/winnt.cnf, but the build process should take care of moving it and renaming it correctly. Edit Defaults.nh to reflect your particular setup and personal preferences, by following the comments. As with all releases since 3.2.1, HACKDIR defaults to the same directory as that where the winhack.exe executable resides. You only need to set HACKDIR in Defaults.nh if, for some reason, you wish to override that. 8a. Running from the command prompt: If you add the directory containing the NetHack executable to your PATH, You can just type "winhack" to start it up. Alternatively, you can explicitly invoke it with a command such as "c:\games\nethack\winhack" (specifying whatever drive and directory your NetHack executable resides in) each time. 8b. Running from a Windows shortcut (win95 or NT4.x) If you will be running it by launching it from program manager or from a shortcut, just use the following information when setting up the icon or shortcut. Description : NetHack 3.3.2 Command Line : C:\GAMES\NETHACK\WINHACK.EXE (changing the directory in the Command Line to the appropriate one of course) 9. Play NetHack. If it works, you're done! PROBLEMS If you encounter a bug and wish to report it, please send e-mail to: nethack-bugs@nethack.org If you have any comments or suggestions, feel free to drop us a line c/o: DevTeam@nethack.org You may wish to vist the NetHack Development Team's website occasionally to check for updates or known bugs. The website can be found at: http://www.nethack.org Happy NetHacking!