Open Transport Tycoon Deluxe (or OTTD) is an open source clone of Chris Sawyer's Transport Tycoon Deluxe (1995). TTD is the sequel to 'Transport Tycoon' (TTO) which was also released by Chris back in 1994.
OTTD's main goal has been to update and enhance the greater majority of original game features, including the ability to add new graphics and sound.
After originally developing with the guys of TTDPatch, I decided to see what OTTD was like and how portable it was... since it was open source.
My first attempt was to see if it would run on the Dreamcast. This console, released by Sega on November 27, 1998 and was way ahead of it's time. It unforunately failed to gain a strong market and instead brought on more of a cult following. Games like Shenmue were to define the Dreamcast experience; but never really made it big in the western world.
One benefit of this failure is that nowadays you can pick up a console for relatively cheap. The Dreamcast also had accessories such as the keyboard and mouse which would aid gameplay for titles such as Quake and its sequels.
Anyway, back on topic... a few years after it's release (2004) Dan Potter released an OS based on GNU Linux known as KallistiOS or KOS. This included famous libraries such as SDL, OGG and MP*. This meant it could be very straight forward to compile other open source titles for the Dreamcast in a minimal amount of time. The only issues would be the physical hardware limitations of the Dreamcast itself (Hitachi 200 MHz SH-4 CPU with 16MB Main RAM.)
You can still find great tutorials on Dreamcast programming all around the web.
Either way, I can't entirely remember the issues I encountered whilst programming for the Dreamcast apart from the fact that I'd be running out of RAM whilst trying to create the initial game map or hitting other endian issues whilst loading external files. The major hindrance was any form of debugging output/logging... I ended up using 3rd-party code to output raw text to the screen (akin to a BSOD.)
Here's the final ISO Image that I built: OpenTTD for Dreamcast CDI
Run this with DEmul... It's a pain to get working, but in the end it'll run... you'll just need to source BIOS' and stuff yourself if you want to test it.
Update: It seems that the CDI Image is fail!... The output from nullDC (search for a 'NullDC Dreamcast Emulator' torrent) reports that all the GRF files are missing... I never knew it had a nice console output :D...
Stay tuned, I'll attempt to re-image a CD that I have.
Either way, the compiled game ran in an Emulator (and on real hardware) and the end result was as follows:
It was heaps of fun and, at times, frustrating to get it going but in the end the performance really meant unplayable... The learning experience is what counted...
I've recently had a query about it on tt-forums where I responded with a link to my original post on the porting. I might dig everything back up again and see if I can't do a cleaner compile.. as I've now worked out the beauties of config.guess and config.sub :)
Anyway... I'll update if I ever get back around to it.
For a bit of help, here's a few links to find out more information on Dreamcast Programming:
- Japanese: How to build a cross-compiler for the SH-4
- Tutorial to config DEV-C++ to compile stuff to Dreamcast.
- DCEmu News (Not all dev.)
- Dreamcast Development Forum
- boob! Development Tools
- KallistiOS KOS SVN
- Marcus Comstedt's Dreamcast Programming Site (The original and ultimate source of hardware knowledge and low-level software dev.)
- The Dreamcast Development ISO... all you need to get developing under Cygwin/Windows
- Configuring a development environment under Linux
After downloading the Dev ISO (as linked above) again, I had a bit of help from Rubidium on tt-forums and got the mongrel re-compiling. To the point where the debug screen (stderr) of nullDC actually outputted my text!
/usr/local/dc/kos/kos/examples/openttd $ CFLAGS="-I$KOS_BASE/include -I$KOS_BASE/kernel/arch/dreamcast/include -I$KOS_BASE/../kos-ports/include/SDL-1.2.9 -I$KOS_BASE/../kos-ports/include/zlib-1.2.3" LDFLAGS="-lm -lconio -lSDL_mixer -lSDL_image -lSDL_129 $KOS_LIBS" ./configure --os=KOS --without-libicu --without-fontconfig --disable-network --without-allegro --without-threads --endian=LE --cc-host="kos-cc" --cxx-host="kos-c++"
Update (as of 3rd December..)
Rubidium has been doing some more great work ... a lot more solid than my hacking around... we've added a lot of support to the OpenTTD codebase to interact with the KOS build tools to the point where the command-line arguments are minimal and compiling is a much happier task.
With the kos_v2.diff patch seen here and this command-line:
$ LDFLAGS="$LDFLAGS romdisk.o" ./configure --os=KOS --cc-host="kos-cc" --cxx-host="kos-c++" --with-sdl --with-png --endian=LE --personal-dir="/rd" --install-dir="/rd"
You'll nearly get a working version... apart from the romdisk which you'll also need... so this update is pointless until I sort that out :D
Well, After a lot of rapid hacking the app compiles... finds resources... but it seems that no SDL example will display anything on my version of nullDC. Rubidium reportedly had the game running but it soon ran out of memory... something that would require an overhaul of every part of the game.
Anyway, since it's more or less done... and that no one is interested in even playing it... I think, as I did last time, this will just be put to rest again. The challenge was set and the game ran 'enough' on an emulator. Done.