PS Tech

PS Tech, also known as the Gambas 3D Engine, is a three dimensional engine that Piga Software is working to develop with Gambas. It is named in homage of the id Software rendering engines ("id tech" engines), a scheme earlier mimicked by other such as Lithtech.

Implementation
PS Tech functions as a "3D tile engine", and as such is designed to work via a gird system inside a three dimensional data array. Each point in the array contains two values reprsented as 000|000. The first three characters slots are used to define object type (block wall, door, collectible item, etc), while the last three characters are meant to assign a texture value. The grid has a scale of 1x1x1 representing a single point (so that an object drawn with value of 1x1x1 will fill the entire point, with smaller object dimensions specified as decimals), and can be made up of primitives, MD2 models or sprites. Most architectural pieces are made up as texturable primitives or combinations of such, although MD2 models could also be used to make specialized wall templates. Multiple entries for a single object are needed to represent it from differing angles (typically 0°, 90°, 45° or 135°).

A height system is present wherein the player can ascend up objects from 0.1 to 0.9 without entering a higher grid point on the Y axis. Between Y grid points in the map data there are values available for deciding the existence and texture for world's skydome, or whether to give the X by Z gird area a textured floor or ceiling. Individual floor and roof tiles can also be added, specifed in the map format in a range from 0x0|000 to 9x9|000 ("x" replaced with "f" for floor, "r" for roof and "b" for both). Regions can also be encased in a fluid tile of either low ("l"; only submerged when crouching), medium ("m"; can be escaped by jumping) or high height ("h"; must get out before drowning). For objects that have a static texture, the texturing portion of an entry can be used to confer other information, such as objects to placed atop of table.

A basic map is a 25x25 grid, which renders with high frame rates regardless of whether or not a system of culling is in use and can easily be edited in the world editor. Larger maps can be done through a system of distance culling keeping load in check, either by continually rendering only objects within a certain grid point radius around the player, or a system that draws objects for a certain distance in front of the player's current perspective. A system to call in smaller versions of textures as a performance fall-back is being considered. Lighting is yet to be properly implemented, but is to be based on a selection of specific light emitting sources, such as fireplaces, torches or candelabra mixed with the use of the fog feature to try and recreate the "diminished lighting" seen so often in mid-1990s games.

The objective of the engine is ease of use and performance (given the innate overhead of Gambas as a high-level language, as well as limited experience and manpower), and has no ambitions of photorealism or implementation of advanced features. All rendering is currently done in the antiquated immediate mode or with display lists, so an eventual conversion to using modern and sleeker vertex buffer objects and shaders is planned as Graham L. Wilson learns more about OpenGL and GLSL. It should be noted however that Gambas utilizes OpenGL through the original SDL, and so it does not yet support vertex buffers and arrays yet itself.

Conceptualization
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.

First-person adventures
Graham L. Wilson's first major project was an adventure game called Mad Bully in the Haunted Mansion, being written in Visual Basic 6.1 with the assistance of his eldest brother. The game was set in a mythic afterlife for animals, which was their heaven, but in strange parallel appeared like hell. Mad Bully, an important bull, was forced to deal with various ghouls in a haunted mansion inspired by a Windows 9.x screensaver. Although viewed from the first-person, the world was rendered as a series of stills, and the only real interactivity was a selection of options, with only one of them allowing the player to continue alive.

He and Hamish then also began work on a science fiction-themed game in a similar vein tilted Shoot or Doom, in homage to the "do the right thing, or die" philosophy and also to homage the first-person shooter that remained their primary inspiration. This was their main project during the pre-Game Maker era (pre-2005), and prototypes for three episodes were completed - one set in a simulated reality (populated by clipart opponents such as taunting smiley faces, in a vaguely surrealist tone), and the other two on the corridors of the alien ship housing it, facing alien guards and robots. Towards the end of its development, time-based puzzles using Visual Basic timers were being considered.

The two also separately worked on two fantasy-oriented titles, Hamish's The Pig (featuring Piga) and Graham's The Wizard. Other examples include WEIRD: A Short Game, which was drawn with geometric primitives and had the world rendered sideways, and CATCOM ("CAT COMputer"), which was made from the perspective of house cat, and some fan games for various franchises. The only finished example of this type was a demonstrative game simply titled 3D Example, featuring a variety of rooms (including one with a usable writing desk), a few different objects (such as a pencil, flashlight, pistol and grenade), and a code the player needed to find to win. 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 is a faked-3D first person projection engine first envisioned by Graham L. Wilson in the summer of 2005. At this time Piga Software had yet to acquire the full version of Game Maker 6.1 and he was frustrated by the fact that promised 3D abilities of Game Maker were not allowed to be used in the demo version. Based on this, he decided to try and create a program, however limited, to fake the effect. 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 corridor.

This was done by drawing four backgrounds in a first person perspective that simulated the player's two steps and 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 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 paced 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, QBasic 4.5, and Gambas.

Game Maker
The closest thing Piga previously ever done towards making an actual first-person shooter, was using the Direct3D integration of the Game Maker game creation tool. This for them made the usage of 2-Step obsolete beyond its novelty value. Work on this began in September 2005 when they finally acquired the full version of Game Maker 6.1. The first thing they tried was based on a 2.5D example downloaded from the Internet. The experiments took the form of a game called Castle Coyotestein, a Wolfenstein 3D spoof using the graphics from the famous early 1990s game. In the end, limitations to this code base were discovered and a more easily usable demo was found created by Mark Overmars.

A variety of game concepts were played around with. Some versions contained usable computers, key puzzles, a variety of weapons and other objects. Environments that were created were varied as well, from military bases, Gothic mansions, city locals, office blocks and such. One game featured limited squad AI while another featured limited bots.

Other engines
Various other engines have been experimented with at different times. Malcolm Wilson Multimedia has experimented successfully with modifying ioquake3 models. Both Hamish and Graham L. Wilson have played with the Doom engine, (in both Doom Builder and Yadex, as well as its modern fork Eureka). Although having a personal liking for the id Tech family of engines, they admit that its lack of modern scripting languages such as Python or Lua is a disadvantage (not having an inclination towards learning QuakeC or similar). This makes an engine like OGRE or Irrlicht more attractive; a long-term conception for PS Tech is the eventual inclusion of a lower-level C++-written renderer, with Gambas used as a high-level scripting system. The most interesting alternative engine at the moment is Godot engine, in that it will provide Unity-type simplicity while still being properly free software, although they still feel it will probally take awhile to develop to that point.

Gambas Development
PS Tech proper was first conceived after learning of the OpenGL component added in for Gambas 2 in the summer of 2007. Attempts by Graham L. Wilson to study from provided examples were eventually jump-started in late 2010, when Tomasz "tommyline" Kolodziejczyk ported over more complete examples by NeHe Productions, which have since been mainlined into Gambas. Kolodziejczyk continued to push the support for OpenGL in Gambas until switching to C++ in May 2013 in order to take advantage of later versions of the OpenGL specification, and receive performance boosts. By this time, he had shared much of his code and imparted much of his knowledge to Wilson, who has taken up the banner of finishing a Gambas-made grid-based 3D engine. Wilson had waited to see how far Kolodziejczyk would take things, but eventually started learning the system himself first starting in August 2011, but more properly in December 2012.