Gambas Arcade Engine

The Gambas Arcade Engine is a two dimensional game engine written by Graham L. Wilson for the use of small arcade-type games.

Details
The Gambas Arcade Engine was the first released Piga Software engine to use Gambas "drawing areas", outside of the internal rendering system used in Piga's Pumpkin Carving. Later versions of Gambas Genie and Gambas Platform Engine have been released or already exist which use drawing areas for more dynamic graphics, rather than using the regular toolkit features, though picture boxes are now being merged back into the Piga engines for translatable game objects (and so save on rendering calls). Arcade Engine uses a drawing area to draw transparent graphics onto a form. Objects are defined first as picture datatypes, then as coordinate variables as either strings or integers (ObjectX, ObjectY) as well as, if necessary, additional properties as same (ObjectStatus, ObjectHealth, etc). The engine uses this setup to make the whole object exist and function. Timers are used to control the movement of non-player characters or enemy objects which are typically controlled through pre-set movement patterns. Sprite animations are also processed through a timer.

The rendering is handled by one internal sub called Render, which redraws the essential graphics at their proper positions. It is called after every important positional or graphical change. Sounds and music are done through the Simple DirectMedia Layer and sounds are first defined, loaded and then called; music is a single channel which is called and set each use. Generally each game features three pieces of music to give one for the main menu, in-game and high score table scenes. It was intended that Arcade Engine would use the GUI switcher component which would allow it to detect whether or not Qt or GTK+ would be best based on a given system's defaults. Unfortunately Qt is currently not accepting the keyboard commands properly and so the games are now set to GTK by default. A timer is used to calculate collisions or other important conditions about every millisecond, though some properties are checked after every render call instead. Collisions are handled on a 48x48 pixel grid, though adding a form of smooth collisions with bounding volumes rather than purely grid dependant ones is being considered for certain games.

A form of wraparound is implemented in Piga's Thanksgiving Dinner Hunt and Piga's Santa Drop Down that moves an object once it reaches one side of the screen to regenerate on the other side of the screen; Piga's New Years Dodge 'Em uses random placement to perform a similar function. Mouse clicks are used as the input mechanism in Dinner Hunt but keyboard functions, implemented like those in Windys, are used in Drop Down, Dodge 'Em and Over the Top. Gravity is implemented as a periodic timer moving certain objects down the Y axis in both Drop Down and Dodge 'Em. Temporal based victory conditions are used in both Dinner Hunt and Dodge 'Em, with the player trying to get the highest score in a certain amount of time. In Drop Down, the goal is to get the most points out of five sets of projectiles, which is similar to the lives system in Dodge 'Em. Dodge 'Em features some internal cut-scene code, where a timer controls the player object and locks the player out, allowing for the exposition of the game's setting. This appears both in the background of the main menu, and in the optional cut-scene directly preceding gameplay. Scores and other variables are displayed either on a side bar display like in Dinner Hunt, on the top bar like in Drop Down and Dodge 'Em or in a bar or box like in Dodge 'Em.

The primary feature in Arcade Engine is the high score table, and it is the main code that is shared almost exactly between all Arcade Engine games. It saves the score, and other essential conditions, to a text file called "GameName-HS.txt" that sits in a sub-directory in the player's home at "~/.piga". If it does not find that either the file or directory presently exists, it creates the them. Every game has a similar type of high score table which lists the score and allows the player to clear the table and start afresh. Due to the lack of a proper score function in Over the Top, it is instead labelled as "personnel files" and lists certain player statistics. The main menu in every Arcade Engine game released is a sub-menu of the larger game world, which is enabled at the beginning of the game. Typically it allows the player to start the game, view the high scores, read more on the license and credits (by clicking on the copyright disclaimer) or exit the program. Dodge 'Em, Over the Top, as well as version 1.2 of Drop Down, also feature a help display that explains how to play the game with instructions and icons. All "readme" files included with Arcade Engine games are based on the same template set out by version 2.0 of Piga's Pumpkin Carving. Over the Top is the only game to use the engine that has a level system utilizing module files, which restarts and modifies the game world to represent different years and pushes.

Sounds and music are used as Ogg Vorbis files, and graphics are used as PNG files. Often these are derived from MIDI or SVG files, but they are converted to either work in the default renderer, in the case of SVGs, or for play consistency, in the case of MIDIs. WAV files are converted to Vorbis in projects for the sake of file size, same as why FLACs are not used in project, and MP3s are converted due to patent and licensing concerns. The original MIDI and SVG files are always included in the relevant source code file in a directory called "Raw Files". There are some plans to start playing around with the Gambas components for rendering SVGs in order to actually use them in-game in later releases, plus hopefully having better support for semi-transparent pixels and spending less time converting between graphics formats. In at least some of its incarnations, it has been tested on Fedora 12-20, openSuSE 11.2, Ubuntu 10.10 "Maverick Meerkat" and Mint 9 "Isadora".

List of Games

 * Nightfall (GNU/Linux, 2022)
 * Bring Them On (GNU/Linux, 2021)
 * Piga's Thanksgiving Dinner Hunt (GNU/Linux, 2010-2011)
 * Piga's Santa Drop Down (GNU/Linux, 2010-2011)
 * Piga's New Years Dodge 'Em (GNU/Linux, 2011)
 * Over the Top (GNU/Linux, 2011)