How to go about porting a Mac OSX game to Linux
Any expert advice on how a beginner to porting might go about starting a project like this? Any porting guides or resources that might be helpful? Commonly used tactics?
My idea is to help make a game cross-platform compatible, but I don't know how to start going about it. The code is open sour开发者_如何学Cce (anyone interested: https://github.com/prophile/xsera). It looks like it's written in C++ and uses Lua scripting.
I was going to suggest using SDL (the Simple DirectMedia Layer), which is a great cross-platform library for developing games that helps you with input events, graphics, audio, etc. However, it looks as if the game you're porting is already based on SDL via a game engine called "Apollo", which is designed to be cross-platform:
Apollo uses SDL and OpenGL for graphics and cross-platform compatibility, meaning that any game built on Apollo can run on Windows, Mac OS X, and Linux.
Have you tried contacting the authors to ask about the progress of a Linux port, and whether there's something in particular you can work on to help? It sounds from the FAQ as if there is some such effort under way, and you don't want to be duplicating effort needlessly.
In a hypothetical more difficult case, where you just have a pile of source code that was written with no eye on its possible portability, I'd say that porting a game from one platform to another tends to be an iterative process of reading the source and prodding at it until it does what you want, involving:
- Understanding some part of the code (the crucial bit!)
- Trying to get it to compile
#ifdef
ing out parts that you won't need right at the moment- Replacing low-level functionality with that from some thin cross-platform library
- Committing regularly
- Trying to avoid breaking anything on the existing supported platform
... and it's best if you at first try to just get something to work, which means putting even a basic build system in place, and so on.
However, since the original authors clearly intend this game to portable to Linux, it's should be much easier than that - how easy largely depends on your experience and enthusiasm for getting to grips with systems that you don't know.
精彩评论