The Angband and Linux Frequently Asked Questions

This document lists answers to questions about playing Angband on a Linux system. Several tweaks are necessary to make Angband and its variants work in the best way possible. It deals with issues like compiling, colour, and keyboard configuration. Angband in general is not discussed; for general information on Angband and variants, I recommend http://www.thangorodrim.net. Most of the answers should work for any variant, not only vanilla.

I (Remco Gerlich, scarblac@pino.selwerd.cx) am only the compiler of this FAQ; I don't think I actually contributed any of the answers. In fact, I asked most of these questions myself, I think :-).

Thanks to, among others, Greg Wooledge, Keldon Jones, Gwidon S. Naskrent, and Linley Henzell.

This FAQ assumes installing Angband 2.8.3, but it will work just the same with virtually any modern variant.

All of the extra files, patches and so on in this FAQ can be found in a tarball at http://www.thangorodrim.net/linux/faq_files.tar.gz.

This file itself is at http://www.thangorodrim.net/linux/faq.html (html) and http://www.thangorodrim.net/linux/faq.txt (text).

Contents

Part I: Getting Angband

  1. Where can I get Angband and its variants?
  2. Where do I put the files?
  3. How do I compile Angband?

Part II: Problems with running Angband on the console

  1. How do I improve the colour? What should be slate shows as light blue.
  2. How do I get running with shift-keypad to work, and "alter grid" with ctrl-keypad?
  3. Can the walls look like blocks instead of #, like the IBM-dos version does, for instance?
  4. The game reacts very slowly to the Escape key. What's up?

Part III: Problems with running Angband under X Windows

  1. Angband opens 8 Windows when it starts up. How do I turn this off?
  2. I walk using the keypad, and the game gives illegal command messages all the time, although it does walk. What's up? Why can't I walk using shift-keypad?

Part I: Getting Angband

1. Where can I get Angband and its variants?

At ftp://clockwork.dementia.org . You need the source archives. Angband 2.8.3 can be found as ftp://ftp.sunet.se/pub/games/Angband/Source/angband-283.tar.gz while variants can be found in the directory ftp://ftp.sunet.se/pub/games/Angband/Variant/ Although sometimes the latest versions will still be in /Variant/, where they are invisible. A good place for all the latest news is http://www.thangorodrim.net.

2. Where do I put the files?

If you compile the game only for yourself, it doesn't really matter; somewhere in your home directory is fine. If you want to install it so that multiple users can play it, you can install it as user "games". Personally I put my files under /usr/local/games/angband/, and all of /usr/local/games/ is owned by the user "games". I'll assume that for now. You'll need to have access to that dir, of course.

I put Angband 2.8.3 under /usr/local/games/angband/angband-283/, then make a symlink so that it is also called angband, so that when Angband 2.8.4 comes out I can put that in its own dir, and just change the symlink.

Place the .tar.gz in /usr/local/games/angband/, and type "tar xvzf angband-283.tar.gz", and it will untar itself into the right directory. If the source comes in .zip format, you should unzip it using "unzip -aL", so that filenames become lowercase, and any MS-DOS format text files are properly converted.

Some variants may unpack into a different dir, in which case you should rename it. "ln -s angband-283 angband" will make the symlink.

3. How do I compile Angband?

