Laclin Home Contact Xfce4 tabsets Video tools Bundled distros This page Proxy tricks Coder Dansu Gitea repos Source tree

1. What is this page?

This page discusses a sim­ple but unusual game by OldCoder named BEWorld. The game is unusual only in tech­ni­cal respects. It's a sim­ple 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 in­clud­ed sprites, level maps, sound effects, and back­ground music all in a single Tcl script.

The code was 100 pages in length even after sub­tract­ing blank lines, com­ment separator bars, and binary data blocks.

BEWorld is still fully operational as of this writing. The game is stand­ard in Laclin and port­a­ble to other distros. This page provides the source code need­ed for ports.

The scope of this arti­cle includes both Laclin and other distros. The tar­get audience is Linux game­devs who are com­for­ta­ble 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) pro­gram writ­ten by the Steve Havelka who resided in Portland at the time. Havelka wrote the first pro­gram 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 as­soc­i­ates.

The flavor of BEWorld was, and remains, similar to that of a real-time Nethack. There are sever­al connected rec­tang­u­lar levels and the goal is to travel through the levels and make it to the end.

However, the pro­gram is far more lim­it­ed than Nethack. It should be thought of as a demo or proof of con­cept.

This said, the game features sprite code that's easy to work with, both ran­dom and in­var­i­ant levels, a map gen­er­a­tor that should work in other games, sup­port for em­bed­ded music and sound effects, the start of an object-oriented com­pon­ent framework, and other use­ful features.

As of 2021, the pro­gram was still work­ing fine despite a decade of changes in FOSS.

Your phone or window is too narrow for the image. If it's a phone, try rotating the phone or switching to a PC. Or click here to go to a copy that may be zoomable.
Typical BEWorld scene
Typical BEWorld scene

Your phone or window is too narrow for the image. If it's a phone, try rotating the phone or switching to a PC. Or click here to go to a copy that may be zoomable.
Denizens of Caspak greet the hero
Denizens of Caspak greet the hero

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 ir­rel­e­vant for browsing purposes.

The actual and complete source code is provided in downloadable form further down.

4. Dependencies.

BEWorld's stand­ard 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 need­ed 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 sup­port 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 con­fig­ur­a­tion might be need­ed. If sound is present but it's borked, add the fol­low­ing two lines to 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-stand­ard dependency, Brick Tcl 5.4, which was de­vel­op­ed by Havelka as one of the sup­port­ed 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 down­load­ed as a single ZIP file from the the fol­low­ing link:

If the stand­ard dependencies dis­cus­sed 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 dir­ec­tory tree “/opt/beworld”. In the 2nd case, it's installed to $HOME/beworld instead. The pro­ce­dure is as follows:

unzip -o  /somewhere/
cd beworld-bundle-211113
bash -e  ./

Substitute the appropriate dir­ec­tory path for “/somewhere”.

That's all there is to it. However, you may need to do post-build tweaks as dis­cus­sed below.

If you do the build as root, BEWorld is installed to the dir­ec­tory tree “/opt/beworld”. If you do it as an ordinary user, BEWorld is installed to $HOME/beworld instead.

If the build is suc­cess­ful, the script will tell you the com­mand to use to run the pro­gram.

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 pro­gram. The required steps will depend on your distro and/or sound system.

If sound effects work but back­ground 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.

Your phone or window is too narrow for the image. If it's a phone, try rotating the phone or switching to a PC. Or click here to go to a copy that may be zoomable.
The Flames of Heaven
The Flames of Heaven

6. Tips and tech­ni­cal 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 pos­si­ble to make it through the Flames of Heaven. However, as of this writing, OldCoder didn't remember how to do it suc­cess­ful­ly.

* 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.

© 1996-2021 OldCoder (Robert Kiraly)    |  Privacy policy    |  Contact   |  Notices