Dev Notes

Posted in Developer Blog by anotherjake
6 Nov 2010

Hi all! Just wanted to kick off a dev blog for our upcoming project, which we are calling Ace2 for now.

This week I have been focusing on two things:
1) getting my 3D model code switched away from Apple API dependencies
2) getting everything running cross-platform ASAP

On task #1: I was working on my 3D model code and realized that it was written in a *very* Apple dependent way. It is so intertwined that I am going to have to rebuild that from scratch, unfortunately.

On task #2: I have come to the conclusion that I need to get things working on all platforms right away so that I can properly implement the 3D model code without having to worry about whether or not it will be portable later on. There are other reasons to do this as well, but that’s the one on my bench at the moment.

To go cross-platform, practically speaking, most developers use SDL:

Here is a nice list of games which use SDL:

From my point of view, there are a few hitches to using SDL:

First, while I’ve known about SDL for many years and have recommended it to others countless times, I have never actually used it myself. The reason being that I’ve never had a need or desire for cross-platform API support since I’ve always only developed for the Mac (and iOS). Obviously that is now changing with our plan to bring all of our future games to all desktop platforms. It will take a little time to learn how to effectively use SDL on multiple platforms.

Second, my existing “engine”, called 3Quad, was designed from the core to do things “my way”, not the “SDL way”.

Third, since 3Quad was originally designed for the Mac only, I am able to more easily use Mac-native technologies with it. SDL appears to be somewhat inflexible about how it works, and that is by design and necessity for cross-platform compatibility. In other words, my way of “windowing” on the Mac is better than SDL’s way, if only a little better, but obviously my way isn’t portable.

Fourth, I am not sure if SDL will be allowed on the Mac App Store or not. I assume everything is fine except for the possibility that SDL may be using some non-public API calls for a few things, which would get any app using SDL rejected. One example of such an unsupported API call which I stumbled upon in SDL for the Mac is setAppleMenu, which was removed in 10.4 but apparently still works.

The next obvious question would be: “Well then why not use your native code on the Mac and SDL on the other platforms?”

Answer: That is what I intend to do.

Unfortunately, that is easier said than done. Like I mentioned earlier, in the core of 3Quad, the way I do things is a bit different than the way SDL does things. Not that either way is particularly better than the other, but they’re not directly compatible. But we *need* cross-platform compatibility, and I really don’t see any practical way I can justify *not* going with SDL, so I am going to be forced to do things the SDL way, one way or another.

I have a plan! It’ll take a little extra work, but here’s what I’m going to do: I am going to start rebuilding the engine from scratch and I’m going to call it 3QuadX (the “X” is my super secret code for cross-platform, as in “x-platform”). I’ll be able to reuse the vast majority of code in the engine, so it’s not as tall of an order as it seems at first, but it isn’t going to be a no-brainer either and I figure it’ll take a couple weeks at the very least.

The main idea is to re-implement all my base windowing code and timing code to use SDL on all desktop platforms, equally across Mac/Win/Linux. That way I can fully test the code running on the Mac using SDL in exactly the same way as it would be used on the other platforms. This should allow me to easily deploy to Win/Linux. THEN, what I will do is redo my native Mac code to optionally replace SDL with the flip of a switch, so I can switch back and forth between SDL and my native code on the Mac, arbitrarily. This way I will be able to get the best of both worlds and ensure cross-platform compatibility at the same time.

- Jake

Leave a Reply

Your email address will not be published. Required fields are marked *