Compiling is easy, provided you have a good version of gcc installed (as most linuxen have). Take the following steps, in the src directory:
  1. Decide whether you want to run Angband on the console (text mode, full screen), or under X (in Windows, so it seems smaller, but you can use extra windows for extra info), or both.
  2. Read the later sections to see if you need any changes to the source code, like applying any patches. Perform those changes.
  3. Edit the makefile. First, copy Makefile.std to "makefile". Use an editor that doesn't change tabs to spaces (that's most of them, find the lines that say CFLAGS = and LIBS =. Comment them out by putting a # there as the first character of the line, then use instead:
    CFLAGS = -Wall -O2 -m486 -pipe -g -D"USE_XAW" -D"USE_GCU"
    LIBS = -L/usr/X11R6/lib -lXaw -lXext -lSM -lICE -lXmu -lXt -lX11 -lcurses
    
    This supports both X windows and the console. For console only use:
    CFLAGS = -Wall -O2 -m486 -pipe -D"USE_GCU"
    LIBS = -lcurses
    
    And for X Windows only use:
    CFLAGS = -Wall -O2 -m486 -pipe -g -D"USE_XAW"
    LIBS = -L/usr/X11R6/lib -lXaw -lXext -lSM -lICE -lXmu -lXt -lX11
    
    Most people will just want to support both.
  4. Compile, by typing "make" in the src directory.
  5. The executable is now in the directory above src.

    With some variants, it will be called "testing", for some historical reason that probably looked like a good idea at the time. Rename it to something like "zangband".

    If you are building the game as user "games", you can now do "chmod +xs angband" which makes the game executable for everyone, while turning on the "suid bit". That bit makes the game run as if it were user "games", so that the game has write access to savefiles and so on, but normal users don't.

  6. You may also want to put a startup script in /usr/local/bin, for instance like this:
    cd /usr/local/games/angband/zangband
    TERM=linux-c-nc
    stty start undef
    exec ./zangband $1 $2 $3 $4 $5
    TERM=linux
    stty start ^Q
    cd $OLDPWD
    clear
    reset
    
    This one is for Zangband of course, to illustrate a few points. The directory is a symlink to zangband225e/, so I don't have to change this script every two days when a new Zangband comes out. I just change the link. The two TERM= lines are to set the terminal right for Keldon's new main-gcu, as explained in the console problems section. Also, Zangband uses ctrl-Q as a command, but that key has special meaning under Linux; the two stty commands turn that meaning off, and later on again, so that the key can be used. The "cd $OLDPWD" is useful, but may only work under bash, I'm don't know. The "reset" prevents the text from staying brown after the game finishes, a side effect of Keldon's gcu patches.

    Or just run the game as ./angband in whatever directory you put it in.

Part II: Problems with running Angband on the console

4. How do I improve the colour? What should be slate shows as light blue.

Angband tries to redefine colours with curses, but apparently it doesn't do it completely correclty. Luckily, Keldon Jones solved this; see the page at http://www.umr.edu/~keldon/ang-patch/ncurses_color.html.

In short, you take the new main-gcu.c and copy it into the src/ dir, and put the graf-gcu.prf in lib/user/. You also need a new terminfo entry. Get linux-c-nc.terminfo and compile it using "tic linux-c-nc.terminfo". Since this will put the compiled version at the right place for terminal definitions (/usr/share/terminfo/ under Red Hat linux), you will need to be root to do this. All these files are in the tarball that goes with this faq, see the top of this file.

Now use TERM=linux-c-nc before you run Angband in the console, and the colours will be fixed.

Note that some variants, like Zangband, already have the new gcu files, so that you only need the terminal file.

5. How do I get running with shift-keypad to work, and "alter grid" with ctrl-keypad?

The standard Linux keymaps don't see a difference between the normal keypad arrow and the shift/ctrl versions, so some more magic is needed. Linley Henzell wrote some very useful documentation with his roguelike Crawl, where the same thing is needed. Quoting from that file:

First you'll need a copy of the keymap normally used by your machine. On Red Hat-systems you can find out the name from the file /etc/sysconfig/keyboard. The keymaps reside in the directory /usr/lib/kbd/keytables, so you can propably figure out the one you use by looking at the filenames there. Copy this somewhere safe, like your homedirectory and use your favourite editor on the copy (not the original, mind you). The keymap might be compressed, so you might do well to run gunzip on it.

First we'll need to define the functions that the keys will be bound to, and make them produce strings that we can use to define the keyboard macros for Crawl. So enter the following lines into the keymap-file.

string F101 = "\033[1C~"
string F102 = "\033[2C~"
string F103 = "\033[3C~"
string F104 = "\033[4C~"
string F105 = "\033[5C~"
string F106 = "\033[6C~"
string F107 = "\033[7C~"
string F108 = "\033[8C~"
string F109 = "\033[9C~"

