Gemstone Keeper – Quest to Linux Part 2 – GenLevelTools

Last time on Quest to Linux, I went through porting the Vigilante Game Framework to Linux, but the quest isn’t over yet. The next big task is porting Gemstone Keeper’s level generator and editor, the GenLevelTools, since I need to be able to get the caverns from somewhere.

https://upload.wikimedia.org/wikipedia/commons/a/af/Tux.png

GenLevelTools, aka the Procedural Level Editor, is a tool/library set that enables proceudrally generated grid-based levels to be modified and previewed in a level and used in games, while independent from any specific game engine or renderer. It was originally developed for my University Thesis on Procedural Level Generation and I later did a talk about it at the International Roguelike Developer Conference in Nottingham. The library is written in C++, so language specific quirks like forward slashes and for loops apply, so the main challenge this time around is the level editor, which uses Allegro 5 as well as the GUI library GWEN.

Allegro 5 is a C framework, although you can still use it for C++. Fortunately like SFML, it’s easy to set up for Linux since it’s part of one of Ubuntu’s repositiories. GWEN is a GUI library that was developed by Garry Newman (of Garry’s Mod). It was the easiest to set up for Windows but I had a few problems with the Linux version, as the gmake scripts rely on finding certain libraries and ending the entire scripts if those libraries cannot be found. This is different from running the scripts for Windows, which create Visual Studio projects that you can apply the libraries yourself. After tweaking the scripts and the source files a bit, I managed to get the GWEN and GWEN Allegro Renderer to build.

Aside from the main changes that I mentioned in the last post (using correct slashes, for loops) there weren’t that many changes I needed to make. I did have to add a lot more include statements, since despite being standard library stuff, GCC doesn’t immediately know what functions like memset, modf, floorf or ceilf among others off the bat, unlike Microsoft Visual Studio. After all these changes the library was able to compile smoothly. To make absolutely sure that it works within Linux, I wanted to build and run the editor, hence why I wanted to set up Allegro and GWEN. I managed to compile it with little effort, but something went wrong…

The editor crashed almost immediately, and the only reason I was able to show the following above was because I tried running the editor without the GWEN GUI rendering in the scene. It didn’t help that Code::Blocks debugger wasn’t working initially, and the closest I got as an error was below.

Fortunately I was able to configure Code::Blocks debugger to work, and was able to find the route cause of the crash being from the GWEN Allegro Renderer being unable to load the font, which is odd because the font I used (Lucida Sans) was able to load fine in my editor code, but fortunately GWEN provides an open source font (Open Sans) that runs just fine. So now with the GUI render up and running, I can test the editor!

I’ve been able to compile the library as both a binary and static build, as well as the editor. I could also compile the unit testing and C# wrapper for it too, but since I mainly wanted to get this done for Gemstone Keeper, I’ll leave it like this for now. Time for the main course!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s