Porting a cross platform game to OSX

So there aren't very many games for OSX. Ever wonder why?

The Journey Begins

As an aspiring indie game developer, I believe strongly that my game should run on all the operating systems possible - Why limit myself to one operating system when there are happy, friendly people willing to buy my game on all three?

So when I was designing ScrumbleShip, I made sure to choose cross platform ways of doing things - Every library I chose worked on Linux, Windows, and OSX. This made running my game on windows and linux a breeze - No issues worth mentioning.

However, I immediately ran into a problem with OSX support - Namely, there didn't seem to be any easy ways to create a Mac program from other operating systems. So I'd need my own Mac - But with prices starting at $1000, a new Mac was about $967 above my meager indie budget. This kept me from really focusing on OSX support for the first year of ScrumbleShip.

Cross Platform? Not quite.

When I finally got my hands on a used machine, I ran into another problem - SDL, which created windows and handled input for me, couldn't jump through the hoops required to get a modern OpenGL window from OSX. (OpenGL is how you render cross platform 3D) So even though I could "run" ScrumbleShip on the Mac, I couldn't actually display anything on the screen.

Naturally, I had to replace SDL - "GLFW" seemed to be a better fit for my situation, and could make OSX hand me a modern OpenGL window. It took about a month of work to rip out the old SDL code and replace it with GLFW code.

Then I ran into a third problem.

One of these things is not like the other

The OSX version of OpenGL is a little different from the Linux and Windows versions. In Linux and Windows, you can mix older and newer OpenGL. So I used the new OpenGL when I needed power, and the old OpenGL when I needed something quick and simple. In short, all my 2D graphics used the older OpenGL.

You cannot mix old and new style OpenGL on OSX. It's one or the other.

Exciting
First Mac-Compatible 2D rendering.

So over the next couple months I slowly replaced all my old-style rendering with the much more complex new-style rendering. The involved removing my cross-platform font rendering library, and basically re-writing a simplified version of it in modern OpenGL.

But at the end of all that, I had code I could import into XCode, compile, and run. ScrumbleShip had finally made it to the Mac!

Mac
Success!

Then my Mac broke. That one wasn't Apple's fault, but it has kept me from updating the Mac build. Thankfully my neighbor is a Mac-user and has graciously allowed me to borrow her computer, so I'll be able to hand out an OSX version again within the next few weeks.

Conclusions

Despite the lack of cross platform tools, some not-quite-cross platform libraries, some poor choices on Apple's part about how to support OpenGL on their platform, and failing hardware, I successfully got my game working on OSX. I can really understand why many developers wouldn't make this choice, however - The time I spent getting Mac support hasn't really justified the money coming in via Mac users.

But I still think it was the right thing to do. Each game coming out on OSX helps break down the barriers between the systems, and OSX users deserve cool voxel space games just as much as Linux and Windows users. Besides, there's least one good thing that came out of the porting effort - GLFW is smaller and easier than SDL for our purposes.


Curious about the game?
Get
Click here for demo and purchase info

Cheers,

-Dirk

Ryulord Ryulord's picture

There not being so many games for OSX isn't nearly as much as a problem as it used to be. Especially since Unity became so popular to use for indie game development. I can't think of a single post Minecraft indie game I've played that didn't have OSX support. The big AAA publishers are making the transition more slowly but they do seem to be moving more and more towards getting more playable on OSX. The reason you seem to be having so many problems is because you're a masochist who get's as close to building a game from scratch as one can nowadays. Otherwise you'd have more or less picked an engine that either did or didn't support OSX and that would be the end of that.

Redtricity Redtricity's picture

Thank you so much for going though all that trouble just because you think it's the right thing to do!

-A Mac user

Lord Honorable Sir George III the Great Jr.

joedan76

Dirkson do you have an approximate date of when youll be able to fight and foy in your ships. Overexited at the moment

Battleunit

Your desire to support Mac sold the game to me, and since I will soon be teaching a class using the game, around 75 students per year.

Game Designer and Player

jayrhacker jayrhacker's picture

iz in ur srcs, porting to teh macos

jayrhacker jayrhacker's picture

Build succeeded: 12/24/13, 1:28 PM
*275 warnings