Roguelike Languages.
Gambas
The column »Roguelike Languages« introduces several well-known or not-so-well-known programming languages in which somebody can write a roguelike. It is assumed that you already have some basic knowledge about programming techniques.
This first issue of the column talks about Gambas, a language for Linux and very similar to Visual Basic, but with its own flavor. The word »gambas« means »prawn« in spanish. However, it’s also an acronym which stands for Gambas Almost Means BASic. This describes the language pretty good, as the syntax is nearly 99% compatible to VB.
Gambas is developed by Benoit Minisi and updated rather frequently. The most recent development version is 1.9.47. The last official stable release is 1.0.17. Because this release lacks of many features and because the development version does not make many problems, this article describes Gambas 1.9.47.
Compiling and Installing Gambas
To compile Gambas, X11, QT3, KDE3, PostgreSQL and MySQL resp. their development packages have to be installed on the system. After getting and extracting the source archive, a simple
./configure
make
make install
will install the environment (of course, the last command has to be given as root). The Gambas compiler and all available components will be built, then the Gambas compiler will compile the Gambas IDE which is written entirely in Gambas itself. Once everything is ready, you can use gambas2 to start the IDE.
Creating a Project
The first thing you will see is the startup dialog in which you can create projects, open projects or open one of the examples which come with Gambas. For now, just create an empty project by clicking New project …. You will then have to select the application type (choose »QT graphical application« and click next).

The next dialog asks for a name and a window title (enter in both input fields for example »RoguelikeGambas«). Then select a directory for the project (there all project related files will be stored) and click next again. Now the project will be created.
Trying Out
If you are familiar with Visual Basic or similar development environments, you will feel right at home in the Gambas IDE. On the left, there is the project browser. All project related files, like forms, classes, modules and data files (e.g. graphics or sound files) are shown in it. At the moment, it should be nearly empty, except one form called FMain.
Double-click on the form’s entry in the project browser to bring it up. It will then be shown in the middle of the screen. There you can add controls to the form, change its properties and start to edit its code. Right-clicking on a form or a control brings up a context menu in which several editing options are given, together with the possibility to select events which you want to process.
If you have a button called btnQuit, for example, and you want this button to close your program, you may right-click on the button and select the event Click. Then the code editor will be shown for this event and you can fill in the needed code, e.g.
PUBLIC SUB btnQuit_click()
FMain.Close
END
Starting that example will result in a working (but rather useless) program.
If you have entered the example code with your own hands and not just copied it from this article, you might have noticed that Gambas has a very useful code completition feature which helps a lot when writing code for the numerous controls that are available. It also works for built-in and defined functions.
Gambas for Roguelikes
Although Gambas is so easy to use, using Gambas for developing a roguelike is depending on the intended target environment. Graphical applications, using QT, GTK+ or SDL, can be created very fast. Nasty things like memory management or low level interaction with GUI or graphics libraries are hidden behind the very complete, but easy-to-use object framework.
In theory, this is also true for console applications. Unfortunately the console output is very basic (only the PRINT command for linear text output seems to be supported, or at least the docs don’t state anything else) and there doesn’t seem to be support for the rather popular curses library.
Besides this, Gambas has another major obstacle: While Visual Basic programs just need a single runtime DLL or, in newer versions, the .Net framework to be installed, deploying a compiled and linked Gambas program forces the enduser to compile and install the whole Gambas environment. I fear that this will surely prevent a lot of people from trying out programs written in that language.
Hopefully, Benoit Minisi will make console development more effective and program deployment easier soon, because Gambas is a modern language with a userfriendly IDE and has a lot of potential – not only, but also for roguelike development.
No comments have been added yet.
If you would like to comment on this article, use the form below. Your comment will be reviewed and activated as soon as possible.