Quake engine

Quake engine
Developer(s) id Software, (John Carmack, Michael Abrash, John Cash)
Initial release June 22, 1996 (1996-06-22)
Stable release 1.09 / December 21, 1999 (1999-12-21)
Development status Discontinued
Written in C, Assembly language
Operating system DOS, AmigaOS, Microsoft Windows, MacOS, Linux
Platform PC, Amiga, PowerPC Macintosh, Nintendo 64
Type Game engine
License GNU General Public License

The Quake engine is the game engine developed by id Software to power their 1996 video game Quake. It featured true 3D real-time rendering and is now licensed under the terms of the GNU General Public License (GPL).

After release, it immediately forked, as did the level design. Much of the engine remained in Quake II and Quake III Arena. The Quake engine, like the Doom engine, used binary space partitioning (BSP) to optimise the world rendering. The Quake engine also used Gouraud shading for moving objects, and a static lightmap for nonmoving objects.

Historically, the Quake engine has been treated as a separate engine from its successor id Tech 2. The codebases for Quake and Quake II (id Tech 2) were separate GPL releases.[1][2]

History

The Quake engine was developed from 1995 for the video game Quake, released on June 22, 1996. John Carmack did most of the programming of the engine, with help from Michael Abrash in algorithms and assembly optimization. The Quake II engine (id Tech 2) was based on it.

Engine design and milestones

Reducing 3D complexity to increase speed

Simplified process of reducing map complexity in Quake.

Quake was the first true-3D game to use a special map design system that preprocessed and pre-rendered the 3D environment, so as to reduce the processing required when playing the game on the 50–75 MHz CPUs of the time. The 3D environment in which the game takes place is referred to as a map, even though it is three-dimensional in nature rather than a flat 2D space. The map editor program uses a number of simple convex 3D geometric objects known as brushes that are sized and rotated to build the environment. The brushes are placed and oriented to create an enclosed, empty, volumetric space, and when the design is complete the map is run through the rendering preprocessor. The preprocessor is used to locate two types of empty space in the map, the empty space enclosed by brushes where the game will be played, and the other empty space outside the brushes that the player will never see. The preprocessor then strips away the back-faces of the individual brushes which are outside the game-space, leaving only the few polygons that define the outer perimeter of the enclosed game space.

Generally once a map has been preprocessed it cannot be re-edited in a normal fashion because the original brushes have been cut into small pieces. Instead the original map editor data with the brushes is retained and used to create new versions of the map. But it is possible to edit a processed map by opening it in a special vertex editor and editing the raw vertex data, or to add or remove individual triangle faces. Though difficult, this technique was occasionally used by cheaters to create windows in walls, to see normally hidden enemies approaching from behind doors and walls, and resulted in an anti-cheat mechanism used in recent 3D games that calculates a checksum for each file used in the game, to detect players using potentially hacked map files.

A processed map file can have a much lower polygon count than the original unprocessed map, often by 50 to 80 percent. On the 50–75 MHz PCs of the time, it was common for this pruning step to take many hours to complete on a map, often running overnight if the map design was extremely complex.

This preprocessing step cannot work if there are any small holes or "leaks" that interconnect the interior game space with the exterior empty space, and it was common for complex map-building projects to be abandoned because the map designer could not locate the leaks in their map. To prevent leaks, the brushes should overlap and slightly interpenetrate each other; attempting to perfectly align along the edges of unusually shaped brushes on a grid can result in very small gaps that are difficult to locate.

The open sky in Quake maps is in fact not open, but is covered over and enclosed with large brushes, and textured with a special skybox texture, which is programmed to use sphere mapping, and thus always looks the same from any viewing position, giving the illusion of a distant sky.

Precalculating lighting and shadows

Quake also incorporated the use of lightmaps and 3D light sources, as opposed to the sector-based static lighting used in games of the past. id Software's innovation has been used for many 3D games released since, particularly first-person shooters, though id Software switched to a Unified lighting and shadowing model for Doom 3 (however, they switched back to a lightmapped or semi-lightmapped method starting with RAGE). After a map had been pruned of excess polygons, a second preprocessing system was used to precalculate and bake the lightmaps into the game map to further reduce load on the CPU when playing the game. However, full light processing could take an extremely long time, so for the initial map design process, lesser-quality light processing could be done, but at the cost of creating a jagged stair-step lightcast around lights.

Sectioning the map to increase speed

To further decrease 3D rendering, a mechanism was developed to section off large regions of the map that are currently not visible to the player, and to not render those unseen spaces. A 3D rendering engine without any such optimizations would draw every part of the world and then attempt to determine which polygons are the closest, then hide all of the other polygons behind the closest polygons (a technique known as Z-buffering); just because a polygon is not visible does not mean it is not part of the scene calculations. With this optimization used in the Quake engine, if the player could not see into a nearby region, the engine could be told ahead of time to not include any of the objects in that space in the rendering calculations, greatly reducing the rendering load on the CPU. This effect can be noticed in the game as small tunnels with sharp 90-degree bends leading from one large space into the next large space. The small tunnel is used to block view into the adjoining unrendered space, and a special type of transparent brush (called a visportal) is used to define the edge of where the engine should stop rendering the adjoining space. It is uncommon in the original Quake to be able to see across the entire length of a map, and outdoor spaces are often very tall and narrow, primarily utilizing distance above and below into open sky or lava, to create a low-polygonal illusion of expanse.

