PS Tech

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.

Implementation


See also: Gambas Tile System

PS Tech is a 3D tile engine and works in a similar fashion as the 2D Gambas Tile System. It functions via a gird system inside a multidimensional data array. Unlike the modifiable pixel tile size of the 2D system, the 3D grid has a fixed comparative scale of 1x1 representing a single point (so that an object drawn with value of 1x1x1 will fill the entire point, with smaller dimensions specified in floating point). A height system is present wherein the player can ascend from 0.1 to 0.9 without entering a higher value on the Y axis; normal standing height is .5 units of a given point.

These grid points are populated with primitives, sprites or potentially MD2 models. Most architectural pieces are made up of texture mapped primitives or combinations of such. These pieces can then be scaled, translated or rotated. As with the 2D tile system, there are three basic types of objects used in the map specification. Tiles are accessible for each grid point with a roof and floor that can be adjusted by height position and texture for each. Attributes coexist with the grid points but are somewhat mutable in position and size. Agents are independent dynamic objects rendered at their own position free of the grid system.

Similar to the adaptive tile refresh used in the 2D tile system, a system of distance culling applies a similar principle here. Only a portion of the map is loaded at any given time depending on the player's position, which can be customized based on the user's hardware (by default in Hedged, this is ten points around the player in every direction). Other performance optimizations such as hidden surface determination and using smaller textures and level of detail at a distance have been prototyped, but have not produced much boosts in render speed.

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. The fog feature is utilized to mimic the "diminished lighting" seen so often in mid-1990s games, and also helps obscure the distance culling.

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. It most aspires parity to certain retro engines of the 1990s.

All rendering is currently done in the antiquated immediate mode or with display lists within the fixed-function pipeline, so an eventual conversion to using modern and sleeker vertex buffer objects and shaders using GLSL may come later, depending on language support (potentially by using an external library as outlined here).

Revision Two


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 system (objects may still be translated up the y axis however, allowing for room-over-room). This is to reduce load (it takes less power to render a taller cuboid 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 will also be available for walls, with the editor designed to make them single sets of elongated cuboids where possible. This 2.5D format allows it to follow the Gambas Map Format framework, which is based on a 2D grid and shares ideas with the Gambas Tile System.

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). A beta version was included in the game Hedged created for the April 2021 LibreJam. It does not feature the final map system nor rendering framework, but is fully playable and uses the Qt 5 component. Proper mouselook is also implemented.

Revision One
The original implementation built using the Simple DirectMedia Layer 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.

Alpha


An early alpha build for a game draft called Glut is available to download from the Piga Software file directory at icculus.org, and represents the end of development of the first iteration as of November 2014. It features a functioning 3D world 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 mouselook (upon mouse click and drag) is active. All geometry is done in pure OpenGL immediate mode using geometric primitives, although MD2 model support is included in the source code.

History
See Also: Gambas Projection Engine

Game Maker
The closest thing Piga had 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 developers worked towards similar ends with the technology, while Piga bowed out shortly after switching to Linux and Gambas in 2007.

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.

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, 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. A beta version of this revision was included in the game Hedged released on April 7, 2021 for LibreJam contest, further updated in version 1.2.0 released on May 31, 2021.