MAngBand on Linux

General discussion about the game. Pull up a stool and tell us your tale!
SpaceHunter
Human Zombie
Posts: 28
Joined: Sat 31.05.2003, 23:11
Location: ChIcAgO

MAngBand on Linux

Post by SpaceHunter » Fri 19.09.2003, 17:41

Hey Guys and Gals, i installed MDK9.1 (Mnadrake 9.1) Linux Distribution not to long ago, and i have been wondering how am i suppose to install Mang on it    :-X , i have got ToME(offline) working, but i have no idea what files i should modify to install it, i downloaded the newest source. if there is any one out there who can help me out, please either post a reply here, or AIM@ SpaceHunter0317

Thanks.....
In this world you seem to have it all, you seem to have control, but deep within your soul, you're loosing it all.
A4X

Berendol
Evil Iggy
Posts: 868
Joined: Mon 11.11.2002, 19:13
Location: Loot Pile
Contact:

Guide to MAngband on Linux

Post by Berendol » Sat 20.09.2003, 19:23

Berendol's Guide to MAngband on Linux
Original Version

INTRODUCTION:
Here it is, and please direct anyone else asking how to play on Linux to this post. You may not distribute this text in whole or in part, because I can't update your copy if something turns out to be wrong or inefficient later.

All instructions assume you are at a terminal window or in console mode unless you have been previously directed to be elsewhere.

This document is meant to be read top-to-bottom, so don't just jump to the section that looks right. You'll miss important information.

Important: If you don't know what you're doing enough to fully understand everything except the Tips and Tricks section... you should be using Windows to play until you understand this document. You could really mess things up if you don't.

Also important: You should NOT do this as root. In fact, you shouldn't use root for anything other than admin purposes. MAngband will compile and run as a normal user. If you su to root to do all this, your normal user won't have enough access privileges to the files to play - so don't do that.

BEFORE YOU BEGIN:
First off, make sure you have the software you'll need to compile it, and that it works properly.

SOFTWARE REQUIREMENTS:
All of these are available in tarballs somewhere, but if your distribution uses a package format such as .deb or .rpm, get them in package form from your distribution's CDs or FTP sites. Debian users should use apt-get. All of these are the binary packages - you don't need their source code. Make sure all dependencies are resolved, NOT ignored.
* GNU Tar
* GNU GZip
* GNU Make
* GCC
* libncurses and libncurses software development files (libncurses-devel)
* xfree86 software development files (xfree86-devel)
* XFree86 (aka X11 or X-Windows, the preferred Linux GUI)

HOW TO TEST GCC:
1) Create a test.c file somewhere (/tmp is a good place) that contains this line, and only this line:
void main() { printf("It works.\n"); }
2) Make sure you're currently in that somewhere, and type 'gcc test.c -otest'
3) If step 2 completes without errors (warnings don't count, expect two lines of warning) then type './test' --- and if it says it works, then it does. Now move on to the compilation instructions.

COMPILATION INSTRUCTIONS:
1) Download the current source tarball, which as of this writing is mangband-072a.tar.gz
2) Move the tarball to a directory where you have sufficient disk space to compile. I suggest having 40MB for this process, although it won't use most of it. If other users will be playing, /usr/local is a good place, but you might need to do this as root and chown and/or chmod it all later if you decide to put it there.
3) Unpack the source with 'tar -xzvf mangband-072a.tar.gz'. If your tar doesn't support the -z option, use gzip to decompress it manually, then omit the z in the tar command above, and note the changed filename.
4) CD into the newly created directory.
5) Compile it with 'make'. The default configuration (X11, console mode) should be fine for most X86 Linux systems. This will take a long time on older computers.. it takes 20 minutes on my P-200 and about 5 on my P3-900. Having a lot of RAM will help speed up this process.

PLAY INSTRUCTIONS:
1) Change into the directory you typed 'make' in above.
2) Type './mangclient'
That's it.

TIPS AND TRICKS:
* If you want to run your own server, the commands you'll use are mangband and mangconsole. But, before you do that, make sure you have looked at mangband.cfg and edited it appropriately.
* Make MAngband marginally optimized by removing debugging and enabling various optimizations and system-specific code generation (use the -march tag) in the distribution's src/Makefile. This is my CFLAGS line: CFLAGS = -Wall -pedantic -funroll-loops -fomit-frame-pointer -fstrength-reduce -floop-optimize -march=i586 -pipe -D"USE_X11" -D"USE_GCU" -I/usr/include/ncurses
* If you make a change to a header file, you have to delete all the object files yourself.
* If another user wants to play, make that user a directory with the lib/ directory, and the files 'mangclient' and 'mangrc'. Don't forget to give the whole mess privileges sufficient for that user to play. Another way is to move everything to /usr/local, create a group for games, chown the whole MAngband tree to yourself:games with permissions u+rwxg+ro+r (with g+x for the scripts and binaries of course) and grant membership to games to everyone who wants to play. I'd put a shell script in their path somewhere so they can easily play the game.

