Bandnudel is a Perl script to create statistics for Sauerbraten, an opensource first person shooter. Bandnudel expects two commandline arguments: the hostname or ip address of the Sauerbraten masterserver, and the filename of a local html page to save the statistics. For example:
./bandnudel.pl sauerbraten.org /var/www/html/bandnudel.html
It will then run in foreground and ask the masterserver (sauerbraten.org) for all connected gameservers. After all game servers have been queried for the current gamemode, the current map, for all players' state, and so on, this data is saved as a single html page (/var/www/html/bandnudel.html). After pausing for 10 seconds, bandnudel will start over again asking the masterserver, querying all gameservers, ...
A Sauerbraten masterserver is used to locate gameservers. If a gameserver wants to register with a masterserver, the masterserver connects to the gameserver to check whether it is running. In the sauerbraten client, if you click on "update server list from master server" (in the servers' browser menu), then your client will also query the masterserver to get a list of all gameservers. The default masterserver is sauerbraten.org. Running bandnudel against the sauerbraten.org masterserver is not a wise idea. Also the servers' browser is quite confusing in my eyes. The Sauerbraten package for Linux also contains sources for the masterserver (sauer_master). As it is not build by default, you have to gmake master in sauerbraten/src. sauer_master runs in foreground and logs to master.log in the current directory. If you start sauer_master with an argument, it will use this argument as prefix for the logfile. If the logfile can not be opened, it will log to stdout. To use your own masterserver, you have to start the Sauerbraten client with the -m option, followed directly by the hostname or ip address, e.g.:
sauerbraten -m192.168.0.17or add this to your autoexec.cfg (under options in the GUI):
mastername 192.168.0.17Additionally, you have to edit server-init.cfg:
updatemaster 1 mastername 192.168.0.17Otherwise, the dedicated gameserver won't use your masterserver.
As all Sauerbraten servers (including Bandnudel ;-)) don't daemonize themselfs, we will use Daniel J. Bernstein's daemontools. For security reasons, we will run all servers as a unprivileged user. You should also install a webserver like Apache so that clients on your LAN can access Bandnudel's statistics.
cat >/var/service/sauermaster/run #!/bin/sh cd /home/sauer/master && \ exec setuidgid sauer /usr/local/libexec/sauer_master ^D
cat >/var/service/sauerserver1/run #!/bin/sh cd /home/sauer/server1 && \ exec setuidgid sauer /usr/local/libexec/sauer_server ^D
cat >/var/service/sauerserver1/log/run #!/bin/sh cd /home/sauer/server1 && \ exec setuidgid sauer multilog t ./log ^D
cat >/home/sauer/server1/server-init.cfg serverip 0.0.0.0 serverport 28785 maxclients 32 serverbotlimit 8 publicserver 1 serverdesc "My precious Sauerserver" serverpass "" adminpass "secret" updatemaster 1 servermotd "Welcome to my precious Sauerserver" mastername LAN- or public IP address of your server ^D
cat >/var/service/bandnudel/run #!/bin/sh cd /home/sauer && \ exec setuidgid sauer /usr/local/libexec/bandnudel.pl LAN- or public IP address of your server \ /usr/local/www/apache22/data/index.html ^D
Bandnudel started as a Sauerbraten masterserver that uses MySQL to store all currently connected gameservers. That was before I discovered that Sauerbraten comes with its own masterserver. Bandnudel was also able to start gameservers and parse their output to create statistics. That was before I decided to use daemontools and before I discovered that you can directly get statistics from the gameservers without patching the source code.