After weeks of hard work and learning a lot about the differences between coding on windows and linux, the current source revision of Phase 2 is completly functional on linux and playing the same as a windows version. So if you’d put them side-by-side in fullscreen mode you wouldn’t notice any differences!
Currently I’m putting the finishing toches on the linux release and only a very few minor things have to be fixed and adjusted before I’ll release the linux version into the wild, so you guys can play with it and provide me with feedback, the linux world is far more fractured than the windows world, so I’d love to know how the game runs on different distributions.
Since the last posting I did the following for the linux source path of the game :
Switched to the BASS audio system
In my last posting I wrote about the problems finding an fmod linux library that would work with my game and free pascal. The problem here is that delphi/fpc support has long been dropped from fmod, and since a lot of declarations have changed, using the last delphi/fpc header with a recent fmod library wouldn’t work. So I switched over to BASS, a sound library that I already used several years ago. It still supports delphi/fpc, is leightweight, updated on a regular basis, free for non-commercial use and supports many platforms. You can get it from un4seen. Since my different sound systems (fmod, OpenAL) are all abstracted via TSoundSystem and TMusicPlayer classes, adding in BASS only took me 15 minutes, so the game is now running on a different sound API and the linux version now also plays music and samples.
Added resolution selection / switchting
This was a lot harder than I intially thought. For windows this is pretty simple (as I’ve been using it for years), but for linux I had to do a lot of research before I started implementing it. In the end I went with xrandr and you can now change resolutions and windowed / full screen on linux like on windows.
Implemented performance fixes
I hinted at this in one of my recent postings. There are several performance differences between free pascal and delphi, so code that ran pretty fast on delphi made the game crawl on free pascal. One example was the transfer market. On delphi I had all texture names for all available staffer picutes in a stringlist and on drawing each staffer entry in the selection listbox, I looked up the texture ID of the staffer’s face via this stringlist. If that image was already loaded into VRAM I draw it, if not it get’s loaded from the virtual file system. On free pascal that code made the game go down below 10 fps when opening up the transfer market window. So now I load up all staffer pictures when loading the game (only takes a few ms) and directly assing the texture ID to a staffer. Sicne this is faster in general, this will also make the delphi version run faster.
So the linux version is looking fine, and I hope to have a public release ready within the next two weeks, so the linux crowd is finally able to play my game outside of wine or virtual machines. And though it was a hard piece of work (partially making me wonder if it was worth all the hours of coding) I think it was worth it as I learned a lot about coding on linux. So for my future projects I’ll take multi platform support into account from the very beginning.