FINALLY:
If you need more help, post on the MAngband.org forums - don't email me, because there's only one of me, and hundreds of people on the forums. I'll just redirect you there, anyways. Thanks!
- Berendol, 9-20-2003
By appreciation, we make excellence in others our own property. (Voltaire)

SpaceHunter
Human Zombie
Posts: 28
Joined: Sat 31.05.2003, 23:11
Location: ChIcAgO

Re: MAngBand on Linux

Post by SpaceHunter » Sun 21.09.2003, 14:20

wheee, thnks Berendol, i installed it and all, but there is one annoying problem with Mang on linux, i can't seem to be able to configure the size of windows which makes it rather annoying, and the other thing is, that i cant move using arrows keys or numpad, i need to use the numbers right below the F(X) keys, which is rather annoying =( any tips on how to change that?
In this world you seem to have it all, you seem to have control, but deep within your soul, you're loosing it all.
A4X

SpaceHunter
Human Zombie
Posts: 28
Joined: Sat 31.05.2003, 23:11
Location: ChIcAgO

Re: MAngBand on Linux

Post by SpaceHunter » Sun 21.09.2003, 14:55

well, i can use arrow keys to move now, but when i move i get spammed with Time out mark msg's, im on DSL, Linux MDK9.1 Fully updated, 633Intel Celeron (sucks... ) 192RAM, and i cant resize like i said b4, any1 got a fix? dont be shy ^_^ reply to the post lol, every tip will be counted in for, thanks again
In this world you seem to have it all, you seem to have control, but deep within your soul, you're loosing it all.
A4X

Maegdae
Giant Mottled Ant Lion
Posts: 218
Joined: Sat 26.10.2002, 16:52

Re: MAngBand on Linux

Post by Maegdae » Tue 23.09.2003, 23:54

Very nice, compiles and runs perfectly with and without your CFLAGS line on Suse Linux 8.2.    (Window manager FVWM2. )  Thanks for writing this.  A few problems, however.

#1.  It makes me put the windows down with standard size every time I start the game.   So I have to resize everything every time I start the program.  Any way to save window changes?

#2.  When I resize the windows, it does not resize the text inside of them, so it's impossible to fit everything in the space required.  (Make the windows smaller and text gets lost.)  Is there a way to change font size for the windows?
Version 3.12
GAT d- s++:- a14 C++++ UL+ P L+ E? W+ N+ o? K---- w--- O-- M-- V? PS--- PE++ Y+ PGP- t+ 5? X- R+ !tv b+++ DI+++ D+ G+ e- h! !r !z

Karnath
Singing, Happy Drunk
Posts: 5
Joined: Mon 29.09.2003, 09:23
Contact:

Re: MAngBand on Linux

Post by Karnath » Mon 06.10.2003, 02:54

I have MDK 9.1 too.... My linux client don't save macros and user option, so every time I begin a game I have to set all.... Someone can help me please? I try to change in some way the path of lib directory, but it does not work. I am thinking it is a permission problem (perhaps) but as I am not so expert with linux, I hope in a enlighted answer  ;)

Thanks
Karnath The Blue

Karnath
Singing, Happy Drunk
Posts: 5
Joined: Mon 29.09.2003, 09:23
Contact:

Re: MAngBand on Linux

Post by Karnath » Mon 06.10.2003, 12:05

Okay... The guide is very usefull and I solved many problems.... However I cannot start an internet server.... What type of permission do you suggest to start one?

Thanks
Karnath The Blue

Berendol
Evil Iggy
Posts: 868
Joined: Mon 11.11.2002, 19:13
Location: Loot Pile
Contact:

Re: MAngBand on Linux

Post by Berendol » Mon 06.10.2003, 14:00

NOTICE: SARCASM USED IN THIS MESSAGE

I'll try to answer some of your questions now. You'll excuse me if my memory is a little rusty in some respects.

OK, startup window position: Your window manager is responsible for this. If it won't save where the windows are, I suggest getting a different window manager that will. Either that, or you could play on Windows. You may now argue about the best window manager. Personally I don't really care if I have to move the windows around a little so long as my window manager works for everything else I do.

Window sizing automagically fixing fonts? What is this, professional software? We're still looking for an X11 coding guru who can do stuff like that with the client. If you have the skills, please share them with us! My recommendation: Don't resize your windows.

I have no recollection of where the font settings are for the X11 client. My guess would be in the top-level configuration files, or somewhere under lib/xtra/.  You can comfortably run MAngband at 1024x768 with the default fonts and sizes.

I run at 1024x768 myself. I usually have four term windows open besides the main window: one for equipment, one for inventory, one for messages, and one for chat. The EQ/Inv windows can stack on top of each other to the right, since the leftmost characters are the important ones. The messages window sits under the main window so its bottom line (newest messages) appear right away.

