PS Tech

From PigaLore
Jump to navigation Jump to search

PS Tech, also known as the Gambas 3D Engine, is a three dimensional engine project by Piga Software. It is named in homage of the id Software rendering engines ("id tech" engines), a scheme earlier mimicked by other such as Lithtech. It is a 3D rendering and game engine for Gambas written in OpenGL 2.1.


Revision One development

PS Tech is a "3D tile engine", and as such is designed to work via a gird system inside a multidimensional data array. The grid has a scale of 1x1 representing a single point (so that an object drawn with value of 1x1 will fill the entire point, with smaller object dimensions specified as decimals), and can be made up of primitives, sprites or potentially MD2 models. Most architectural pieces are made up as texture mapped primitives or combinations of such. These pieces can then be scaled, translated or rotated. 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.

The engine will by default load a 25x25 section to display (this may be customized based on need); to render at high frame rates regardless of whether or not a system of culling is in place. The rest of the map is stored in memory and fed into the rendering system as the player reaches the edge of the current region. This is similar to how the adaptive tiling works in the Gambas Tile System. A system to call in smaller versions of textures and sprites as a performance fall-back feature is also 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 using GLSL may come later, depending on language support.

Revision Two[edit]

A new implementation was started in December 2019. Although still a true 3D renderer, the actual level geometry is stored in a 2.5D fashion as a flat grid with an added height map (objects may still be translated up the y axis however). This is to reduce load (it takes less power to render a taller cube than a stack of cubes) and in order to make mapping as simple as possible (2.5D games have more vibrant mapping communities, on average). This optimization is also done for all walls, with the editor designed to make them single sets of elongated cuboids where possible. This also allows it to follow the Gambas Map Format framework, which is based on a 2D grid. The loader is similar to the Gambas Tile System in that it only renders parts of the map at any one time in order to improve performance.

The most major difference however is that it is now using Qt for rendering interfaces, rather than using SDL for window management, in order to better utilize the Gambas form designer and to make the engine more similar to all the other Piga Software engines. This also allows the minimization of OpenGL specific drawing code to aide in eventual refactoring should a more modern 3D API (later OpenGL versions or Vulkan) be supported, or software rendering be added (using SDL drawing commands is not compatible with OpenGL in Gambas).

Revision One[edit]

The original implementation built with SDL for windowing was actively worked on from December 2012 until November 2014 before being left largely dormant. Unlike the current 2.5D design for the maps, it was developed to store geometry in a fully 3D array. Each point in the array contains two values represented 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. 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, specified 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 were also to be able to 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 was to be used to confer other information, such as objects to be placed atop of table.


"Glut" alpha

An early alpha build for a game draft called Glut is available to download from the Piga Software file directory at, and represents the end of development of the first iteration as of November 2014. It features a functioning 3D world as a 3D tile engine (ala Wolfenstein 3D) with basic movement, drawing and interactivity. Environmental clipping however is a major issue left not properly addressed. Support for lighting is also rudimentary, and can be turned on by pressing F4. Fog is accessible by pressing F3. The engine can be made full screen by pressing F1. Movement is done via the arrow keys, and basic mouse look (upon mouse click and drag) is active. All geometry is done in pure OpenGL immediate mode, although MD2 model support is included in the source code.


See Also: Gambas Projection Engine#History

Game Maker[edit]

Office Drone, a prototype

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 implementation were discovered and a more easily usable demo (mirror) 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 locales, office blocks and such. One game featured limited squad AI while another featured limited bots.

Other engines[edit]

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.

Gambas Development[edit]

MetaMetal draft

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, which culminated in the 2014 alpha.

A new draft with fixed collisions and with interfaces written in Qt 5 rather than SDL (to take advantage of the Gambas form designer) is in the works as of the end of 2019. It is to use a 2.5D height map, somewhat similar to the original Rise of the Triad, in order to reduce geometrical complexity and overhead while promoting ease of mapping; as well as using sprites for dynamic elements.

See Also[edit]