Gambas Genie

From PigaLore
Jump to: navigation, search

Gambas Genie (informally known as GG), or the Gambas RTS Engine, is a free software real-time strategy engine being written in Gambas by Piga Software for the Free Empires project. It is currently being developed in the game/engine test-bed Lamp Refugee.


  • TBD


Back when Piga Software was using Game Maker for most of its development (2005 and 2006), several different incarnations of real-time strategy games were experimented with. Hamish Wilson worked on a medieval-themed strategy game dubbed Art of War, while and Graham L. Wilson worked on a game called Defend and Conquer, which featured a fantasy setting. Early drafts for Free Empires were also experimented with on a number of different code bases.

Free Empires[edit]

First screenshot
Free Empires develops
Windows experiments
Mouse Movement Technical Demo

In April 2007, development moved from Game Maker and Microsoft Windows over to Gambas and GNU/Linux. While experimenting with Gambas, the prospect of writing a real-time strategy game stayed within the Piga developers' minds. Graham Wilson began to envision a concept to make a simple game, using quick workarounds where necessary, with a Medieval setting. Around this time a thread at the Linux Questions forum discussed running Age of Empires through Wine, and how great it would be if someone would try and write a GNU/Linux-compatible clone of the game. With that thought, Hamish announced work on the modern Free Empires project instead. Graham Wilson started working on the engine for this project immediately.

It was not until the summer however, that he decided to name it Gambas Genie after the original Ensemble Studios engine called Genie used in the first two Age of Empires games. During this time, he laid out some of the basic object rendering code, gameplay functions and menus. Interest had been generated by the Linux Questions posting, and by a succession of public development screenshots, and several people who had flocked to the newly established modern Piga Software Forum were curious to look at the code already written. Although he had first attempted to add a basic form of scrolling, Graham finally packaged and released the first "Source Release" for the project on June 21, 2007 and was played through by several people on the forum.

Meanwhile, Graham got to work on advancing the engine from there. Mainly the work focused on expanding the game logic; most importantly implementing a fully functioning AoE II-style market where one resource could be traded for another, as well as working on both the environmental and and domestic elements. The release was delayed several times before it was decided to be sent out on the tenth anniversary of the release of the original Age of Empires on October 26, 2007, but upload problems again delayed it until November 9, 2007. Work on a more souped up version called Source Release 2.5 was endeavoured during the dying weeks of that year, largely lead by Hamish, but that version was never finished. Drafts towards a Microsoft Windows version of the engine was worked on by Iain Wilson using Visual Basic 2005 Express, both that year and the next, but these were later paused due to the fast pace of development on Gambas.

At the beginning of 2008, Graham began to consider his options towards where to take the project from there, pausing to consider that he was writing a fairly complex engine on a language he had been using for less then a year. He decided, after having a coder epiphany towards the mouse movement component of the engine that January, that he should split up development into several different projects he would handle inside separate technical demos. He worked on these for the rest of the year, releasing the mouse movement one on June 15, 2008, and prototyping resource gathering, technological research and, towards the end of the year, artificial intelligence and path-finding. That August he also began experimenting with a new Gambas "drawing area" based rendering system, rather then the original "picture box" one, for the project and released two new development shots showing this.

Lamp Refugee[edit]

Lamp Refugee SR 1 develops
Lamp Refugee SR 2 develops
Terrain Model Technical Demo
Isometric Projection Technical Demo

During May of 2009, he discovered an easy and convenient way to handle map scrolling using Gambas "panels", which he later applied as well using drawing areas (the next release of the engine will feature a combination of drawing areas and picture boxes contained in a panel). Inspired by this success, he worked on making a crude incarnation of object creation and afterwards decided to merge all his previous technical demonstrations into one prototype game soon entitled as Lamp Refugee. Similar to an earlier outgrowth, called Electric Warfare, he started back in 2007, he decided he would try and write something clunky by playable and then clean it up later. Following this design, he worked on the game for around six months and implemented unit movement, unit and building construction and training, resource mining of two kinds, technological research, resource swapping, unit and building hit points, usable domestic and military units, aggressive creatures and the beginnings of enemy AI.

Other, less obvious, features included game speed, experimental world scaling, a prototype for a mini-map and central and secondary buildings that would take in resources. The game's storyline and design was created by both Hamish and Graham Wilson, and was made reflecting the "Genie" name, as had been previously done in the mouse movement technical demo. Malcolm Wilson Multimedia created pre-rendered 3D models to be used in the game for buildings, and graphics and sounds were used from the now GPLed Blades of Exile, as well as semi-free music by Bjørn Arild Lynne. Nevertheless, a lot of the functions were only partially implemented and the code, though commented, was somewhat untidy and all in all rather massive. The demo was released on October 26, 2009, two years to the day of when the second Free Empires Source Release had been attempted to be released. Work on expanding from the engine from there continued for the rest of the year, including a now partially updating mini-map and improved resource gathering path-finding.