I'll tackle the whole setting up and maintaining a server issue some other time. Feel free to try poking around at settings yourself. That's what I did, and somehow I stumbled across a good combination. I had a great working setup for that on DServ involving /etc/rc.d and /etc/crontab and various other things, which I may just package up and distribute. Think Dynamo. The runserv script (I think that's what it is called) is pretty useful if you want to run a "quiet" server nonstop and you've already run it successfully before.

That's enough for now. I will check back someday soon and maybe even write a guide to running a Linux server.
By appreciation, we make excellence in others our own property. (Voltaire)

Karnath
Singing, Happy Drunk
Posts: 5
Joined: Mon 29.09.2003, 09:23
Contact:

Re: MAngBand on Linux

Post by Karnath » Tue 07.10.2003, 01:59

Thank you very much Berendol... I don't want annoy you, but I explain my specific problem, cos I think it's a simply problem of permission (and as you know I am not so experienced with linux). Well, when I start mangband server, from a local client I can play; however if I try to connect from another client (on my LAN) it says me: "That server either isn't up, or you mistyped the host name". That appens even I connect my server to metaserver list.

My server, as you suggest, run on my usr/local/mangband/

Thank you very much
Karnath The Blue

Karnath
Singing, Happy Drunk
Posts: 5
Joined: Mon 29.09.2003, 09:23
Contact:

Re: MAngBand on Linux

Post by Karnath » Wed 08.10.2003, 10:22

That's okay... Thanks to some Finnish friends I realized that my problem was to chmod to 755 all the directories of Mangband Server. Now my servere, when on-line, can be reached by the world :).
Karnath The Blue

Berendol
Evil Iggy
Posts: 868
Joined: Mon 11.11.2002, 19:13
Location: Loot Pile
Contact:

Re: MAngBand on Linux

Post by Berendol » Fri 10.10.2003, 10:59

Oh. Whoops, I missed that one! Yes, 755 (a+rx,u+w) is good for *some* of your directory tree. Make sure that the only account with +rx for mangband, mangconsole, and runserv is the server process' account, so nobody can start a rogue server process. (As in pirates, scum of the seas, not the game.) You can give +rx to whoever you want for mangclient.

For security purposes, I suggest you have src/, lib/game, lib/save, lib/text, lib/help, and lib/data permissions set so that nobody except the server process can write to, read from, or even list them - chown them all to whatever uid:gid you have the server running as, then chmod u+wrx,go-wrx. That's octal 700 if I'm not mistaken. Carefully use a recursive chown and chmod for those. The switch for recursive is -R. You may wish to allow your players to look at the lib/game directory if you have non-standard monsters or items in the game.

The most important reason for taking this extreme measure for security is that passwords are stored in the savefiles, which are located in lib/save. The savefiles are only encrypted with a simple XOR scheme based on previous bytes in the file, which means that anyone can download someone else's savefile and decrypt it - and voila, their password is clear-text. This is something I noticed while programming Dynamo, and it made some administration tasks much easier. Summary: Don't let your users read or browse lib/save.

The reason for disallowing access to lib/data is that all your logs will be stored there. This includes every action, every chat message, and every in-game message displayed on each of your users' screens. You don't want your users spying on each other, do you? I didn't think so.

It is important to disallow write access to lib/game so that your users can't modify your monsters, items, egos, etc. Your server *will* crash itself from time to time (my best uptime was less than two weeks, and my server was really stable) and it checks the text files for changes every time it starts up.

If you customize the client, or if your link is faster to your friends than MAngband.org's, you may also want to provide a tarball of the local source so your players can compile their own clients. Make sure you include lib/user and lib/xtra, and test the distribution yourself.

Please let me know via this thread if anything I told you to do breaks the game somehow. Thanks for reading!
By appreciation, we make excellence in others our own property. (Voltaire)

Crimson
King Lich
Posts: 315
Joined: Sat 26.10.2002, 15:00
Location: Mangband Project Team Member
Contact:

Re: MAngBand on Linux

Post by Crimson » Sat 18.10.2003, 12:46

as a quick update to that, keep in mind that if you feature access to the binary, you *must* include access to the code that produces it, that's in the LICENSE.

Crimson.
Are you not entertained?
Is this not what you came here for?

-- Maximus Decimus Meridias, The Gladiator

Crimson
King Lich
Posts: 315
Joined: Sat 26.10.2002, 15:00
Location: Mangband Project Team Member
Contact:

Re: MAngBand on Linux

Post by Crimson » Sat 18.10.2003, 12:48

343 posts Berendol?  Chatty thing, aren't you. :)
Are you not entertained?
Is this not what you came here for?

-- Maximus Decimus Meridias, The Gladiator

Berendol
Evil Iggy
Posts: 868
Joined: Mon 11.11.2002, 19:13
Location: Loot Pile
Contact:

Re: MAngBand on Linux

Post by Berendol » Tue 21.10.2003, 20:34

Yeah. I try to write meaningful posts here and there, too.
By appreciation, we make excellence in others our own property. (Voltaire)

n00b

Re: MAngBand on Linux

Post by n00b » Thu 22.01.2004, 11:18

Uff... ???

I just installed MDK 9.2...
Everything went fine until the point of compiling.
I think X11 is working fine, but I get huge amounts of errors from main-gcu.c
in example:  "client/main-gcu.c:907: error: syntax error before ')' token"

There are like 30 errors like that, including invalid use or undefined type, dereferencing pointer to incomplete type etc...

and I've got no coding experience whatsoever, so help is really appreciated!

Post Reply