Operating System / Compilers
Windows and Cygwin32 (by John I'anson-Holton)
Windows and Lcc-win32 - Command line (by John I'anson-Holton)
Windows and Lcc-win32 - IDE (by 'Pinotage')
Linux (by Steven Fuerst)
OpenBSD (by Steven Salter and Steven Fuerst)
Carbonized MAC (by Ron Anderson)
Windows and Cygwin32
Zangband should compile "out of the box" with the Cygwin32 compiler. You may download the compiler by following the links from here.
In order for the compilation to work, you must install Cygwin into your chosen directory and make sure your PATH points to the directory in which gcc.exe is located. This will usually be 'c:\cygwin\bin'.
Next, open a DOS session and change directory to zangband\src. At the command prompt, type 'make -f makefile.cyg install' which will create the binary and move it to the correct directory. To clean up all the files object and other files created during the compilation process, at the command prompt, type 'make -f makefile.cyg clean'.
Windows and Lcc-win32 (Command line)
Zangband should compile "out of the box" with the Lcc-win32 compiler. You may download the compiler by following the links from here.
In order for the compiation to work, you must install Lcc-win32 into your chosen directory and make sure your PATH points to the directory in which lcc.exe is located. This will usually be: c:\lcc\bin.
Once Lcc-win32 is installed, locate the file 'makefile-lcc32.win' in your zangband\src direcory and then change its name to 'makefile'. You may need to edit the file so that the directory locations found near the top correctly point to zangband's location on your hard drive.
Next, open a DOS session and change directory to zangband\src. At the command prompt, type 'make' which will create the binary. Once the compilation process is complete, move the binary file (zangband.exe) to the correct directory.
Windows and Lcc-win32 (IDE)
Although Zangband can be compiled "out of the box" with the Lcc-win32 compiler using the command line. You may wish to instead use the built-in Integrated Development Environment.
To do so, start up the IDE. From the 'Project' menu, choose 'Create' and give your project a name (presumably 'Zangband').
You will now be brought to a new dialogue box. In the 'Working directory' field, enter the full path to your zangband\src directory. The output directory will fill in automatically. Remember to also select the radio button specifying a "Windows executable'. Now press the 'Create' button.
You will now be asked whether or not you wish to use the Wizard tool to help create your project. Answer 'No'. This is important.
You will next be brought to a dialogue box to allow you to select the files to be included in your project with a long list of files ending in '.c' showing on the left. Click on the 'Add all' button and then individually remove all the main*.c files except main.c and main-win.c by highlighting them in turn and clicking the 'Remove' button. Also remove the maid-x11.c file. Now, change the 'List files of type' selector from 'C sources' to 'resources' and add the file 'angband.rc'. Finally, click on the 'Validate' button.
At the next dialogue box - Compiler Settings - you can just hit the 'Next' button. If you want to reduce the binary size you may deselect the debugging options that are checked. *Do not* select the optimizer.
At the next dialogue box - Linker settings - in the 'Additional libraries' field, replace the default library with 'winmm.lib' which is neaded to get graphics running. Also check the radio button for 'Windows appl'.
At the next dialogue box - Debugger settings - simply press the 'Finish' button. You will be prompted to open a number of files and should respond 'Yes'. Lcc will open all the source files and proceed to automaticaly create a makefile.
You may now compile Zangband by choosing 'make' from the 'Compiler' menu. Once the process is finished, you will need to move the file 'zangband.exe' from the 'zangband/src/lcc' directory to the 'zangband' directory.
Get the source code, and unzip it with the -aL option to make the filenames lowercase, and to fix the differences in CR/LF conventions between MSDOS and unix.
"unzip -aL zangband.zip"
Next, change directory to the to the zangband/src directory and copy the standard unix makefile:
"cp makefile.std makefile"
Now, decide if you want to use graphics, XAW or a console. Note that if you want graphics, then only X11 and XAW work properly. (The makefile.lsl file gives out of date console graphics ... but it looks horrible with many tiles missing.) Get the graphics pack, and unzip it and then move the files to the lib/xtra/graf directory. Note that the filenames should be in lowercase.
If you want 8x8 graphics - don't copy the 16x16.bmp file. The game first looks for 16x16.bmp, and if that isn't found 8x8.bmp.
The current makefile should "work out of the box", but you may want to make changes. To use XAW instead of X11 - uncomment the second set of flags looking like:
#CFLAGS = -Wall -O2 -fno-strength-reduce -m486 -pipe -g \ # -D"USE_XAW" -D"USE_GCU" -D"USE_TRANSPARENCY" #LIBS = -L/usr/X11R6/lib -lXaw -lXext -lSM -lICE -lXmu -lXt -lX11 \ # -lcurses
Add hashes in front of the default settings above, and uncomment these lines by getting rid of the #'s. Have a look at the other options - they may work better than the defaults.
Next, compile the game by typing "make" in the /src directory. There should be no errors or warnings in a release version.
Starting in X:
Go up to the main directory. The executable should be there. It should be called "zangband".
Now if you were in the console, and included GCU/ncurses in the makefile - everything should work. Otherwise, you probably will want to do some tweaking.
To use graphics mode, run with the -g option. ie. The graphics mode makes the console version look much better, and turns on the tiles in X.
If you are running in X - you probably will not like the huge number of windows that pop up. To use less, use the following:
"zangband -g -- -n3"
to get three windows with tiles, for example. Note the use of the "--" to talk to the platform-specific main.c file.
To alter the size of the windows in X11 (not XAW), edit z-config.h and look for the lines:
/* * OPTION: Default fonts (when using X11) */ #define DEFAULT_X11_FONT_0 "10x20" #define DEFAULT_X11_FONT_1 "9x15" #define DEFAULT_X11_FONT_2 "9x15" #define DEFAULT_X11_FONT_3 "5x8" #define DEFAULT_X11_FONT_4 "5x8" #define DEFAULT_X11_FONT_5 "5x8" #define DEFAULT_X11_FONT_6 "5x8" #define DEFAULT_X11_FONT_7 "5x8"
Change the strings to whatever font you want. The size of the font scales the window size. Hint: the fonts you can select are _not_ the ones in the /lib/xtra/font directory. You can get a list of the available ones by typing:
Note that only fixed sized fonts currently work. (They are the ones with the short names. ;-) ) Does anyone have a 16x16 fixed size font? The DevTeam is looking for one. It should make the Adam Bolt tileset look much better...
Once you have changed the default font sizes - you must recompile for the changes to take effect.
You can also change the font sizes by setting environment variables. For an example on how to do this - look at the shell script in the comment at the top of main-x11.c
There are several other things that can be changed via environment variables. These include window placement and gamma correction.
Gamma correction: The lower the number, the brighter the colours. Since [Z]angband only uses integer arithmatic- if you try numbers that are too high / low you may get strange results. A gamma of 256 gives the old "normal" palette. To set this to the correct value for your monitor (say 1.6) do the following:
1.6 -> (1/1.6 * 256) giving 160.
Most options can also be changed by settings in the .Xdefaults file in your home directory. You'll need to use the source to see how to do this though...
Steven Salter reports that the Linux instructions above will also work with OpenBSD v2.7 but that the following line needs to be added to CFLAGS:
Note: An option for OpenBSD with this line added has now been included in makefile.std.
- USE_TRANSPARENCY should be defined somewhere.
- Launch ProjectBuilder
- File/New Project...
- Create a new Carbon project
- Add zangband source files to Source group (portable code and single main_mac_carbon.c file)
- Add Files... "zangband.icns" to Resources group
- Add Frameworks... "System.framework", "QuickTime.framework", "Carbon.framework", "CoreFoundation.framework", where necessary
- Select the target
- Select the Build Settings tab
- Set "Installation Location" to "None"
- Set "Compiler Settings" to Level 3 for both dev and deploy
- Select "Application Settings" tab
- Set "Executable" to "zangband"
- Set "Identifier" to "com.angband.zangband" (name of preference plist file)
- Set "Type" to "APPL"
- Set "Signature" to "A271"
- Set "Icon file" to "zangband.icns"
- Set "Version" to "2.5.2b"
- Set "Display name" to "Zangband"
- Set "Get-info string" to "Zangband"
- Set "Short version" to "2.5.2b"
- Build by clicking on hammer button (top left button)
- Success should create a new executable!
- Verify that all text files under lib/ have UNIX line endings. (\n == 0A)
- I've added sound support. Volume is modified with Command-< or Command->
- Graphic tiles are in lib/xtra/graf/16x16.gif and lib/xtra/graf/8x8.gif (QuickTime on MacOSX does not support BMP yet)
- Configure sound.cfg file with sounds!