How to get a playable Linux Railroad Tycoon 2 install

By following these instructions, I was able to frankenstein together the Loki Software Linux Railroad Tycoon 2 binaries with the data from a Windows Railroad Tycoon 2 Platinum disc.

WARNING: The installation produced by this will be missing the music and video cutscenes.

  • Music (It doesn’t even seem to be trying to load it, so I have no idea where to start diagnosing.)
  • Video cutscenes (I didn’t care enough to spend the effort. See this blog post for instructions on converting Smacker video to the type of MPEG Loki games expect and read further for how to identify what filenames it’s looking for.)

Required tools:

  • unshield or Wine to unpack the Windows installer
  • unzip to bypass the “Please insert ‘Railroad Tycoon 2 Loki disc'” message in the Linux installer
  • Perl and the /usr/bin/rename symlink to Perl’s prename

Required files:

Instructions (all approaches):

  1. Put into your target directory
  2. Insert the Railroad Tycoon 2 CD into your CD drive
  3. Type or copy-paste the following commands, adjusting paths as appropriate:
# Unpack the Linux binaries
cd data
tar xvf patch-1.54c.tar

# Unpack the data files from the CD into the expected layout
unshield /media/*/RT2_PLAT/_setup/
unshield /media/*/RT2_PLAT/_setup/
mv Root_Files/* .
rmdir Root_Files

# Fix issues caused by Windows being case-insensitive and Linux 
# being case-sensitive
mv Data data
(cd data; rename 'y/A-Z/a-z/' *)
(cd maps; rename 's/.MP2/.mp2/' *; rename 's/.MAP/.map/' *; rename 'y/A-Z/a-z/' \#*)

That will get the statically-built binary (./rt2) playable but you won’t get any sound because the static linking prevents PulseAudio from faking ALSA’s API. (It may play audio if run via pasuspender but I don’t like how pasuspender mucks with things, so I didn’t test it.)

Additional Instructions for working audio:

The simplest way to get working audio is to use the dynamic version. For that, you need some old library dependencies and a wrapper script capable of providing a 32-bit version of padsp’s functionality on 64-bit Linux:

tar xvaf loki_compat_libs-1.3.tar.bz2 --wildcards 'Loki_Compat/libsmjpeg-0.2.*' 'Loki_Compat/libSDL-1.*'
cat > << EOF
export LD_PRELOAD='/usr/lib/i386-linux-gnu/pulseaudio/'
export LD_LIBRARY_PATH=Loki_Compat
if [ "$1" = '--strace' ]; then
    strace ./rt2.dynamic 2>&1 | egrep -v '/(var|etc|lib)/|.loki/rt2|[./]pulse|Loki_Compat' | grep -i 'No such file'
chmod +x

Now, you can use to launch it and your sound effects will work too.

Additional Instructions if you want to try to get videos or music working:

First, the most important trick I used to figure out which files to rename and how was running the game via this command:

strace ./rt2 2>&1 | grep -v '.loki/rt2' | grep -i 'No such file'

I’ve incorporated a more polished version into which can be triggered by running it as ./ --strace

(Don’t worry about the LD_PRELOAD errors. That’s just strace complaining that it can’t use the 32-bit PulseAudio library that we’re requesting for the game itself.)

Second, be aware that, if you break the audio on the dynamic version, don’t click the Quit button. It’ll freeze the game without releasing your pointer. Instead, if audio isn’t working, hit Alt+F4 to ungrab the mouse and keyboard and switch to windowed mode, then use xkill to kill the window.

In case you forget, I also advise running these so you can recover from a freeze while fullscreened by using Ctrl+Alt+F1 to switch to a console, logging in, running ./, and then using Ctrl+Alt+F7 to return to your desktop.

echo "DISPLAY=:0.0 xkill -id $(DISPLAY=:0.0 wmctrl -l | grep Railroad | cut -d' ' -f1)" > ~/
chmod +x ~/
Posted in Geek Stuff | 1 Comment

Composing Music: A Layperson’s Quickstart Guide

Updated 2015-12-21: Added a basic explanation for the concept of the tonic note, some chord dictionary links, and a link to JGuitar’s Harmonizer in the Scales section.

Having an analytical mind like mine is great, because it means I can easily understand why a thought process works or doesn’t work, but that also comes with a downside: When starting into an entirely new field, I have trouble making the intuitive leaps needed to get going.

In order to help others who may have a similar orientation (and to mothball the urge to research and write a whole book about this when my plans for a story-plotting book are still on hold for lack of time), here are a few insights I picked up over the years which should allow basic music composition at a level sufficient to stay interested and improve (if I can ever find time to actually do it).

I apologize that it’s all so rough and incomplete and the writing’s so sloppy. It’s already taken an entire day rather than an hour or two and ballooned up to far longer than I expected.

(Note: If any of the YouTube links are geo-blocked, I’ve provided enough information that it should be easy to copy-paste the title into the search field on the error page)

A progression of notes/chords feels “complete” if it ends on the “tonic”
The tonic is the note that your brain identifies as dominant in a progression of notes and one of the TED talks I watched (I don’t have time to track down the exact one) explained that, from Twinkle Twinkle Little Star to Andrew W.K.’s Ready to Die, there’s a simple rule. A progression of notes/chords must end on the tonic  (possibly in a different octave) in order to feel “complete”.
In simple pieces, it’s most common for your brain to identify the tonic as the note you start on. Let’s take Twinkle Twinkle Little Star for an example. “Twinkle, Twinkle, little star. How I wonder what you are.” feels complete because the terminal “are” plays the same note as the initial “Twinkle” while “Up above the world so high” and “Like a diamond in the sky” leave you in anticipation because they do not.
In more complex pieces, it’s possible to start on a note other than the tonic because your brain identifies the tonic based on how the notes relate to each other. For example, if you start with an arpeggiated chord (more on that later), the first note you play might not be the tonic for the chord you’re playing and your brain will instinctively choose the chord’s dominant pitch as the tonic instead. (Chords are named after their dominant pitch, so it’s very helpful to consult a chord dictionary. I couldn’t find an all-round best choice, but is best if you don’t need audio, JGuitar has sound clips, lists the formulas for constructing chords within any scale, and there’s also one built into every Yamaha keyboard I’ve seen so far.
I haven’t had time to properly research the low-level mechanics of what makes a progression appealing, but, if you need more help getting started, you can always pick ready-made chord progressions (see also autochords) and then experiment with different keys and tempos. As 4 chords by Axis of Awesome and Rob Paravonian’s Pachelbel Rant hint at for comedy purposes, there are only so many chord progressions (and even fewer that feel right for a given genre) that you can form which will appeal to a western audience (It’s a learned thing. Musical Involvement by Donald J. Funes introduced me to the Indian Raga and Javanese systems of music but some of the very aspects which characterize them turn me off… primarily in the Javanese stuff.)
The simplest way to build a complex piece is by combining complementary simple ones
As with subplots when writing stories, the simplest way to bulk up a song is to take a bunch of simple melodies that work together, play them at the same, and change them out before they have a chance grow stale… but never all at once, so continuity is preserved.
This layered structure is easy to see in many pop and eurodance songs but is especially clear with the title/menu theme to the Super Nintendo game Super Mario World 2: Yoshi’s Island. The song starts with one layer, lets the listener get used to it, then adds another. Repeat until all of your layers are present, then start swapping individual tracks within the song to keep things fresh and varied.
If you really want to see how powerful this trick can be, find some songs you like on the Share > Projects section of the LMMS website or in The Mod Archive, open them in the appropriate tool (LMMS for the former, OpenMPT or equivalent for the latter) and take a look at how they’re constructed. (Keep in mind that some of the looping will be less obvious in stuff from The Mod Archive because the file formats aren’t as advanced as an LMMS project and composers had to manually repeat their note patterns.)
Variations on what you’ve already made are a good idea
Again going back to Musical Involvement by Funes, the key to understanding how big, complex pieces like symphonic compositions work is recognizing that they’re “exploring themes”. That is, they play a bunch of different variations on a musical idea in order to guide the listener through its emotional implications.
For this example, I’ll use the rondo from “Sinfonie de fanfares” by Jean-Joseph Mouret. A rondo (from the Old French for “little round”) is a type of musical structure which plays a verse, then diverges from it, then returns. Rinse, lather, repeat.
In this piece, the trumpet first plays part A, then part B, then returns to part A, then plays part C which resembles part B but is noticeably different. Then, the trumpet and organ start to take turns with the organ parts being rondos unto themselves.
In longer pieces, you might instead see something like sonata form, which can be very crudely summarized as “Music A gets played, then music B, then they attack, parry, and riposte like duellists in a fencing match, then it ends with music B winning.”
Icicles by F-777 does a good job of demonstrating the use of these elements in a trance composition. It starts by layering loops, one-by-one, then moves to experimenting with variations on different musical ideas built around simple but appealing progressions, then finally ends by returning to where it started, similar to traditional classical forms like rondo and ternary form.
Arpeggios and related techniques
Also sometimes called a rolled chord, an arpeggio refers to playing the notes in a chord one after the other rather than all at once. For some instruments, this is your only option but, even if it’s not, it’s a great way to add more variety to your composition.
If you have a keyboard like the Yamaha PSR-E413 with an arpeggio helper function, you’ll probably find that there are a lot of different ways to do this (walking up the keys, walking down the keys, playing medleys of the single notes and two-note chords contained within a three-note chord, etc.) and they provide an easy way to squeeze more variety and interest out of a chord which you already know will work.
For example, here is one form of the infamous “4 chords” progression in LMMS (“one form” because octave doesn’t matter. You could have it go up at the end as long as that last chord is still A, C, and F):
…and here is a slightly more interesting piece of music achieved just by partially arpeggiating the second and fourth cords:
…and here’s another one, but still the same four chords.
Hopefully, that will help to get your imagination brewing.
Never discount the power of lyrics
The key to making a successful song is making something people will remember fondly. While being catchy is always something to strive for, never discount the power of distracting the listener from your weaknesses with powerful lyrics.
In fact, you could say that Rap is built upon that because it’s not really music in the traditional sense. Rather, it’s closer to being slam poetry (Marshall Davis Jones : “Touchscreen”) set to musical accompaniment.
As for making lyrics, the simplest way to make them good is to recognize two things:
First, Lyrics are poetry, where the structure is constrained by the music but the distraction provided by an appealing melody and beat forgives some laziness in the writing. Anything you can learn about writing good poetry will make you a more effective lyricist.
Most importantly, learn to use meter (the pattern of stressed and un-stressed syllables) to supercharge your rhyming scheme because that’s what makes things like Dr. Seuss books so powerfully appealing. They’re poetry for kids with strong, consistent meter.
Second, poetry (and, thus, lyrics) can do anything prose can, whether it’s a story like The Rime of the Ancient Mariner, an essay like “If” by Rudyard Kipling, or jokes (eg. any song by Tom Lehrer).What this implies is that most if not all of the tricks for planning out high-quality writing in other formats still apply. (eg. learning to write imagery well)
For example, classic fiction becomes classic either by changing the landscape (eg. Don Quixote invented the modern novel, Frankenstein invented modern sci-fi, etc.) or by remaining relevant after it outlives the era which birthed it (eg. stuff by George Orwell like 1984).
The big trick for things like Frankenstein and 1984 is that they’re actually essays in disguise, sort of like Aesop’s fables… which means that you can use the same essay-planning tricks you learned in high school. (Come up with a thesis statement, develop an outline, etc.)
The other trick is to focus on things that don’t change… things that are part of the human condition. I was once told of an Ancient Greek play in which a father complains about how all his son wants to do is lay around all day, listening to the bards and farting. Sound familiar?
Get creative
Humans are addicted to novelty so one of the most effective ways to make your lyrics work well is to sing about a topic that nobody else seems to be paying much attention to.

At the very least, you don’t want to do something that’s overdone unless you can find a way to make it fresh again. For example, everyone’s written a love song but not everyone’s written A Summer Song by Chad and Jeremy.

I suggest looking into Folk music if you want inspiration for music on broader topics. Here are a few examples:

…and then there’s geek folk, known as filk after the fan community decided to keep a typo and make it their own:

If you still need more help, drop by your local library and grab some books on philosophy and critical thinking. If you can make your lyrics thought-provoking like Lucifer by Don Simons and Leslie Fish, they’ll have more appeal… and remember, there’s always someone wiser than you and someone who makes you look wise. Perfection is the enemy of “good enough”.
I’ll use Lucifer as an example to demonstrate what I mean:
  • It starts out with a phrase that sounds good (let me teach you to wonder and worry) and a phrase that sounds bad (permit me to tell you how to wage war), and then spends its time convincing you that those two phrases are actually two interpretations of the same thing.
  • It implies that, before eating the fruit, humans were non-sapient, having all the ability to “plan for tomorrow” of a pet cat.
  • It specifically says “Taste of the fruit of the tree that is knowledge”. Knowledge isn’t the fruit itself; Knowledge bears fruit.
  • It’s not just the knowledge “of good and evil”, it’s “of good and of evil and all the world’s lore”. (“Lore” being an archaic word for knowledge that’s generally used to mean “traditional/folk knowledge” in modern use)
  • Using clever variations on the same phrase, it argues the thesis that eating the apple was the right thing to do using a structure similar to a four-paragraph essay:
    • Verse one argues that a paradise like heaven is pointless if no creature has the ambition to grow beyond what they are now. (ie. if humans already live in paradise on Earth in the form of Eden).
    • Verse two argues that the heavens (the night sky) are pointless if they cannot inspire a creature to reach for them (assuming a geocentric cosmology).
    • Verse three argues that a reward like heaven is pointless if no creature ever thinks outside the limits of what they are taught.
    • Verse four argues that heaven and hell are nothing more and nothing less than the possible outcomes of granting ourselves power through knowledge.
Whether it’s an essay, a story, a poem, or a song, the process to get to that is very simple. Brainstorm out a novel concept (follow the Pixar rule of throwing out your first few ideas as too obvious), then break it up into smaller problems, just like arguing for a thesis in an essay.
If philosophy isn’t your thing, maybe something else. Listen to ’39 by Queen and try to figure out what it’s about before looking it up… then listen again to get the full impact.
(Also, don’t forget that it’s legal to reinterpret music old enough to be in the public domain. In fact, that’s how humans built new songs for most of our history. For example, “This Land is Your Land” adapted its melody from an earlier song and Woody Guthrie himself didn’t believe in copyright.)
You never use all of the notes available to you at the same time, because only certain sets sound good together. These sets are called scales and there are many different ones, varying in popularity depending on when and where you are.
For example, the oldest type of scale (and, as Bobby McFerrin demonstrated, the most instinctively obvious) is a pentatonic scale. The black keys on a piano form one possible pentatonic scale. Wander your fingers up and down on them, and you’ll be half-way to traditional-sounding music. Play chords on them and you’ll get something that sounds like traditional Chinese music.
Each scale will lend a different feel to your music (best illustrated in the Far Side comic where a guy in black walks into the saloon and the banjo player says to the piano player, “Bad guy comin’ in Arnie! …Minor key!”).
In western music, the most common family of scales are the major and minor diatonic scales. In fact, if you play only the white keys on a piano (or use no sharp/flat notes in sheet music), you’re playing on the C major scale. (The white keys aren’t actually equally spaced. To walk up the keyboard in even increments, you have to play both the black and white keys.)
Transposing (playing a tune in a new key) is quite simple. Just slide each note up or down by the same amount. (eg. if C becomes D, then E becomes F because you move two keys to the right in both cases)
That’s how medleys like “4 chords” work. They transposed all of the songs they showed into the same key.
JGuitar also has a tool called Harmonizer which lets you explore which chords and scales sound good together.
Key shifts
One useful aspect of music that I don’t always pick up on (it can be subtle) is the key shift. That is, changing the key you’re playing in part-way through the song. Good, easy-to-notice examples of this include the third verse in I’ll Make a Man Out of You from Disney’s Mulan, when the song shifts up to give a greater sense of urgency to “time is racing toward us”, or just before “soon the duet will become a trio” in The Lonely Goatherd from The Sound of Music.)
Also, on a related note, I’ll Make a Man Out of You (like many Disney songs), is an excellent example of distracting the listener from a very simple melody using lyrics.
Time signatures
While not strictly necessary to play around with composition in the beginning, understanding key signatures is very helpful… especially since programs like LMMS will snap your notes to a grid by default.
The time signature of a piece of music refers to its beat pattern with the actual numbers on a piece of sheet music referring to how many quarter notes per bar. For example, 2/4 time means two quarter notes per bar (“ONE two ONE two”) while 4/8 time would mean four eighth notes (“ONE and two and ONE and two and”). How long a bar lasts in actual time is determined by your tempo (in beats per minute).
Wikipedia has some good videos illustrating how the various common time signatures look and sound.
Further learning
If you can, I highly recommend borrowing Musical Involvement and its accompanying CD of example clips from your local library, because there are a ton of little things which I don’t have time to cover that are easy to notice once you know what to look for.
For example, Syncopation. You might not have noticed, but we intuitively expect the emphasis on a beat pattern to land on the first note. (eg. “ONE two three, ONE two three” in a waltz)  Forcing the emphasis to land on another beat makes the music feel more tense and this “raggedness” is the origin of the term “ragtime”. (See, for example, Scott Joplin’s Maple Leaf Rag. Listen to the beat and you’ll notice that, in the parts where it’s clear and obvious, it’s “duh DA duh DA”)
Posted in Geek Stuff | Leave a comment

…and I also updated my userscript

After not noticing I’d been messaged until hours later, I decided to amend the userscript I use to watch for new forum replies so it also watches other kinds of notifications (ie. private messages, friend requests, and game library updates). – Updated Thread Count in Title

More details on the GreasyFork page.

Posted in Geek Stuff | Leave a comment

…and a userscript for collectors

As you start collecting a lot of ScummVM-compatible games, it gets awkward to keep track of what you’re still looking for… so I wrote a little script which lets you check them off and have them fade out so you can easily scan what remains.


It’ll remember your list between visits and it’s on GreasyFork as Mark owned ScummVM Games if you want it.

Posted in Geek Stuff | Leave a comment

My New Userscript

After spending so much time on fandom-specific sites with much better search systems (like Twisting the Hellmouth),’s search system feels really constricting.

As such, I’ve started to hack together a little userscript to make up for that. As of this writing, it hides slash and stories which involve a list of fandoms I’m not interested in. (So I can formulate searches like “All Harry Potter crossovers except series X, Y, and Z”)

You can find it (and instructions for customizing it screenshots) over on GreasyFork. Unwanted Result Filter

UPDATE: No instructions necessary anymore. It now has a nice configuration GUI.

UPDATE 2: And I now also have another little script for setting custom default values for’s own limited result filters system.

Posted in Geek Stuff, Otaku Stuff | Leave a comment

Script to open in default web search provider

Inspired by this post for Windows on Raymond Chen’s blog, detailing how to make a best-effort attempt to open a query in the user’s default browser and search provider, I decided to write a Linux equivalent.

Since Raymond used C# for Windows (what could be more Windows?), I decided to use Bourne shell script for the Linux version (what could be more UNIXy?). Of course, me being me, I couldn’t help but add more error handling than Raymond does for his little programs.


Posted in Geek Stuff | Leave a comment

Desktop-spanning backgrounds in KDE 4.x

One of the simplest ways to make a multi-monitor system look more impressive is to set a desktop background which spans across all of the monitors. Just scale the image up to the smallest size that fills all of the visible desktop space, then cut out monitor-shaped pieces to display.

Every system (even lightweight, older Linux desktops) supports this… every system except one. When KDE went from 3.5.x to 4.x, they dropped support for spanning a background across all desktops and, to this day, they still haven’t brought it back.

…and since everything more lightweight has bugs with the desktop layout I’m currently dealing with while I wait for the new monitor bracket I ordered, that’s a problem. (Even worse, there’s no API I could find to programmatically set a background either!)

The solution I settled on was to write a little Python script which uses maybe half a dozen lines of PyQt 4.x/5.x calls (before line-wrapping and boilerplate) to do what KDE should have, then spits out image files to be set as per-monitor backgrounds.

I also implemented a --randomize option which can be used with cron to produce input for KDE’s slideshow mode. (Basically, you set each monitor background to be a single-entry slideshow that the script updates)

Just give it an image (or --randomize and a list of files and/or folders) and an output directory. (See --help for more details)

UPDATE: It now also gives more control over how the background is matched to the desktop’s aspect ratio via --gravity and I included, as an example, the .desktop file I use to integrate it with Geeqie via Zenity. (KDialog’s equivalent to zenity --list is inferior.)

Posted in Geek Stuff | 2 Comments