A Strategy for Cross Platform Development

One of the goals of Classic Invaders from the beginning was that it should run on Windows, OS X, and Linux. One way that this can be accomplished is by using #define sections to separate the platform specific code. However I wanted one code base to compile and run on these platforms without a mess of preprocessor directives and different platform specific code to maintain. By using SDL, Boost, C++, and GCC and staying within the subset of what works on the various platforms I was able to achieve this.

SDL is the main ingredient that makes this possible, but you still have to get development environments setup. Check out the series of articles I wrote Setting up for development with SDL for some specific instructions.

For hardware I have two computers. An iMac that is set up as a triple boot system: OS X Leopard, Windows Vista, and Fedora Core 8. And an old Pentium III notebook that runs Linux (CentOS 5). I setup CentOS as a Subversion server accessible on my home network to manage the game files and then boot into each system to test and play. I find it most efficient to have command line build systems setup on each OS and use the Xcode IDE for coding.

There are of course many possible setups depending on your favorite platform and the hardware you have available. Another option is to setup Linux with a cross compiler and build for both Linux and Windows from one machine.

Whatever setup you choose it's important to occasionally test on each platform as you make your game to account for any discrepancies that may occur.

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <em> <strong> <cite> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Textual smileys will be replaced with graphical ones.

More information about formatting options