Gamasutra - How id built Wolfenstein 3D using Commander Keen tech
The following excerpt is a chapter of "Game Engine Black Book: [1]Wolfenstein 3D", an in-depth examination of the history, code, and development of id Software's influential Nazi-killing first-person shooter. [2]
This chapter reflects on the game's origins and how it was built atop the success and tech of id's Commander Keen, itself created out of the bones of a failed attempt to sell Nintendo on a Mario 3 PC port.
Created by author and programmer Fabien Sanglard, the full book is now available in both physical and digital editions[3].
In 1990 a small company based in Shreveport, Louisiana was doing well in the shareware market.
As a video game subscription service, Softdisk produced and mailed new games every month to its members. Business was good but some of its employees had other ambitions.
They thought they had the skills to make it big and they wanted to prove it. They had created a new way to program side scrolling. They called the technology "adaptive tile refresh" and it enabled hardware scrolling on a PC capable of rivaling a NES. In early 1990 they worked non-stop over a weekend to reimplement Super Mario 3 on a PC and demonstrate their skills to Nintendo.
The team was successful in building a clone of Mario, but unfortunately "Ideas from the Deep" as they called themselves failed to convince Nintendo to give them a contract. As impressed as they were, the Japanese firm wanted the Mario series to remain exclusive to Nintendo consoles.
“We sent this demo to Nintendo of America, they in turn sent it to Kyoto to the mothership office, and the execs there saw the demo and were really im pressed. However, they didn’t want their intellectual property on anything but their own hardware, so they told us Good Job and You Can’t Do This."
- John Romero, programmer
This episode was enough to convince them they had not only the talent to feed their ambitions, but also the teamwork and work ethic to potentially go all the way. In February 1991 four Softdisk employees took the leap of faith and founded their own company: "id Software".
(For ample details, read "Masters of Doom[4]" by David Kushner).
They immediately used the technology developed for "Mario 3 PC" to release their own titles and build their own intellectual property. Wasting no time, the team shipped no less than three titles annually.
• Commander Keen Episode 1, 2, and 3: Invasion of the Vorticons (December 14th,
1990)
• Commander Keen Episode 4, 5, and 6: Good Bye Galaxy (December 15th, 1991)
• Commander Keen standalone game: Aliens Ate My Baby Sitter (December 1991)
The games, published by FormGen, were instant successes and sold very well. They also kept on writing games for Softdisk to publish, most of which featured adaptive tile refresh:
• Commander Keen in Keen Dreams (1991)
• Dangerous Dave in the Haunted Mansion (1991)
• Rescue Rover (1991)
• Rescue Rover 2 (1991)
• Shadow Knights (1991)
• Hovertank 3D (April, 1991).
• Catacomb 3D: A New Dimension (November, 1991)
During Spring of 1991 the next generation of id Software technology started to surface. Hovertank 3D placed the player inside a tank. There was no texture mapping yet and the pace was quite slow. Catacomb 3D marked the introduction of textures and took immersion one step further by placing the player in control of a magician in first person view.
In November 1991, the team was free from any obligations to SoftDisk. Their next game was going to feature the 3D technology they were building and would be called Wolfenstein 3D. Given the magnitude and ambition of the title, four more people were added to the team for a total of eight.
"Jason was part of id at the start, but we parted ways during Wolf development."
- John Carmack, programmer
Organization
In September 1991, following Tom and Jason’s high-school memories of the area, the team relocated from Shreveport, LA to Madison, WI. They established their office in a two story brick building at The Pines apartment complex, 2622 High Ridge Trail. They all lived in walking distance of the office except for John Carmack who, since he did not care, inhabited the second floor of the apartment.
The development of Wolfenstein 3D started in January 1992. As temperatures fell and snow dumped from the sky, the team kept itself increasingly busy and barely left the office. Development lasted four months and Wolfenstein 3D was released in May 1992.
During these four months, the organization of the team was pretty much standard for a game studio of this era: four guys crammed in one room, dictating a fast pace and strong sense of camaraderie (and a lot of noise disturbance given John Romero and Tom Hall’s type of interaction).
On the map (below) you can see on the upper floor the SNES where countless games of F-Zero were played and the Dungeons & Dragons area extensively mentioned in "Masters of Doom". To have a team member (John Carmack) with his apartment directly above the studio was not out of the ordinary.
"We started with floppy data transfer, but we had a Novell network on coax Ethernet by the end*. We didn’t have a version control system. Surprisingly, we went all the way to Quake 3 without one, then we started using Visual Source Safe."
- John Carmack, programmer
* Comment from John Romero: "We bought a $7000 Novell Netware 3.11 system while in Madison, WI in November 1991. This included the file server, cables, and network cards.
Everybody was working with the best PC money could buy, a high end 386-DX 33MHz with 4MiB of RAM.
Programming
Development was done with Borland C++ 3.1 (but the language used was C) which by default ran in VGA mode 3 offering a screen 80 characters wide and 25 characters tall.
John Carmack took care of the runtime code. John Romero programmed many of the tools (TED5 map editor, IGRAB asset packer, MUSE sound packer). Jason Blochowiak wrote important subsystems of the game (Input manager, Page manager, Sound manager, User manager).
Borland’s solution was an all-in-one package. The IDE, BC.EXE, despite some instabilities allowed crude multi-windows code editing with pleasant syntax highlights. The compiler and linker were also part of the package under BCC.EXE and TLINK.EXE.
There was no need to enter command-line mode however. The IDE allowed to create a project, build, run and debug.
To compensate for the tiny CRT display, some of the developers used two screens. (Note from John Romero: "Both John and I had small 12' amber monochrome monitors we used with Turbo Debugger").
Graphic Assets
All graphic assets were produced by Adrian Carmack (Kevin Cloud did a few textures and also worked on the design and layout of the Wolfenstein 3D hint book). All of the work was done with Deluxe Paint (by Brent Iverson, Electronic Arts) and saved in ILBM (InterLeaved BitMap) files (Deluxe Paint proprietary format).
Since the VGA is palette-based (colors were not specified via 24-bit RGB but via indices pointing to a 256-color table) the creative process was difficult. Adrian had to first make the key decision of which colors would go in the palette (some games like Monkey Island used multiple palettes depending on the section of the game; id Software went for a simpler solution with one palette for the whole game), then draw everything with only those colors.
The palette coordinates run 0x00 to 0x0F horizontally and 0x00 to 0xF0 vertically. The horizontal blue gradient at the bottom starts at 0xF0 and ends at 0xFE. 0xFF (represented in pink) is a special color deemed transparent by the engine and always skipped during rendering.
All assets were hand drawn with a mouse. Since the VGA stretched the framebuffer when displaying it on the screen, Adrian had to be careful to draw at the same resolution as the game would run (320x200).
"Adrian and Kevin both worked directly in Deluxe Paint, we didn’t have any scanning tools at the time."
- John Carmack, programmer
Graphic assets are divided in two categories:
- 2D Menu items shipping with the game in VGAGRAPH, VGAHEAD, and VGADICT
- 3D Action phase items (walls and sprites) shipping in the VSWAP archive
Assets Workflow
After the graphic assets were generated, a tool (IGRAB) packed all ILBMs together in an archive and generated a C header file with asset IDs. The engine references an asset directly by using these IDs.
Trivia: This system led to issues when the source code was released. The .h header files provided did not match the asset files from the shareware or early versions of Wolfenstein 3D. The headers released were from Spear of Destiny. You can see the kind of graphic mess this led to in the article "Let’s compile like it’s 1992" on fabiensanglard.net.
"The Official Hint Manual for Wolfenstein 3D[5]" published in 1992 explains the creative process. It contains many drawings from Tom Hall and shows many behind the scene sketches made by Tom Hall and pixelarted by the graphic team.
"When Id’s Creative Director, Tom Hall gets an idea for a screen, he provides a sketch for Adrian Carmack. Below are some of Tom’s early designs for the title screen. The third sketch was chosen." - Official Hint Manual for Wolfenstein 3D
The hint manual also contains several photos of the team back in the day; it is worth a read for context.
[The manual was designed on a NeXT ColorStation. It was the only usage of Steve Jobs’s machine for Wolfenstein 3D even though id purchased it in December 1991. NeXT’s series of workstations later became a key element of the production pipeline for Doom in 1993.]
References
- ^ Game Engine Black Book: (fabiensanglard.net)
- ^ Wolfenstein 3D (fabiensanglard.net)
- ^ physical and digital editions (fabiensanglard.net)
- ^ Masters of Doom (www.davidkushner.com)
- ^ The Official Hint Manual for Wolfenstein 3D (www.amazon.com)