We already established that terminally incoherent readers love them some nethack. The nice thing about nethack is that it takes only few hundred kb on your drive, and provides you with endless tons of entertainment. But hell, you don’t even need to install it. All you need to taste the nethack goodness is telnet.
There are several public nethack servers that let you play via telnet. The biggest and most popular one is located at alt.org. Or at least they are the one that shows up on Google results first. You simply telnet in, create an account and play online. This is such an awesome concept that I decided I need some of that. I want my own public server! This would be a perfect new role for that funky old Compaq Presario sitting under my desk and currently running Ubuntulite. So I started digging around for a solution.
And I hit a brick wall because the documentation for this kind of stuff is scant and/or nonexistent. Nevertheless I persevered and you can see the end effect at luke.kicks-ass.org. Sorry for the dyndns domain name, but this is a temporary sort of a thing. For now you can simply telnet in and play. I will probably keep the machine running over the weekend unless you guys manage to crash it. ;)
Note: Use PuTTY or some real terminal client. The windows cmd.exe messes up the menu layout pretty badly. But I’m not sure if there’s anything I can do about it.
Once again, if you want to try out the server, just do:
It’s running on port 23, and it should log you in automatically. From there you need to (r)egister an account. I don’t use the emails for anything, so when asked just type in anything as long as it has an email syntax. There is no email activation or any of that shit. Username and password are up to you. Just remember that this is telnet – so your password will be sent in plain text. Make up some silly one that you won’t be using elsewhere and you won’t cry when you lose it. When you are done it should dump you back at the initial prompt. There you can either (l)og in to play or (w)atch someone else play. Chances are no one is playing yet so log in.
On the next screen you will see bunch of options. Note that I left the nethack config files in bare bones state. You will probably want to use the “o” option to edit your options file to include the number_pad:2 bit that makes movement little easier for people who don’t like HJKL. The editor that ships with dgamelaunch is a vim clode so just fucking deal with it. Move down to one of the uncommented OPTIONS lines add number_pad:2 at the end, press Esc, then :wq and you should be back at the prompt. ;) Now all that is left is to (p)lay.
Let me know how the server works for you. It may be a bit slow (the box is a very old laptop siting on an asymetric residential connection) but then again, this is nethack. You don’t really need rapid speed here. If you like it I might try to figure out a way to make this a permanent fixture of the site. :)
Here is a screenshot of me playing from my winXP box via PuTTY by telneting to luke.kicks-ass.org:
What follows below is the lengthy account of the issues I encountered while setting up this damn thing. If you don’t care about installation details, just skip down to comments.
So, how do you run a public nethack server? First you need the server software. Most servers out there use DGameLaunch which works, but is a major pain in the ass to use. It’s not in the repositories so you will need to download it from the website, compile and configure it yourself. And let me tell you it’s not a picnic. First, you will need to download few dependencies. You will need ncurses development headers, a telnet server and two lexical analyzers flex and bison. You also, obviously need gcc and make to compile the code. And naturally, nethack. You may already have these things on your system – my bare bones install of Ubuntulite didn’t. Just in case run the following:
aptitude install libncurses5-dev bison flex telnetd gcc make nethack-console
Allright, now we can get the server software and compile it:
wget ftp://ftp.alt.org/pub/dgamelaunch/dgamelaunch-1.4.6.tar.gz tar -xzvf dgamelaunch-1.4.6.tar.gz cd dgamelaunch-1.4.6/ ./configure make sudo make install
Have fun. I know I did, because the only documentation that ships with dgamelaunch is a 6 Kb README file. Out of the 117 lines of text it contains, maybe 3 or for actually mention compilation and dependencies. This means that you need to pay close attention to the output of make. Funny thing is that the configure script noticed that I don’t have bison/yacc or flex/lex but did not consider that a stop condition and gleefully generated a makefile. Of course without these apps make would die a horrible death in a flurry of semi-random error message. Same goes for the ncurses header files – it knew it was missing, but did nothing. Thanks!
By default, dgamelaunch will get installed into /usr/local/. Once you compile it you need to do two things. First copy the dgamelaunch.conf from the examples folder to your /etc:
sudo cp examples/dgamelaunch.conf /etc/
Next you want to create chroot jail in which the server will be running. There is a script that does that which ships with dgamelaunch. Simply run it and you should be all set:
It should create /var/lib/dgamelaunch directory and dump bunch of files in there. In my case the script failed to do all the work so I had to do few things manually. Most of this I figured out by trial and error because the README file only gives you cryptic hints on what to do if things go sour.
For example, the script keeled over trying to copy appropriate libs to the chroot directory. It kept failing with an error message pointing out that it can’t find some file, but instead of printing out the file name it would print out a hex value (memory address?). I looked at the script and noticed this was the very last few lines. It also had some small comment which suggested which libraries will probably get imported.
I manually copied all the listed file from /lib/ to /var/lib/dgamelaunch/lib/ then tried to run the binary. It kept failing telling me about other missing files. After 3 or 4 tries I got the full complement of needed libraries. If this happens to you, here is what you should do:
sudo mkdir /var/lib/dgamelaunch/lib/ sudo cp /lib/ld-linux.so.2 /var/lib/dgamelaunch/lib/ sudo cp /lib/libc.so.6 /var/lib/dgamelaunch/lib/ sudo /lib/libdl.so.6 /var/lib/dgamelaunch/lib/ sudo /lib/libdl.so.2 /var/lib/dgamelaunch/lib/ sudo /lib/libncurses.so.5 /var/lib/dgamelaunch/lib/
I also needed to populate /var/lib/dgamelaunch/etc/terminfo with files from /lib/terminfo. For some reason the terminal descriptions were not copied over to this location by the chroot script. I’m not sure this was intended behavior or just a glitch. If you are having problems running the game or the server interface take a peek in this folder. If it’s empty do the following:
sudo cp /lib/terminfo/* /var/lib/dgamelaunch/etc/terminfo/
Btw, when you are testing you need to run dgamelaunch with sudo. This is actually a small tidbit of knowledge that is outlined in the README file. Once you can run the app, register and account, edit the option file, and play few rounds of the game, you can move on to the next stage.
Now all we need to do is set up a telnet server so that people can connect and play. Of course This is the one place where the readme actually does offer you some help. Make sure telnetd is installed, and simply copy and paste the following file into your /etc/inetd.conf:
telnet stream tcp nowait root.root /usr/sbin/tcpd /usr/sbin/in.telnetd -h -L /usr/sbin/dgamelaunch -q -f /etc/dgamelaunch.conf
This may or may not work for you. It work for me. The -L option telnetd in feisty is retarded and doesn’t allow you to use any command line parameters to the shell you are specifying with it. The README file actually mentions that near the bottom. It also mentions that you can use an abridged version of this line:
telnet stream tcp nowait root.root /usr/sbin/tcpd /usr/sbin/in.telnetd -h -L /usr/sbin/dgamelaunch
If you do however it is important to make sure your dgamelaunch.conf is in the root of the /etc directory. If you plan place it in a subdirectory, you have to change the make file before you compile it. Check the README file for hints on how to do this.
After you change the inetd.conf file you want to restart the inetd server. There are several ways to do this, but a simple way that will work on just about any platform is:
killall -HUP inetd
This kills the process and forces it to restart and re-read it’s config file. It’s a tad brutal way to do it so don’t use it on a shared machine or one that is actually handling some critical data. What the hell are do doing installing nethack server on a critical server anyway?
If you do all of the above, you should have a working dgamelaunch installation, and a working telnet server. Just telnet in, and play. :) Id not, post in the comments and we can maybe figure out what is going on together.
tldr: dgamelaunch documentation sucks balls, but setting up the server is doable
[tags]nethack, nethack server, dgamelaunch, public nethack server[/tags]