How sectioning is performed

A Binary Space Partitioning (BSP) tree is built from the map, simplifying searching for a polygon to O (number of polygons). Each leaf creates some area of 3D space (imagine cutting a pie into arbitrary pieces). The leaves of this Binary Tree have polygons of the original map associated with them, which are then used for computing each area's visibility. For each area, the VSD algorithm finds the parts of the map for which a line of sight exists. This is called the potentially visible set (PVS).[3]

This process uses large amounts of memory, since it should take O(n^2) (where n is the number of polygons) bits (only visible/hidden information is needed). John Carmack realized that one area sees just a small fraction of the other areas, so he compressed this information by using run-length encoding (RLE). This is what allowed Quake's sophisticated graphics to run so quickly on the hardware of the time.

Speeding up the rendering, and rendering order

To reduce overdraw (rendering a new pixel that hides a previously rendered point, meaning the previous work was useless and wasted), the environment was displayed first, from front to back. To hide parts of walls hidden by other walls, a Global Edge List was sorting edges of already rendered polygons; new polygons were first clipped against previous edges so that only visible parts would get to the framebuffer.

Also while rendering the environment, a ZBuffer was filled but never read while rendering the environment, as the BSP tree and Global Edge List ensured that each pixel was rendered only once. The ZBuffer was later used to render correctly characters and other moving objects that were partially hidden by the environment.

The pixel rendering loop was implemented in assembly. The texture coordinates perspective correction and interpolation was done using the floating-point unit, due to the limited number of integer registers; it also allows to compute expensive division operation (part of perspective correction) on the floating-point unit in parallel with integer interpolation (in other words, at no cost).

The base texture and the lightmap of a wall were rendered at the same time: a Surface Cache was creating new Surfaces, which are new pre-lighted textures which combines the base and lightmap textures. Surfaces not used since a few frames were released, while new required Surfaces were dynamically created. Generating the surfaces was consuming less time than a secondary lighting pass would have. To save memory, smaller surfaces using mipmaps of the original texture were generated first for further walls.

The characters were lit using a constant ambient light, which value came from a structure storing ambient colors in 3D, depending on the character's position. Characters and objects very far from the camera were not rendered in 3D: they were instead rendered as voxels: 3D big square points of a single color (which came from the object texture).

Hardware 3D acceleration

Quake was one of the first games to support 3D hardware acceleration. While initially released with only software rendering, John Carmack created a version of the Quake executable that took advantage of Rendition's Vérité 1000 graphics chip (VQuake). OpenGL support was added in the form of the GLQuake executable for Windows 95 and higher. Many believe that this kick-started the independent 3D graphics card revolution, GLQuake being the first application to truly demonstrate the capabilities of the 3dfx "Voodoo" chipset at the time. The only other cards capable of rendering GLQuake were a professional (and very expensive) Intergraph 3D OpenGL card and later, the PowerVR cards.

To optimize the software rendering engine, lightmaps were shared by polygons that were close in space, and in the same leaf of the BSP tree. This means that quite often polygons using the same main texture could not be rendered at the same time with the 3D acceleration, due to the multi-texturing second unit having to be reconfigured with another lightmap. This architecture decision reduced hardware-accelerated rendering performance.

Player movement

Quake, by default, used the keyboard to turn left and right and move forward and backward, using the mouse, like Doom, to do the same movements. This produced awkward movements, and required settings like "auto-level" that would move the viewpoint back to straight forward as the player moved and "auto vertical aim" that would automatically shoot things above and below the player. Probably because of this, the level design in Quake was more suited to the 2.5D environment of Doom. Only in a few spots in the game was the attacking monster far above or below the player. Quake did have the option of using the mouse to look/aim/orient ("mouselook") and the keyboard to move forward, backward, and sideways, but it was not the default until Quake III Arena was released.

Network play

Quake includes cooperative and deathmatch multiplayer modes over LAN or the Internet. Additional multiplayer modes were later added using mods.

Quake uses the client–server model, where a server has control of all game events. All players connect to this server in order to participate, with the server telling the clients what is happening in the game. The server may either be a dedicated server or a Listen Server. Even in the latter situation, Quake still uses the client–server model, as opposed to the peer-to-peer networking used by some other games. Quake thus cannot suffer from de-synchronized network games that could occur from different clients disagreeing with each other, since the server is always the final authority.

Derivative engines

Family Tree of Quake engines

On December 21, 1999, John Carmack of id Software released the Quake engine source code on the Internet under the terms of the GPL, allowing programmers to edit the engine and add new features. Programmers were soon releasing new versions of the engine on the net. Some of the most known engines are:

Games using the Quake engine

Quake engine tools

See also

References

  1. "Quake engine GPL release". Retrieved 11 November 2015.
  2. "id Tech 2 GPL release". Retrieved 11 November 2015.
  3. Abrash, Michael. "Quake's 3-D Engine: The Big Picture". Retrieved 22 August 2012.

External links

This article is issued from Wikipedia - version of the Tuesday, February 09, 2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.