Gambas Projection Engine



Gambas Projection Engine is a 2.5D game engine project by Graham Lawrence Wilson that provides grid-based simulated three dimensional spaces ala dungeon crawler games like Wizardry or Dungeon Master, as well as more experimental pseudo-3D effects such as graphical scaling. It is called the "projection" engine because the positions of all pre-defined game objects remain static, while the world is rendered out in front of the player (usually to a vanishing point or aerial perspective) from the first person.

History
The game that truly convinced Hamish and Graham L. Wilson to try and learn game programming was Doom by id Software (as well as Bad Toys 3D and Duke Nukem 3D), and as such the desire to emulate it has long been a signature of their programming careers. The following outlines how this was manifested as their skills developed.

Point & Click


Graham Lawrence Wilson's first serious programming project was a graphical adventure game written in Visual Basic 6 called Mad Bully in the Haunted Mansion. Set in an inverted animal afterlife, where hell was pleasant despite featuring traditional hellish aesthetics, while heaven was punishment, herd patriarch Mad Bully goes to a haunted mansion to clear out ghosts and ghouls. Starting from a screenshot of the Mystery Screensaver for Windows 98, interiors were drawn as minimal static 3D rooms from a first person perspective. Either as a boxed in corridor end, or as a side view of a long wall, these objects were then populated with objects the player had to deal with by selecting one or more options; usually variations of attack, sneak or retreat. The player had to choose the right one to progress, similar to a choose-your-own-adventure.



Although never finishing Mad Bully, Piga began working on a few other projects of a similar mould. Hamish Paul Wilson and Graham each did their own high fantasy-themed adventures. Hamish's The Pig featured a fantasy race of bipedal pigs ala Piga, and featured a dragon, goblin and troll within the dungeon. Graham's The Wizard featured the player taking on the role of the Wizard Grandy as he infiltrated a Warlock's castle. It was to expand on their established formula by having different weapons, potions and magic the player could use, as well as limited non-linear gameplay, although the game logic for this was never really implemented.



Graham also started a game called WEIRD: A Short Game which was again first-person, but drawn with geometric primitives and in a sideways slanted world. A more distinct project was CATCOM (aka Cat Computer), a game where the player controlled a cat through a house. Activities involved eating, sleeping, drinking and interacting with other cats, all at their eye level. A rare finished project was simply titled 3D Example, and featured a guided tour through a series of rooms given by Piga in which the player goes through a porthole, climbs a ladder, uses a flashlight, works at a writer's desk, throws a grenade at a target and finds a code needed to win. Fan games were also drafted for Doctor Who and Garfield.



The most ambitious and primary effort of the group's early Visual Basic years was the the Shoot or Doom trilogy. Named after the underlying try or die philosophy (and homage to Doom), the game featured Robert Dwarf (a man of ironically tall stature) being abducted by the Alien Empire and forced into The Maze, a simulated reality labyrinth to test the worthiness of first contacted species. The first episode would feature his struggles in The Maze, an abstracted world filled with odd geometric opponents (often from clipart) including a smiley face and lighting bolt. The second would feature his escape from the maze and into the bowels of the ship, fighting off alien guards, and conclude with a final episode where he takes out the mother-ship and escapes back to Earth. Drafts were created for episodes one and two, with the first most advanced. Late in development, timers were being put in to force the player to react to opponents within a set amount of time, the first step towards more advanced game logic.

When Piga Software switched to Gambas in 2007, which is similar to Visual Basic, they briefly returned to this concept, with Hamish prototyping a title called AGM Labs, set in the Freedoom universe.

2-Step


2-Step was a limited first person projection engine first envisioned by Graham Lawrence Wilson in the summer of 2005. At that time Piga Software, had yet to acquire the full version of Game Maker 6.1 and he was frustrated by the fact that the basic 3D abilities of Game Maker were not allowed to be used in the shareware version. As a sideline around this, he decided to try and create a program, however limited, to emulate it. The result was a Game Maker engine that draws a cramp room in which the player can step forward, step backward, jump, crouch, and interact with any object within in the cramped, short corridor.



