Setting up a dgamelaunch game server
Installing Games
Installing the original Rogue seems appropriate for this article. Roguelike Gallery hosts builds for many early Roguelikes. John "Elwin" Edwards, Roguelike Gallery's creator, has done an amazing job of keeping and updating these antique games' source code to ensure they can run on modern operating systems. Roguelike Gallery also provides precompiled binaries [5].
I keep a convenient copy of Elwin's Roguelike collection on a personal server. You may download it with the following command:
$ curl -LO gopher://gopher.operationalsecurity.es/9/Software/Early Roguelikes/ElwinR-rl-74351bf23e5e.zip
Compile Rogue v3 (the earliest version of Rogue that was widely available) with:
$ unzip ElwinR-rl-74351bf23e5e.zip $ cd ElwinR-rl-74351bf23e5e/rogue3 $ autoreconf $ ./configure --enable-savedir=/var/games/rogue3/save--enable-scorefile=/var/games/rogue3/rogue.scr --enable-logfile=/var/games/rogue3/rogue.log $ make
The enable-savedir
, enable-scorefile
, and enable-logfile
switches are necessary to compile a game for systemwide installation. Keep in mind that Rogue will live in a chroot and won't be able to modify the rest of the operating system: For the game, the chroot directory will be all there is to the operating system.
Create the appropriate directories in the chroot and move the binary file to its final destination:
# cd /var/dgl # mkdir -p var/games/rogue3/save # mkdir -p usr/games # mkdir -p dgldir/inprogress-rogue3 # cp $user_home/ElwinR-rl-74351bf23e5e/rogue3/rogue3 usr/games/ # chown -R games:games var/games dgldir
You can install additional games using similar steps. Keep in mind that you also must copy the libraries required by those games inside the chroot folder.
Rogue requires the appropriate ncurses library to live within the chroot.
# cp /lib/x86_64-linux-gnu/libncurses.so.6 /var/dgl/lib/x86_64-linux-gnu/
Configuring dgamelaunch
The game launcher's main configuration file resides in /var/dgl/etc/dgamelaunch.conf
. Listing 2 shows an example to get you started. You may find more example configuration files in dgamelaunch's source code tarball, with the meaning of the variables properly explained.
Listing 2
dgamelaunch.conf
chroot_path = "/var/dgl" dglroot = "/dgldir/" banner = "/dgl-banner" shed_uid = 5 shed_gid = 60 commands[register] = mkdir "%ruserdata/%n", mkdir "%ruserdata/%n/ttyrec", mkdir "%ruserdata/%n/ttyrec/rogue3" commands[login] = mkdir "%ruserdata/%n", mkdir "%ruserdata/%n/ttyrec", mkdir "%ruserdata/%n/ttyrec/rogue3" menu["mainmenu_anon"] { bannerfile = "/dgl_menu_main_anon.txt" commands["l"] = ask_login commands["r"] = ask_register commands["w"] = watch_menu commands["q"] = quit } menu["mainmenu_user"] { bannerfile = "/dgl_menu_main_user.txt" commands["c"] = chpasswd commands["e"] = chmail commands["w"] = watch_menu commands["3"] = play_game "RogueV3" commands["q"] = quit } menu["watchmenu_help"] { bannerfile = "/dgl_menu_watchmenu_help.txt" commands["qQ "] = return } DEFINE { game_path = "/usr/games/rogue3" game_name = "Rogue V3 (3.6)" short_name = "RogueV3" game_args = "rogue3", "-n", "%n" inprogressdir = "%rinprogress-rogue3/" ttyrecdir = "%ruserdata/%n/ttyrec/rogue3/" commands = cp "/var/games/rogue3/save/%u-%n.r3sav" "/var/games/rogue3/save/%u-%n.r3sav.bak" }
The shed_uid
and shed_gid
variables define the user ID and group ID that dgamelaunch will drop privileges to after chrooting. In the example shown in Listing 2, this would be equivalent to games:games
in a default Debian install. commands[login]
and commands[register]
tell dgamelaunch which actions to perform when a player logs in or registers, respectively. In Listing 2, they build a directory tree when the user registers and rebuild it if the user logs in and the tree does not exist.
The DEFINE
clause provides a configuration for loading Rogue, game_path
defines the location of the rogue3
binary within the chroot, while commands
backs up each player's saved files each time the game is launched. ttyrecdir
sets the directory in which the game session is recorded, just in case you want to watch your games later.
The final step is to configure the menus the users will see when logged into the game server. The default configuration suffices for testing, with the exception of the menu located at /var/dgl/dgl_menu_main_user.txt
. By default, the menu is NetHack-centric. Listing 3 provides you with an appropriate alternative.
Listing 3
dgl_menu_main_user.txt
## ## $VERSION - network console game launcher ## Copyright (c) 2000-2009 The Dgamelaunch Team ## See http://nethack.wikia.com/wiki/dgamelaunch for more info ## ## Games on this server are recorded for in-progress viewing and playback! Logged in as: $USERNAME c) Change password e) Change email address w) Watch games in progress 3) Play Rogue V3 q) Quit =>
Making the Service Available
You can test whether dgamelaunch works by invoking the dgamelaunch
command as any regular user:
$ /usr/bin/dgamelaunch
If everything works as intended, dgamelaunch will chroot into /var/dgl
, and you'll be presented with a menu (Figure 2), from which you can create a user account for the game service, play games, and watch other players.
In order to make the game available over Telnet, you must install the appropriate Telnet daemon and configure it. Dgamelaunch's README
file offers instructions to do this. Begin by installing an inetd
daemon and a Telnet server:
# apt-get install openbsd-inetd telnetd
OpenBSD's inetd
is a superserver that takes incoming connections and passes them to the appropriate server, in this case telnetd
. In order to make this configuration work, edit /etc/inetd.conf
and ensure the line shown in Listing 4 is its only content.
Listing 4
inetd.conf
telnet stream tcp nowait root.root /usr/sbin/tcpd /usr/sbin/in.telnetd -h -L /var/dgl/dgamelaunch
This line instructs OpenBSD's inetd
to call the Telnet daemon when a Telnet connection is received. In turn, the Telnet daemon is configured to use /var/dgl/dgamelaunch
as a shell. Remember to reload the inetd
daemon for the configuration to take effect:
# systemctl reload inetd
« Previous 1 2 3 Next »
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Gnome 48 Debuts New Audio Player
To date, the audio player found within the Gnome desktop has been meh at best, but with the upcoming release that all changes.
-
Plasma 6.3 Ready for Public Beta Testing
Plasma 6.3 will ship with KDE Gear 24.12.1 and KDE Frameworks 6.10, along with some new and exciting features.
-
Budgie 10.10 Scheduled for Q1 2025 with a Surprising Desktop Update
If Budgie is your desktop environment of choice, 2025 is going to be a great year for you.
-
Firefox 134 Offers Improvements for Linux Version
Fans of Linux and Firefox rejoice, as there's a new version available that includes some handy updates.
-
Serpent OS Arrives with a New Alpha Release
After months of silence, Ikey Doherty has released a new alpha for his Serpent OS.
-
HashiCorp Cofounder Unveils Ghostty, a Linux Terminal App
Ghostty is a new Linux terminal app that's fast, feature-rich, and offers a platform-native GUI while remaining cross-platform.
-
Fedora Asahi Remix 41 Available for Apple Silicon
If you have an Apple Silicon Mac and you're hoping to install Fedora, you're in luck because the latest release supports the M1 and M2 chips.
-
Systemd Fixes Bug While Facing New Challenger in GNU Shepherd
The systemd developers have fixed a really nasty bug amid the release of the new GNU Shepherd init system.
-
AlmaLinux 10.0 Beta Released
The AlmaLinux OS Foundation has announced the availability of AlmaLinux 10.0 Beta ("Purple Lion") for all supported devices with significant changes.
-
Gnome 47.2 Now Available
Gnome 47.2 is now available for general use but don't expect much in the way of newness, as this is all about improvements and bug fixes.