Step 1: Port to SDL2 on Windows

Step 2: Remove Windows specific dependencies. We chose OpenGL instead of DirectX, and OpenAL instead of the current flavour of Windows audio.

Step 3: Once you’ve got a relatively platform neutral game running on Windows. then get that over to Linux. Part of the pain here is your project files are probably still Visual Studio projects, and so actually compiling will be hard. We used CMake to help solve this problem, but there are choices in this area.

Step 4: Once you are actually compiling, you’ll be fixing compiler differences between MSVC and GCC/Clang, but these days it’s mainly a case of adjusting all the code to be cross platform friendly instead of making GCC specific changes.

Step 5: Once you’re here, the “fun” begins and you start to learn about different Linux distributions, and what libraries they ship with, etc. I recommend using the steam runtime to solve this problem. It’s a build environment that includes a specific set of libraries that you can depend on not changing. I understand that’s not always the solution that people prefer, but it does help get your game running on Linux. The important part to know is that the name is kind of confusing. The Steam runtime is made by Valve, but it doesn’t actually include any of the Steam client, or references to its API. It’s just a collection of open source libraries to link against.

Article taken from GamingOnLinux.com.

I had the pleasure of speaking to two different teams at game developer and publisher Beamdog , notable for Baldur’s Gate: Enhanced Edition and the soon to be released Planescape: Torment: Enhanced Edition First of all, I had a few questions answered by Alexei Pepers, Lead Programmer on the Beamdog Client Alexei Pepers: Supporting Linux was part of the plan for the new Beamdog Client from the beginning, which made things much easier as we could evaluate technologies as we were picking them to make sure Linux was supported, instead of trying to add it after the fact. The Electron framework which the Beamdog Client is built in is meant to be cross-platform and so it was surprisingly easy to keep it working on all platforms without too much effort. The only difficulties we did had stemmed from some dependency wrangling, and trying to ensure that the Client followed reasonable Linux conventions in terms of where to store data or install games. Overall, it was a surprisingly painless experience.Alexei Pepers: We wanted to make it easy to download and use the Beamdog Client on Linux, and we wanted to support different distributions as much as possible. AppImage was the suggested format in the Electron distribution package we use, and seemed to be a good fit for our requirements.Alexei Pepers: The previous incarnation of the Beamdog Client was more similar to Steam, in that we did once use it to sell hundreds of games instead of just our own products. The new Beamdog Client is a conscious movement away from that, as we’ve decided that we’d rather focus on supporting and showcasing our own products instead of trying to maintain a huge library of games. Our plans for the future revolve around delivering people the best experience possible with our Client and supporting games with easy to access updates.Alexei Pepers: In addition to supporting us directly and helping us keep running, using the Beamdog Client over Steam gives an experience that’s more focused on our games and the community we’ve built around them. We have peripheral content like manuals and illustrated guides to the settings that are directly accessible through the Beamdog Client, as well as links to our active forum community. Our games through the Beamdog Client are also DRM-free, and we have plans to make it easy to access the betas for our games for people who are interested.And now, it’s time to speak to the the rest of Beamdog about their porting and Linux gaming. Here I spoke to Scott Brooks the Beamdog CTO and Alex Tomovic the Planescape: Torment: Enhanced Edition Project Lead.Scott Brooks: Linux was actually the first platform other than Windows to run Baldur’s Gate when we started the work. I’ve always been a fan of porting to multiple platforms. A lot of C/C++ bugs exist inside the undefined behaviour space in the various compilers. Often after porting to a new platform you will find bugs that make you ask “How did this ever work to begin with?” We’ve found that porting to Linux makes the game more stable and perform better on Windows too. Porting to Android for example, improved our iOS memory usage and rendering on all platforms.Scott Brooks: It took Trent quite a while to acquire the licences from Atari, and you’ll have to arm wrestle him to to get those stories.Scott Brooks: Finding a large fan base for game that is 15 years old or more is rare, and proves that a market exists for the game. The original developers had moved on to other projects, and nothing was being done with these titles.Alex Tomovic: Planescape: Torment and the rest of the Infinity Engine games are timeless RPG classics. Bringing them to modern devices and operating systems ensures that their exceptional stories will live on and reach an even wider audience.Scott Brooks: GemRB is a wonderful project. It’s amazing what they have been able to accomplish by reverse engineering everything. This kind of relates to the question above about choosing a game like Baldur’s Gate, having a game that people are passionate enough about to re-implement the client speaks volumes to how good of games these are.Scott Brooks: I think SteamOS opens up Linux by sanding off some of the rough edges. I feel a lot of the open source world operates around giving people all the tools they need to fix a problem themselves. Some people don’t enjoy that tinkering process and would rather just play some games. SteamOS helps a bunch in that regard. It also increases the profile of Linux games and Steam in generate provides an actual marketplace on Linux so you have somewhere you can sell your game on Linux.Scott Brooks: It’s not easy, but it’s worth it. Honestly it’s less about bringing a game from linux, and more prying it off of Windows (or the original platform it was developed on). When bringing a game to Linux, Ryan Gordon did a great talk at the Steam Dev days that discussed the exact approach we happened to have used.Alex Tomovic: Seeing our games run flawlessly on my minimalistic Arch install gives me high confidence in their stability.Scott Brooks: I don’t think so. I would guess that a title that ended up on Linux via Wine would be because there was not original source code access, or the cost to do a full port to linux was too high. In both of those cases without Wine there would have been nothing on Linux.Scott Brooks: 64 bit support is on our radar, the engine has been ported to 64 bit for iOS, and macOS, so the hard work has been done. One of the main goals of the Enhanced Edition is making sure it runs on modern machines so we will be working towards getting 64 bit builds on Linux.Scott Brooks: Vim, gcc, and make? I think the more interesting aspect is the libraries we used. Our graphics are rendered with OpenGL, audio is provided by OpenAL. Our in game movies are encoded as webm files, and audio is encoded with ogg.Scott Brooks: Hard to say. Sales for different operating systems can be hard to track because platforms such as Steam and GOG allow you to play on more than one operating system.Scott Brooks: We’ve put in a lot of work to bring the Infinity Engine (which dates back to 1995) to Linux, Android, macOS, and iOS. We certainly plan to support the Infinity Engine going forward on Linux, but support for future games depends on the technology used in their development.I would like to thank everyone at Beamdog for their time, honest answers and for bringing some true classics over to Linux.If you know of a developer who would be up for an interview, please do ask them to get in touch with me.