Previous Blog Next Blog
Prev/Next Blog
by date

Universal binaries, and issues of endianness.

Universal binaries, and issues of endianness.
Name:Jon Frisby
Date Posted:Jan 10, 2006
Rating:4.0 out of 5
Public:YES
Comments:YES
RSS Feed:GarageGames Blog feedor Subscribe with .
Profile Page:View profile page for Jon Frisby

Blog post
I discovered, entirely by accident, that *.dso files use platform-native endianness. How did I discover this? Another developer was kind enough to provide me with a Windows binary of my T2D code. I combined this with the *.dso files generated by the PowerPC Mac build, and when I ran it, it simply went nuts. Consumed tons of memory, and had to be killed. After much trial and error, it occurred to me to remove the *.dso files and leave the *.cs files in place. Like magic, the Windows build worked. x86 = little-endian, ppc=big-endian. Oops.

Ok, no big deal, you need a separate binary for Mac and for Windows, so why not separate .dso files too? Just one small problem: Universal binaries.

For those NOT following the Mac world, "Universal binaries" are binaries that support multiple distinct processor architectures -- specifically, PowerPC and x86. Apple just announced an Intel-based iMac at MacWorld today.

I now face three choices:

1) Ship Mac/Intel, Mac/PowerPC, and Windows/Intel versions of my game, or an installer that's smart enough to pick the appropriate combination of application binary and *.dso files.

2) Hack up the engine to use "network byte order" (a la Java) for disk-based representations such as *.dso files and serialized data.

3) Ship *.cs files with my game.

I'm unwilling to do #3, and even if I did, that would cause problems if someone installed on a PowerPC Mac, then backed up their HD and restored to an Intel Mac. Similar problem with #1. The smoothest solution for my users is #2. This will create some work for me, mostly in terms of keeping up to date with patches and updates from GG, but I consider it worth it if my users never have to worry about what CPU they have under the hood.

Recent Blog Posts
List:09/20/08 - 3 days of AGDC, untold weeks to recover...
08/28/08 - DEATH TO YOUR BALLS!
04/13/08 - Hordes of Orcs for Windows, Harmonic Convergence, and Revenge!
02/20/08 - I CAN HAZ GAME BALANCE?
02/11/08 - 240 days, and counting!
12/15/07 - My milkshake brings all the orcs to the yard...
09/20/07 - "Gentlemen, I'm goin' home in my new car."
09/17/07 - OH GOD!!!! THE ORCS ARE INVADING!!!!!!

Submit ResourceSubmit your own resources!

Matt Fairfax   (Jan 10, 2006 at 18:56 GMT)
This was fixed in TGE 1.4

Philip Mansfield   (Jan 10, 2006 at 18:57 GMT)
As far as T2D is concerned, you cannot ship .cs files with your product (unless they only contain non-T2D specific code).

The other options you've neglected are:

4. Purchase the systems you don't have so you can create the .dso files yourself.

5. Strike up a relationship with another T2D developer who does have the systems you don't and send them your source files.

But if you want to make any engine changes, you'll need to recompile the source on each of the target platforms, so without access to those platforms you're going to be a bit stuck anyway.

Jon Frisby   (Jan 10, 2006 at 23:51 GMT)
@Matt: This was using T2D 1.1 Alpha 2, isn't this based on TGE 1.4?

@Philip: I'm afraid you are misunderstanding the problem. The problem is NOT that I don't have ready access to these machines. The problem is that the .dso files are not interoperable. Your #4 is what I was describing in #1, but as I said above, I don't want to have to ship two sets of .dso files.

Ben Garney   (Jan 11, 2006 at 00:14 GMT)
Nope, DSOs are definitely interoperable. :) Josh Ritter and I got some fixes into trunk a while ago, you can google the thread if you like.

Jon Frisby   (Jan 11, 2006 at 01:11 GMT)
@Ben: As Matt pointed out to me on IM, T2D 1.1 Alpha 2 is not based on TGE 1.4.

Melv May   (Jan 12, 2006 at 09:02 GMT)
We have now merged with TGE v1.4 (and very sweet it is too) so the next T2D release will solve this issue.

- Melv.

You must be a member and be logged in to either append comments or rate this resource.