1. What is this page?
This page discusses a simple but unusual game by OldCoder named BEWorld. The game is unusual only in technical respects. It's a simple demo but at one point it was the world's largest single-file Tcl video game as well.
The game appeared at the time to be unique in that it included sprites, level maps, sound effects, and background music all in a single Tcl script.
The code was 100 pages in length even after subtracting blank lines, comment separator bars, and binary data blocks.
BEWorld is still fully operational as of this writing. The game is standard in Laclin and portable to other distros. This page provides the source code needed for ports.
The scope of this article includes both Laclin and other distros. The target audience is Linux gamedevs who are comfortable with CLI.
2. History.
OldCoder wrote BEWorld largely from 2010 to 2011. The earliest drafts might date back to 2008 or 2009.
BEWorld was a fork of an older (apparently unnamed) program written by the Steve Havelka who resided in Portland at the time. Havelka wrote the first program as a demo for a FOSS project of his named Brick Engine.
As a side note, Havelka worked with an artist named Master Bismuth or MURB who later became one of OldCoder's long-term associates.
The flavor of BEWorld was, and remains, similar to that of a real-time Nethack. There are several connected rectangular levels and the goal is to travel through the levels and make it to the end.
However, the program is far more limited than Nethack. It should be thought of as a demo or proof of concept.
This said, the game features sprite code that's easy to work with, both random and invariant levels, a map generator that should work in other games, support for embedded music and sound effects, the start of an object-oriented component framework, and other useful features.
As of 2021, the program was still working fine despite a decade of changes in FOSS.
3. Get a Load of the Code.
To browse an HTML version of the code, click here. Be prepared to be amazed because this is Tcl code most crazed.
Note: Don't try to copy-paste and use the HTML version. It won't run. Reason: The sound effects and music binary data has been been omitted from this copy because the data is huge and irrelevant for browsing purposes.
The actual and complete source code is provided in downloadable form further down.
4. Dependencies.
BEWorld's standard dependencies, the ones that are readily available in most Linux distros, are light. They include:
gcc, cmake, SDL core 1.2.15 and SDL components such as sdl-mixer, Tcl 8.5.X or 8.6.X — preferably 8.6.12 or above — Xorg, libmikmod, and other libraries needed by SDL to play sound and/or music files.
SDL needs be SDL-1 as opposed to SDL-2. Note that the two series of SDL can be installed side-by-side. sdl-mixer must be compiled so as to support MOD files by way of libmikmod.
The sound system used in most Linux distros, these days, will often be pulseaudio. BEWorld works with pulseaudio but a well-known tweak to the pulseaudio configuration might be needed. If sound is present but it's borked, add the following two lines to default.pa and restart pulseaudio:
load-module module-alsa-source tsched=0
load-module module-alsa-sink tsched=0
As a last resort, run BEWorld from a bash script that resets pulseaudio both before and after a BEWorld session.
There's only one non-standard dependency, Brick Tcl 5.4, which was developed by Havelka as one of the supported Brick Engine modes.
The API changed repeatedly, so it needs to be Brick Tcl 5.4 exactly. This page includes source code for a snapshot of that release.
5. Building BEWorld.
The source code for Brick Engine, Brick Tcl 5.4, and BEWorld can be downloaded as a single ZIP file from the the following link:
If the standard dependencies discussed in part 4 are installed, it's nearly trivial to build BEWorld.
You can do the build either as root or as an ordinary user. In the 1st case, BEWorld is installed to the directory tree “/opt/beworld”. In the 2nd case, it's installed to $HOME/beworld instead. The procedure is as follows:
unzip -o /somewhere/beworld-bundle-211113.zip
cd beworld-bundle-211113
bash -e ./buildme.sh
Substitute the appropriate directory path for “/somewhere”.
That's all there is to it. However, you may need to do post-build tweaks as discussed below.
If you do the build as root, BEWorld is installed to the directory tree “/opt/beworld”. If you do it as an ordinary user, BEWorld is installed to $HOME/beworld instead.
If the build is successful, the script will tell you the command to use to run the program.
If BEWorld runs, but there's no sound or music or it's borked, try resetting the sound system both before and after you run the program. The required steps will depend on your distro and/or sound system.
If sound effects work but background music doesn't play, you need to install both a copy of libmikmod and a copy of sdl-mixer that was built to use libmikmod.
6. Tips and technical notes.
* To get God Mode, capture the Cross. Santa Claus will then boom out “Ho ho ho” and grant you temporary invulnerabiliy.
* It should be possible to make it through the Flames of Heaven. However, as of this writing, OldCoder didn't remember how to do it successfully.
* If you get into the car, you're safe from attackers but not able to shoot at them. Pressing Fire will just make the car honk instead.