I’ve been working to get the current code of “Phase 2” to compile and work under linux for the whole last weekend (and my eyes kinda hurt, again sitting in front of a monitor ;)). And things went much faster than I expected, so I was able to compile and run the game under linux for the very first time ever!
First step was to add code for all things that are specific to an operating system. So in addition to all the IFDEFs that differntiate between free pascal and Delphi, there are now also IFDEFs that differntiate beween windows and linux. Luckily MacOS and linux are pretty much the same when it comes to OS specific functions, so most of the IFDEFs for linux should also work there. This includes creation and management of the render context (WGL, GLX), getting the user’s home directory (to store logs, saves, screenshots, etc.) and much more. Currently there are still several functions missing from the linux version, e.g. getting a list of available screen resolutions and the possibility to change them via the settings like on windows. I also had to install an additional package for MESA (the software OpenGL implementation running in the VM) so it supports S3TC texture compression. That’s a must for the game cause almost all textures are stored as DDS and with compression.
Second step was debugging and stepping through the code. For some reasons it seems that there are small differences between FPC (2.6.) on windows and linux. For example I’m using a THashedStringList for getting texture indices by name from my texture manager. On Delphi this worked fine, whereas on linux I only got blank white quads. In the first place I thought that the OpenGL implementation in my VM wasn’t able to load the textures, but after some (unstable, gdb often lost trace) debugging I finally found out that the THashedStringList was case-sensitive by default, and setting this parameter to false oddly had no effect at all. So I just changed my texturemanager, it now inserts and compares with uppercase texture names all the time. Same goes for the localization database, which was suffering from the same problem.
In the third step I had to remove the sound system (for now). The game uses a rather old version of FMOD for it’s soundsystem, and though FMOD works with Delphi and FPC and also win, linux, macOS, they dropped Delphi/FPC-Support some time ago. And since I don’t have the last linux package version of FMOD that I used for the windows releae, I just couldn’t get it to work. I haven’t yet found that version anywhere (not even in FMODs archives), so I guess I’ll have to go for a different path on linux. I actually once wrote a soundsystem based on OpenAL, so I may take a look at it and use that one for linux.
After these steps I was finally able to compile, link and run the game under linux, for the very first time in the long development history of the game! Yeah, that’s kind of a historic milestone for me and was worth spending a whole weekend in front of the IDE.
As for a public release it’s still a way to go. First I need to get sound in again, some OS specific stuff is still missing and I also need to setup a real linux somewhere, as the VM is nice to test but I wanna see the release running on a real linux before I’ll spread it to the public.
But yes, linux support is finally coming, and with it maybe also a MacOS release somewhere in the future!