Quake engine
From Wikipedia, the free encyclopedia
The Quake engine is the game engine that was written to power 1996's Quake, written by id Software. It featured true 3D realtime rendering and is now licensed under the 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). The Quake engine also used Gouraud shading for moving objects, and a static lightmap for nonmoving objects.
Contents |
[edit] History
The Quake engine was created in 1996 for Quake. John Carmack did most of the programming of the engine, with help from Michael Abrash in algorithms and assembly optimization. It was later upgraded to id Tech 2 and id Tech 3.
[edit] 3D Engine Design and Milestones
[edit] Reducing 3D complexity to increase speed
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 can not 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 cloudy 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 that always looks the same from any viewing position.
[edit] 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. 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.
[edit] 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 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 Quake 3D engine optimization, if the player could not see into a nearby region, the 3D 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.
[edit] 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 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).
This process uses large amounts of memory, since it should take O(number of polygons * 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.
[edit] Hardware 3D acceleration
Quake was also 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 (see VQuake below). OpenGL support was soon 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 two other cards capable of rendering GLQuake were a professional (very expensive) Intergraph 3D OpenGL card, and, later, the PowerVR cards.
[edit] Impact on modern game design
Nearly all games created after Quake have used this 3D preprocessing optimization, to enhance the speed of the game on the home-user's personal computer or gaming console. 3D games are therefore able to push the limits of visual styles and effects because so much excess modeling data was stripped out before the end-user ever saw the game.
In this way most games are significantly different from professional 3D CAD and design problems, where there is no time available to do preprocessing between an engineer making a change and seeing it on the screen. Nothing can be thrown away to increase rendering speed of a 3D engineering model, since any part of the design can change at any moment. For this reason, professional 3D graphics cards are significantly more expensive and powerful than the 3D cards used in home computers simply for playing games, because the professional 3D card needs far greater processing power to deal with the full complexity of an un-preprocessed 3D renderspace.
One of the very few modern consumer-oriented programs to not do preprocess vertex pruning and light baking is the virtual world Second Life, since as with a CAD design any object in the Second Life world can be changed at any moment by the people creating the objects. As with a CAD design, the Second Life world requires a significantly more powerful 3D graphics card than more typical consumers use, and so the environment lighting and shadow effects are much less sophisticated than in a typical preprocessed 3D game.
Because Quake was one of the first true-3D games of its kind, it had to be able to work in a machine that did not have any 3D hardware acceleration. At the time 3D acceleration was a new and untested consumer market, and there was uncertainty if there would be enough interest that people would purchase a dedicated 3D rendering device. Now, over a decade later, 3D acceleration is a well-established market and a nearly essential component of any new computer. Many modern 3D games cannot run at all if hardware 3D acceleration is not available.
[edit] 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 you moved and "auto vertical aim" that would automatically shoot things above and below you. 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 monster that was shooting you above or below you. 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. However, nearly all skilled players in single-player and deathmatch alike used the mouselook option, which granted a greater degree of control, allowing for a variable turn rate. In fact, it was common for the more advanced players to openly mock beginners for not using the mouselook option, and the mouse and keyboard combination has since become a de facto standard in most PC shooters.
[edit] Network play
Quake includes cooperative and deathmatch multiplayer modes over LAN or the Internet. Additional multi-player 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.
Depending on the client's specific route to the server, different clients will get different ping times. The lower a player's latency (ping time) is, the smoother his or her in-game motions are, which makes it easier to aim, move, and score. Someone playing at the PC or within the same LAN as the server gets a substantial advantage due to having essentially no lag. This created a class structure of haves and have nots, spawning the phrases, Low Ping Bastards or LPBs and High Ping Bastards or HPBs.
While gamers had been deathmatching each other via IPX LAN connections, serial cable connections, and modems in the Doom, Heretic, and Hexen series of games, it was not until Quake that the Internet deathmatch community really began.
[edit] Derivative 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. Soon programmers were releasing new versions of the engine on the net. A few of the most known engines are:
- DarkPlaces – An engine modification that adds realtime lighting and shadowing, Quake III BSP support, ogg-support, a completely new renderer, and many other features.
- Tenebrae – A derivative that was the first to introduce realtime lighting and shadowing to the Quake engine.
- Telejano – A modification that adds many more features and particle effects.
- Tomaz Quake – One of the first Quake engine modifications on the net.
- Twilight Engine – Fastest of the known Quake engines, this modification is based on performance rather than extra features.
[edit] Games using the Quake engine
- Quake (1996) – id Software
- HeXen II (1997) – Raven Software
- Sin
- Daikatana
- Laser Arena (2000) – Trainwreck Studios
- CIA Operative: Solo Missions (2001) – Trainwreck Studios
- Urban Mercenary (2001) – Moshpit Entertainment
- Silver Wings (2005) – Bampusht! (Silver Wings uses a heavily modified version of Telejano v7)
[edit] Quake engine tools
- QuArK – a multi-purpose tool for Quake engine-based games.
[edit] See also
[edit] External links
|