This was done by drawing four backgrounds in a first person perspective that simulated the player's two steps forward and backward, as well as jumping and crouching, and then switching the background when the player pressed the relevant key. He had trouble doing this with the background settings of a Game Maker room, but then after a coder epiphany he figured that he would just create an object to the draw the world. After this he made a short open ended demonstration game called Revenge which featured use of this engine, depicting an enraged space bounty hunter (ala Bobba Fett) charging his way through the corridors of an alien ship to avenge the death of his father. The artificial intelligence had aliens with both one shot and rapid fire weapons, and it was vital once each room opened to do unto them before they killed the player. There were also light switches, various collectibles, and other items.

Several versions of this engine were played around with, including ones for Game Maker 5 (pictured here), QBasic 4.5 (done in ASCII art), and lastly in Gambas. It carried on from the very basic static 3D renderings Piga had done in Visual Basic by allowing for the world to be redrawn as needed and objects that could be manipulated. A related effort was a game drafted in Game Maker 5 called "GM5 Doom", which was a simple rail shooter with graphics from Doom based on a pesudo-3D example using graphical scaling. This effort proved influential in the project that was to follow.

Scaling Engine


Graham Wilson started development on the successor to 2 Step in June 2009, called the Gambas Scaling Engine. The goal was similar to the prior concept to make an engine with limited first-person capabilities that was both simple to use and to make and did not require much power to run. However, in this case it was not done due to the limits of a development tool. The basic idea of the scaling engine utilizes many basic Gambas functions to create the illusion of three dimensions. Scrolling, like the kind utilized in Lamp Refugee was added for the purpose of creating a room with an expansive X and Y axis like those used in two dimensional games. The third dimension of depth, otherwise known as the Z axis, is simulated using a graphical trick.



When moving forwards and backwards in reality a person would notice objects getting smaller or larger depending on their point of view and direction. This was simulated by the program rendering objects that are either scaled larger or smaller depending on the same principles. The player's comparative position and views on these objects then form the basis for calculating the Z axis and the depth of the virtual world. This same technique was a staple of racing games from the 1980s and 1990s starting with the likes of Pole Position. It was also used in some role-playing games such as Drakkhen. The initial scaling technical demo was developed outside of the drawing area function of Gambas 1.x and thus did not feature transparency and had all objects with bordered picture boxes.

In January 2010, Graham finally got around to trying to port the game to a drawing area. Texturing and basic rendering worked fine, as did basic object rendering. However scaling refused to render on this engine and the problem was traced, after some research, to the fact that he rendered the objects as pictures which have read-only width and height properties. After tracking down example code on rendering images and putting in his old calculations and some new ones he created the scaling world. The computer's memory was stopped from being overtaxed by only making what is re-sized stored in the memory, while the static backgrounds and overlays are still pictures. This included the player's weapon, or the optional third-person character view. A similar approach, though with slight variations, had been previously used in the version of Duke Nukem 3D created for the early hand held Game.com console.



Based on this demo, he began worked on an "enhanced" rail shooter, although features like being able to flip between forward, backward, skyward and ground views added in further options more similar to a first person shooter or adventure game. The demo ended up being quite advanced and feature heavy, featuring shooting (melee, ranged, rapid-fire and akimbo modes), object interaction, a talk system, simple artificial intelligence, object interaction/destructibility, bullet holes and basic particle effects, and environments such as underwater, foggy, windy and clear outdoors areas and rooms featuring basic elevations in height (with the ability to jump and crouch). A mode was also experimented with where smaller items could be picked up, moved and interacted with using the mouse (inspired by the Penumbra series). It also featured an inventory, grid-based mini-map, prototype split screen deathmatch mode, a drop-down console, and frames per second meter. Development continued until 2013, when work on PS Tech proper began in earnest. The engine was also abandoned due to dissatisfaction with cruft in the code and renderer, as well as the distortion inherent in the environmental scaling.

Projection Engine
Work on the modern incarnation of the engine began in June 2015, abandoning a focus on graphical scaling as the primary renderer, due to the distortion present in Scaling, and instead taking inspiration from grid-based first-person dungeon crawler games. Most notably for Wilson was the QBasic game The Legend of Lith II, which has served as a model alongside the uncompleted free software game GWiz. Rather than just following the classic grid based formula however, which usually featured turn-based combat, the Projection Engine is to use graphical scaling and other tricks to allow for limited real-time game-play. As of late 2017, the engine features dynamic texturing, views from all cardinal directions, a simulated turning and looking up and down effect, and a draw distance of up to five grid points ahead of the player.