string F111 = "\033[1S~"
string F112 = "\033[2S~"
string F113 = "\033[3S~"
string F114 = "\033[4S~"
string F115 = "\033[5S~"
string F116 = "\033[6S~"
string F117 = "\033[7S~"
string F118 = "\033[8S~"
string F119 = "\033[9S~"
Then we need to bind the keys to the functions. Search for a line that along the lines of 'keycode xx = KP_7'. Add the following lines somewhere close to the line you found.
control keycode xx = F107
shift   keycode xx = F117
Of course, you'll need to replace the xx with the value you found in your own keymap-file. Now, whenever you press Shift-keypad 7 the computer acts as if you typed an escape, followed by '[7S~'. Repeat this for all keypad keys, i.e KP_1 - KP_9, but replace the final digit in the F1-strings with the number of the keypad key (ie. 'control keycode xx = F108 for KP_8). After that you can load your new keymap using the loadkeys program on the file.

(End quote)

The tarball contains my version of this, which is adapted from the us.map keymap that came with Red Hat 5.2. It may or may not work for you. It does the same thing with control as with shift.

This keymap can now be loaded with "loadkeys <filename>". It works for all virtual consoles, until the system reboots. You may want to put this in a bootup script.

Now that Linux can recognize the keys, we need to tell Angband what to do with them. For that, pref-gcu.prf needs extra keymaps. Put these into pref-gcu.prf (maybe some maintainers read this faq and put them there already :-)):

A:+0
P:\e[0C~

A:+1
P:\e[1C~

A:+2
P:\e[2C~

A:+3
P:\e[3C~

A:+4
P:\e[4C~

A:+5
P:\e[5C~

A:+6
P:\e[6C~

A:+7
P:\e[7C~

A:+8
P:\e[8C~

A:+9
P:\e[9C~

A:\\.1
P:\e[1S~

A:\\.2
P:\e[2S~

A:\\.3
P:\e[3S~

A:\\.4
P:\e[4S~

A:\\.5
P:\e[5S~

A:\\.6
P:\e[6S~

A:\\.7
P:\e[7S~

A:\\.8
P:\e[8S~

A:\\.9
P:\e[9S~

A:\\.0
P:\e[0S~

6. Can the walls look like blocks instead of #, like the IBM-dos version does, for instance?

Sure. Use Keldon's patch as described in 4, and run the game with option -g. The new graf-gcu.prf is used for this.

7. The game reacts very slowly to the Escape key. What's up?

This is seperate from Angband, it is a bug somewhere else, in ncurses, if I recall correctly.

The fix for this is to use the "`" key, which is right below Escape on most keyboards. This is already compiled into Angband to work as a synonym for Escape, apparently. Takes a while to get used, but it's much faster.

Part III: Problems with running Angband under X Windows

8. Angband opens 8 Windows when it starts up. How do I turn this off?

It is hard to turn it off completely, but easy to let most Windows be iconized when the game starts up.

Angband takes its default settings for Window sizes and so on from ~/.Xdefaults, like a good program should. Since this question is The Question Frequently Answered By Greg Wooledge, I'll just paste his .Xdefaults entries here:

angband*angband*font:		9x15
angband*angband*geometry:	+300+220
angband*recall*font:		7x13
angband*term-1*font:		7x13
angband*recall*geometry:	80x15+460+0
angband*term-1*geometry:	80x15+460+0
angband*choice*font:		7x13
angband*term-2*font:		7x13
angband*choice*geometry:	+0+440
angband*term-2*geometry:	+0+440
angband*mirror*font:		7x13
angband*term-3*font:		7x13
angband*mirror*geometry:	80x15+460+590
angband*term-3*geometry:	80x15+460+590
angband*color6:			#3070f0
angband*color7:			#907027
angband*term-4*iconic:		true
angband*term-5*iconic:		true
angband*term-6*iconic:		true
angband*term-7*iconic:		true
Put this in your own .Xdefaults. It opens up the Angband Window, and three extras to be used as windows for monster recall, and so on. You may need to adjust the actual sizes of the windows and so on to your own wishes.

9. I walk using the keypad, and the game gives illegal command messages all the time, although it does walk. What's up? Why can't I walk using shift-keypad?

Try toggling Num Lock.

(yes, the last question is 10 times as long as its answer. I like that :-)).