February 2013

Projekt “W” – Phase 2 – First linux release!

phase2_logo_iconBelieve it or not, but after a month of hard work (and only very little sleep), the first open beta release of “Phase 2” for linux (i386) is finally here!

Only a few small issues had to be fixed since my last posting about going multi-platform. No big deal, only a few visual glitches, missing staff images and (very annoying) a missing flood fill algorithm. I use flood fill to generate the colored territorial maps on each turn, and lazarus doesn’t implement this for the linux widget sets, so I had to write one on my own that isn’t slow as hell. And then I did some final game testing this afternoon and only found the game to be perfectly playable, so I decided to finally release the linux version.

Download :
(Linux, i386) Projekt “W” – Phase 2 – Open Beta rev. #142 (~65 MBytes)

Important : Please run the included “startprojektw.sh” script instead of the application itself as the game needs a certain library to be in the search path to run. If you run the application itself without libbass.so (which is what the script does), the game won’t launch!

Also note that I updated the windows release too :
(Windows) Projekt “W” – Phase 2 – Open Beta rev. #142 (~60 MBytes)

So if you’re a linux user and haven’t been able to play my latest game, you can now run it without using something like Wine. But please note that there may be bugs not present in the windows release, and that I only tested on one linux distribution, so I can’t tell about the other numerous distros out there. So if the game is running for you feel free to comment with your linux distribution so I can see where the game is running and where not.

Going multi-platform, part 5 : Finishing touches

phase-2-linux 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.

Going multi-platform, part 4 : First run on a native linux

After another week of intense coding on “Phase 2“, trying to fix the mistake I made with nativeXML, I finally got all of the xml stuff switched over to my own xmlwrapper. As hinted at in my last posting, nativeXML wasn’t working on linux (and I haven’t been unlocked for their support forums, after over a week of wait!) so I decided to write my own wrapper unit that uses fpc’s or delphi’s xml implementation, depending on the compiler target. Once again this was a huge code change (thousands of lines of code) but now all of the game’s unit have been changed to use this xmlwrapper, removing any references to external xml libraries.

So with that obstacle out of sight I decided it was time to install a real linux one of my partitions. The virtual machine was nice for getting the first version compile and run in linux, but developing in a VM is kinda cumbersome, especially as the OpenGL visuals don’t mirror a real system, so instead of trying to fix some awkward visual bugs (that are only visible in the VM) I made room on my external harddisk and installed linux (mint, same as in my VM) on a partition. So now I can also boot into a real linux with complete hardware acceleration and an OpenGL implementation that offers me the same extensions and performance as on my windows system. Installation itself went pretty easy, though I must admit that the linux system oddly isn’t nearly as stable as my good old Vista64. Debugging my game often hangs the complete system, requiring a hard reset, my USB ports aren’t powered down when shutting down linux (which is annoying, cause my lit keyboard is still on power after turning off my PC) and my wireless network drops out every few minuts. But well, just for developing and testing my game it’s fine, and that’s what I needed.

So here are the first screenshot of the game running on a native linux installation. I actually wanted to post a video, but finding a working screen capture application on linux (like fraps or camtasia for windows) was kinda impossible and made me waste half of my sunday. But anyway, here is the first bunch of screenshots showing the running natively on linux directyl from the lazarus IDE :

As you can see from the screenshots, performance is already pretty good (though it’s lacking in several areas, I guess due to compiler differences between fpc and delphi). But there is still a lot work to be done before I can release a linux build into the wild. As already said the soundsystem is currently disabled (because of the FMOD package version I need not available anymore), fullscreen mode along with getting resolution list is also missing, and timing is currently done via GetTickCount, which isn’t nearly as accurate as QueryPerformanceCounter for windows. And there seems to be a small encoding problem, wrongly displaying special chars like Umlauts (‘ü’,’ ä’, ‘ö’).

But yes, it’s fully playable and with only a bit more work I’ll finally have a working linux version of Projekt “W” – “Phase 2”!