Finally, after beginning soon after the game’s Windows release on Steam, and well over a month after I initially wrote my first post about this topic, I’m finally done with porting Gemstone Keeper to Linux (for the most part) and ready to write about what I’ve learned from porting it over. Since both the Framework and Level Generator have been ported, getting the whole game to compile and run wasn’t as confusing as the last two, but that didn’t stop it being tedious.

Part of these changes, is due to changes I made to the Vigilante Framework since my post about it. Since I made some changes to improve some features of the framework, turns out that didn’t mean Linux wouldn’t immediately accept them. Specifically the use of smart pointers.

The easiest way to set up a smart pointer (specifically unique pointers), would be doing this:

material = std::make_unique<V3DMaterial>();

However, GCC compiling with C++11 doesn’t like this, but will accept this:

material = std::unique_ptr<V3DMaterial>(new V3DMaterial());

Like I said, tedious.

After handling all the const/non-const conversions and adding additional includes, I got it to compile. Now time to make the main change.

The Intro Screen

So for those who haven’t played the game yet (and honestly, why haven’t you? :P), the intro has a command prompt appearance, and is made to be a fun way to set up the visual style and provide a bit of humour at the same time. For Windows, it made sense to emulate the white text on black Windows command prompt, but for Linux there need to be some change. There was a problem:

Because there are a lot of terminals for #Linux, based on OS type and Kernel. Nothing like Windows with it's standard one and few variants. pic.twitter.com/sacwbB1cWj — Gamepopper (@gamepopper) May 12, 2017

I asked around for what would be the ideal Linux terminal to emulate, most recommending xterm, and after a few tweaks, this is what I came up with.

Here we go! First attempt at a Linux terminal! Hope the colour scheme makes the text easy to read. #screenshotsaturday #linux #SFML pic.twitter.com/pGeiYBQvMy — Gamepopper (@gamepopper) May 13, 2017

Test Runs and Feedback

Now it was a good time to get Linux players to test a demo of the game. Since I created and tested the port on a Virtual Machine of Linux Mint, it was important to see how the game would run on not only different versions of the OS, but also proper installs on dedicated hardware.

I did my test runs on the SFML forum, Twitter and Reddit (both /r/gamedev and /r/linux_gaming), asking for Linux Gamers to try out the game and let me know if any issues arose.

Amazingly, there was only one instance of a crash, a bad_cast error thrown because of how I was converting a string to start with an uppercase letter (awfully specific I know). Aside from that, no platform specific or game breaking bugs.

One problem that was addressed was file permissions and runtime libraries. See, Gemstone Keeper uses the Steam API, and since there is no statically linked library, this needs to be included with the application.

For some reason, having the library in the same location as the executable doesn’t deal with Linux finding it when running the executable. I was able to get it to work by creating an .sh script that included the root of the executable to Linux’s library path temporarily. The .sh script does need to have read and write execute permissions though, and packaging it into a tar.gz will preserve it. How this will work for Steam will be interesting…

Finally, there is gamepad support, one person was able to get Xbox Controllers to work, and from what I see in the Linux Gaming community, those are the second most popular controllers so that’s good. One person tried with a PS3 controller, and while it works, the button mapping was all wrong.

I could use another gamepad controller API from the one I’m using to get them to work with both Windows and Linux, but that would mean a lot of testing. I could also add in controller configuration, but that would be a lot of work for an update that wasn’t meant to take nearly two months to work on.

As such, for the meantime, Gemstone Keeper will be XInput only. Steam Controllers should also work fine assuming either mapping works the same as XInput controllers or the device is mapped to keyboard and mouse controls.