(technical): Challenges of porting to linux.

Talk about the development, features, and game-play of Salvation Prophecy.

(technical): Challenges of porting to linux.

Postby Jabberwocky » Tue Dec 04, 2012 2:14 am

A user from over on the linux gaming subreddit asked about a "linux port blog". I figured I could write up a quick post on it, for those game programmer types out there who might be interested.

The biggest challenges of the port so far have been:

1. Shaders
I needed to convert all my shaders from cg/hlsl to glsl. This is required when going from DirectX (Windows) to OpenGL (Linux).

2. New Development Environment
In windows, I used Visual Studio. In linux, I use KDevelop. I also needed to switch over to a makefile / CMake build system (visual studio projects don't work on linux).
Also, there's a ton of little peripheral tools and apps I'm used to using on windows that don't exist on linux, and vice versa.
Linux had the really annoying habit of never giving me back my mouse pointer when my program hit a breakpoint, which was a pain to deal with. Also, going from visual studio's debugger to gdb is a pretty big culture shock.

3. (Re)building Middleware
I needed to rebuild all the open source middleware libraries I use. This isn't super painful, but I was a little out of practice doing this sort of stuff on linux.

4. OS differences.
For example, dealing with the location of configuration and save files. Also, linux filename case-sensitivity is a pain when coming from a windows (case-insensitive) environment.

5. Compiler differences.
Even though g++ and VC++ are both c++, there's still a ton of little differences and quirks between the two compilers that either lead to compile/link errors (easy fixes) or subtle bugs (hard fixes).

Example i) the abs() function.
In VC++, abs() works for floats.
Code: Select all
abs( -1.37f ) equals 1.37f

In linux, the abs() function is defined for integers only.
Code: Select all
abs( -1.37f ) equals 1

You need to use fabs if you want to operate on floats.

Example ii) unicode handling
There are a bunch of Visual Studio specific functions for dealing with unicode that don't exist on linux.

6. Middleware cross-platform bugs

I've had to change stuff in CEGUI (user interface library), OIS (input library), and OGRE (graphics library) to get everything working properly on linux. At least I have open source stuff to work with - phew!

7. Building an Installer
Totally different deal on linux and windows.
There's different concerns and different flavors of "dll hell" between both linux and windows.

8. Testing
On windows you have Win8, Win7, Vista, XP.
On linux, you have a bunch of different distros.
Each needs to be tested, preferably in combination with different hardware (especially AMD vs NVIDIA graphics cards).

This is the biggest PITA when making PC games, and you're starting from scratch when you switch over to a linux port. You wouldn't believe how many times I've played through the game. ;) Next time around, I really need a better solution than being my own QA department.
User avatar
Site Admin
Posts: 461
Joined: Sat Jun 25, 2011 4:39 am

Re: (technical): Challenges of porting to linux.

Postby loath » Thu Dec 06, 2012 1:59 pm

very interesting -- thanks for posting this.

any trouble with physx? they still haven't posted an x86/x64 version for visual studio 2012 yet. (late december 2012 i'm told).

i haven't used linux in awhile but i always used slickedit as an editor (on gentoo). around 2006 it was the closest thing i could find to visual studio, especially in the debugger (with gdb).

anyway, i'm still hoping you port to win8 (intel & ARM) at some point. :)

best of luck!
Posts: 8
Joined: Wed Apr 25, 2012 8:57 am

Re: (technical): Challenges of porting to linux.

Postby Jabberwocky » Sat Dec 08, 2012 4:07 pm

If I do another port, the next one would probably be mac. It'd be nice to have the full set of (windows/linux/mac). That's all the major Steam platforms, and also what cross-platform bundles like the Humble Indie Bundle like to see.

Plus, I've gotten a lot of this from people I know:
"Does it run on a Mac?"
"Aww man! Crappy!"
User avatar
Site Admin
Posts: 461
Joined: Sat Jun 25, 2011 4:39 am

Re: (technical): Challenges of porting to linux.

Postby Jabberwocky » Sat Dec 08, 2012 4:14 pm

Luckily, PhysX worked out pretty smooth on Linux. When I originally downloaded the PhysX version I use on Windows, I also grabbed the mac and linux version. Which is great, because I don't think the older version of PhysX I use are available for download anymore.

One bad thing about PhysX is that there's a lot of subtle "gotchas" - things that can go wrong, and they're hard to debug. There isn't particularly good support for it either (but it's free, so it's hard to complain there). Sometimes it's only a lucky google hit, or a lot of tinkering around, that gets you running again. But physX is really fast - without it I probably would have run into troubles with the number of ships/troops/bullets that get fired around in Salvation Prophecy's battles.
User avatar
Site Admin
Posts: 461
Joined: Sat Jun 25, 2011 4:39 am

Return to Discussion and Feedback