Difference between revisions of "User:Paxed/HowTo setup dgamelaunch"

From NetHackWiki
Jump to navigation Jump to search
(small addition re. xinetd/inetd)
m (Compile NetHack: more needed changes)
Line 10: Line 10:
  
 
*Edit <code>src/cmd.c</code> and change function enter_explore_mode() so users cannot do that.
 
*Edit <code>src/cmd.c</code> and change function enter_explore_mode() so users cannot do that.
 +
 +
*Edit <code>src/topten.c</code>:
 +
**Change <code>NAMSZ</code> if you want to use longer usernames.
 +
**Change <code>ENTRYMAX</code> if you want the highscore list have more entries.
 +
**Comment out <code>#define PERS_IS_UID</code>, so that NetHack distinguishes users by their name, not by their UID.
  
 
*If you want watchers to be able to send mail scrolls, get dgamelaunch sources and apply the <code>nh343-simple_mail.diff</code> patch that comes with it.
 
*If you want watchers to be able to send mail scrolls, get dgamelaunch sources and apply the <code>nh343-simple_mail.diff</code> patch that comes with it.

Revision as of 21:06, 2 December 2010

Note: This applies to NetHack 3.4.3 and the svn-version of dgamelaunch, on linux. These instructions should be complete, but I haven't tested it lately.


Setup

To set up a public NetHack server using dgamelaunch svn version:

Compile NetHack

  • Make sure you can compile NetHack (the Linux TTY version).
  • Edit src/cmd.c and change function enter_explore_mode() so users cannot do that.
  • Edit src/topten.c:
    • Change NAMSZ if you want to use longer usernames.
    • Change ENTRYMAX if you want the highscore list have more entries.
    • Comment out #define PERS_IS_UID, so that NetHack distinguishes users by their name, not by their UID.
  • If you want watchers to be able to send mail scrolls, get dgamelaunch sources and apply the nh343-simple_mail.diff patch that comes with it.
  • Edit include/config.h and change HACKDIR to "/nh343" (Note that there are more than one definition of HACKDIR in there!)
  • Edit include/unixconf.h and change VAR_PLAYGROUND to "/nh343/var"
  • Edit top Makefile by commenting all lines that reference $SHELLDIR (We don't need to install the shellscript that is usually used to launch NetHack)
  • Edit top Makefile by changing PREFIX to the directory which will be the chroot environment and contain all the files the server needs. We'll be using "/opt/nethack/nethack.alt.org" here as an example.
  • Edit top Makefile by changing GAMEDIR to $(PREFIX)/nh343 (This must match HACKDIR in include/config.h)
  • Edit top Makefile by changing VARDIR to $(GAMEDIR)/var (This must match VAR_PLAYGROUND in include/unixconf.h)
  • Edit top Makefile by changing GAMEUID and GAMEGRP to the user and group you will run nethack as; by default these are games and games in dgl settings.
  • Create the binaries with "make all". If things went smoothly, do "make install" (or "make update" if you've already installed NetHack once to the chroot dir)
  • Continue on to dgamelaunch compiling.

Compile dgamelaunch

  • You need:
    • subversion to get the dgamelaunch sources
    • autoconf -packages
    • SQLite development libraries
    • bison (or yacc or byacc) (You should already have this if you compiled NetHack)
    • flex (or lex) (You should already have this if you compiled NetHack)
    • ncurses and ncurses development libraries (You should already have these if you compiled NetHack)
  • get the newest version of dgamelaunch:
svn co svn://triplehelix.org/dgamelaunch/trunk
  • Prepare for compilation:
cd trunk
./autogen.sh --enable-sqlite --enable-shmem --with-config-file=/opt/nethack/nethack.alt.org/etc/dgamelaunch.conf
  • Make dgamelaunch with "make"
  • Edit dgl-create-chroot and change the default settings to match your chroot location and so on, then execute dgl-create-chroot. It should copy all the necessary files and put them into the chroot environment.
  • Test that you can run dgamelaunch (as root):
cd /opt/nethack/nethack.alt.org
./dgamelaunch
  • Edit /opt/nethack/nethack.alt.org/etc/dgamelaunch.conf to suit your needs:
    • 'max_nick_len' should be kept at 10, unless you change NAMSZ in src/topten.c and recompile NetHack.
    • 'chroot_path' should be "/opt/nethack/nethack.alt.org/"


Testing the setup

  • Test that you can run the nethack inside the chroot environment, by doing the following as root:
cd /opt/nethack/nethack.alt.org
chroot ./ nh343/nethack
  • If NetHack doesn't start but you get a complaint about missing file or directory:
chroot: cannot run command `nh343/nethack': No such file or directory

That usually means some dynamic library isn't present in the chroot. Use "ldd nethack" to see what dynamic link libraries are needed.

  • If you get a complaint about unknown terminal type, that means there's some problem with the terminfo files. Check that there is a terminfo file in the chroot that corresponds to your $TERM setting.
  • Set up the telnetd to accept incoming connections, for example if you're using xinetd, you might put this in /etc/xinetd.d/dgl:
service telnet
{
       socket_type     = stream
       protocol        = tcp
       user            = root
       wait            = no
       server          = /usr/sbin/in.telnetd
       server_args     = -L /opt/nethack/nethack.alt.org/dgamelaunch
       rlimit_cpu      = 120
}

Or if you're using inetd, add the following line to /etc/inetd.conf:

telnet stream tcp nowait root.root /usr/sbin/tcpd /usr/sbin/in.telnetd -h -L /opt/nethack/nethack.alt.org/dgamelaunch