Wolfenstein 3D engine
|Written in||C, x86 assembly language|
The Wolfenstein 3D engine is the engine that powers Wolfenstein 3D. The biggest part of the engine is programmed by John Carmack. It is written in C and x86 assembly language. It features graphics (ray casting), sound (PCM and IMF), player physics and game control.
Features and limitations
To render the walls in pseudo-3D, the game uses ray casting. This technique emits one ray for each column of pixels, checks if it intersects a wall, and draws textures on the screen accordingly, creating a one-dimensional depth buffer against which to clip the scaled sprites that represent enemies, powerups, and props.
Before Wolfenstein 3D, the technology had already been used by id Software in 1991 to create Hovertank 3D and Catacomb 3-D for Softdisk. Other games using the Wolfenstein 3D game engine or derivatives of it were also produced, including Blake Stone, Corridor 7: Alien Invasion, Operation Body Count, Super 3D Noah's Ark, Rise of the Triad, and Hellraiser, an unreleased Color Dreams game planned for the PC and the Nintendo Entertainment System. The success of the engine also inspired numerous imitators such as Ken's Labyrinth, Nitemare 3D, Isle of the Dead and the Pie in the Sky engine.
According to id Software programmer John Carmack, the game's engine was inspired by a technology demo of Looking Glass Studios'/Origin's first-person role-playing video game, Ultima Underworld: The Stygian Abyss from 1991. Carmack claimed he could make a faster renderer. In this he was successful. The Wolfenstein engine lacks many features present in the Underworld engine, such as ceiling or floor height changes, sloped floors, curved walls, and lighting, but it ran well on relatively weak hardware.
The secret behind engine's performance is vertical scanline scaling algorithm. Unlike later engines and hardware rasterizers, the texture coordinate for the pixel is not calculated at runtime. Instead, a fixed set of several hundred rendering functions is generated during game startup (or viewport size change) where all memory offsets are fixed. To keep the number of these procedures small, height is quantized, which can be easily seen when player is close to the wall, but not looking at it at a right angle.
Limitations of the engine include:
- Looking and/or moving up and down is not supported.
- It does not support differences in brightness of the lights.
- It does not support differences in geometrical height.
"Holo-walls" are walls created by mapmakers using a glitch in the PC version's engine. They are walls that the player can walk through, and are used in some total conversions to simulate windows that players can climb through, and hedges that players can walk through. One way of creating holo-walls is to place a dead guard in a wall.
Games Using the Wolfenstein 3D Engine
The follow games are built on the Wolfenstein 3D engine.
- Wolfenstein 3D
- Spear of Destiny
- Blake Stone: Aliens of Gold
- Blake Stone: Planet Strike
- Operation Body Count
- Corridor 7
- Super 3D Noah's Ark
- Rise of the Triad
A few 3D games used the technology developed by John D. Carmack before Wolfenstein 3D, all of which were published by Softdisk under the terms of id's then contractual obligations; the Catacomb 3D sequels were not made by id however. The Wolfenstein 3D engine is a direct continuation of the engine used for these games, though much of the code was optimized and cleaned up from these early bases, as well as the additions of features such as EGA graphics (as opposed to VGA) and digitized sound support (as opposed to PC speaker or AdLib Music Synthesizer Card); texture mapping was also not present in Hovertank 3D, and so all walls were solid colour. The source code to Hovertank and Catacomb 3D were released in June 2014 by Flat Rock Software under the GNU General Public License in a manner similar those done by id and partners.
- Source code at id Software's FTP server
- Engine source code and compiling instructions
- DieHard Wolfers Forum - Forum about Wolf3D and programming
- Mallinson, Paul. (2002). [Interview with Paul Neureth and Doug Church, developers of Ultima Underworld]. Games that changed the world: Ultima Underworld, Computer and Video Games site.
- The Rise of the Triad source code from 3drealms.com - released December 20, 2002 under the GNU General Public License
- Larabel, Michael (June 6, 2014). "id Software's Softdisk Open-Sources Some Really Old Games". Phoronix. Retrieved June 6, 2014.