By the beginning of 2010, Graham Wilson was now finally updated from Fedora 8 to Fedora 12 and thus was now using Gambas 2 as his main development language, as opposed to the original Gambas; which corrected a problem when making RPM and other similar installers. Most of his projects, such as Piga Nation, ported smoothly to the new environment, but Lamp Refugee, as well as Windys, proved to be less willing. Although all the code functioned fine within Gambas 2, something in the way that it handled graphics was throwing off such vital functions as object collisions. Frustrated by this obstacle, the Gambas Genie development again quieted down.

During this time, Graham's original experiment into using Gambas drawing areas, which he started in August 2008, had advanced and all his new engines were now using them for the sake of graphical transparency. Realizing that he was going to have to rewrite the whole graphical layer to reflect this anyway, in August 2010 he started working on the new Source Release of Lamp Refuge on both Gambas 2 and drawing areas; porting and/or rewriting old code as he went and most importantly cleaning up and splitting into several pieces the huge original class file. Personal problems and other efforts stymied development of this demanding project for the next six months until his life had calmed by the beginning of 2011 and on January 8 he managed to get an impressive amount of code ported and cleaned. On January 28, 2011, a new draft of the Gambas Genie project page was launched, moving it from the old Free Empires site to a sub-page of the new Free Empires area of the modern Piga Software website on

Meanwhile, Graham continued his porting effort, as well as bug fixing and expanding and improving implementations, until in late April he began focusing on release. On May 8, 2011, he completed and sent off the the second source release, despite a head cold and grass fire in a nearby tower field, with it becoming widely available on May 9. After several months in development, on and off, a new technical demo was created showcasing a terrain model utilizing tiling and texturing released on October 26, 2011, which also served as early prototyping for an eventual level editor. Research into graphical hardware acceleration, which occurred throughout 2012 in order to get a much needed game speed boost, were stalled due to bottlenecks in the current level of OpenGL support in Gambas for both Qt and GTK (not however, for SDL, allowing for the development of PS Tech, but such a drastic paradigm shift remains undesirable for Gambas Genie). On August 7, 2013, another technical demo was released showcasing Isometric Projection.


In late December 2012, while doing performance testing on a low-end workstation machine while Nomad awaited a replacement power adapter, a new plan was made for the project, as well as other Piga Software engines, in which several new systems of rendering, of varying states of completion and complication, would be added intercompatibly, including: the re-implementation of a fast but simplistic picture box renderer (whose value became apparent while testing Childish Cannoneer), the retention and further optimization of the drawing area derived renderer, and lastly both 2D and even potentially 3D accelerated renderers using OpenGL. After further research, this was modified in January 2014 towards the idea of a single renderer based on the strengths of each system, using drawing/GL areas for terrain and environment and picture boxes for units, allowing for them to be re-drawn separately from the game map for performance reasons.

In addition, the implementation of dynamic object management system ("The Wand", replacing the old individual "Lamp" system), a proper array-based terrain model, multiple map support, better path-finding and artificial intelligence and game logic scripting is also being prototyped. This new properly unified and implemented version of Gambas Genie is to be Graham L. Wilson's next big project after completing the first incarnation of PS Tech, alongside Piga Animator. The current planned release date, beyond the ever-present "when it is done", is May 8, 2013. All contributions and comments from the outside player and development community are appreciated.


  • Version 0.1: was the form exhibited in Free Empires Source Release 1, featuring very basic object rendering, interaction and selection for both domestic and environmental functions.
  • Version 0.2: was the form exhibited in Free Empires Source Release 2, which built upon and extended the basics from Source Release 1.
  • Tech Demos: were the form development of the engine took from there; a mouse movement demo was released, but the others were merged into Lamp Refugee. This idea was later re-visited for a "Terrain Model" and later still "Isometric Projection" technical demo.
  • Version 0.3: was exhibited in Lamp Refugee Source Release 1, featuring scrolling, unit movement, training and health, as well as building construction, mining and basic enemy AI.
  • Version 0.4: is exhibited in Lamp Refugee Source Release 2, featuring improved drawing, fuller domestic abilities, a segmented code base, better environmental interaction and extended enemy AI.
  • Version 0.5: is to be exhibited in Lamp Refugee Source Release 3, aimed to feature a new unified rendering system, multiple maps, an array-based terrain model, improved path-finding and AI, and to be a truly playable game.
  • Version 1.0: is not to be christened until the first full release of Free Empires: Chiefs and Warriors; later Free Empires instalments will follow using a common engine, as well as other potential strategy game projects.


  • Free Empires: is a project to create a series of Age of Empires-like historical strategy games for GNU/Linux.
  • Lamp Refugee: is a technical demo to experiment with the engine and taking the form of a fantasy strategy game.

External Links[edit]