Update on OpenTTD

Here is a quick update on where I am with OpenTTD.  After doing the first build a few weeks ago I spent some time playing the game and quickly realised there was a show stopping bug.  When you wanted to destroy a piece of rail track the cost was several billion, essentially making it impossible for you to remove track.  The correct behaviour is that you are refunded ¾ of the build cost.

I have been consulting the OpenTTD developers on their forum here.  I managed to find the exact line of code causing the problem, but it has turned out to be a compiler inline optimisation issue.  So even if I fix that line of code there would be an unknown number of other places in the code that could produce a similar problem and finding them all would be a nightmare.  The thing to do in this situation is to fix the compiler.

The issue is apparently fixed in GCC 4.6, unfortunately 4.5 is only available in the Debian image I am using.  I have done a build using 4.5 but with the no inline optimisations flag and this does fix the issue, although performance is slightly compromised.  The ideal would be for me to compile on 4.6 using raspbian, but the problem then is dependency issues when trying to run the executable on the popular Debian image.  So it’s a bit of a pain right now.  But I’ll keep trying.

Explaining what a comiler issue actually is to someone can be difficult, but I have found this image helps a lot.

Open Transport Tycoon?

Last night I did a build of Open Transport Tycoon on my Raspberry Pi.  The build process took about an hour to complete but it actually runs quite well.  Check out the video below.

This game may well have made me drop a grade at University.  If you’ve never played it before, basically just imagine a giant train set but where the trains carry different stuff like passengers, coal, wood, steel and goods.  The objective is to make money by being paid to transport things around.  You start in the year 1950 and as time progresses you get to use more and more futuristic technology to do this.  Fiendishly addictive.

You can download my R-Pi build of the game from here.  However you need to supply some of the original data files from the retail game yourself.  This is basically the game data/ folder with the GRF files.  If you don’t have the original game you can try some free alternative data files from here (I have not tested these myself yet).

Run the game using the ./start.sh file that comes with my binaries, just like Quake 3.

I recommend turning off two detail settings to improve performance.  These are Full Detail and Full Animation and they can be found under the Spanner Icon at the top when in game.  I would also suggest to create a fairly small map, maybe 64×64 or 128×128.  The performance will likely be improved a lot by accelerated X drivers, so when they become available this will probably play like a dream.

Have fun!