This article is a translation of the Game Engine Black Book chapter: DOOM , a detailed analysis of the internal structure of one of the most influential games id Software. This chapter describes the complex porting process
DOOM on Super Nintendo and the key role played by the game developer
Star Fox studio Argonaut Games.
The book is written by the author and programmer Fabien Sanglar, and its full text can now be purchased in paper and digital form .
Super Nintendo Entertainment System was released in Japan in 1990, and the following year appeared in the USA and Europe.
She became a 16-bit descendant of 8-bit NES. In Japan, the Super Fami-Com (FAMIly COMputer) gained instant success, and the entire initial batch of 300 thousand devices was sold out in a matter of hours. The hype was so strong that the government asked Nintendo to release their consoles on the weekends to avoid unrest.
To ensure the high quality of the console games, Nintendo has created a ruthless control system. Publishers had the right to release only five games a year. In order for this rule to apply, Nintendo reserved the right to manufacture cartridges only for itself; publishers were forced to buy them from Nintendo. In order for everyone to play by the rules (as well as to protect games from being copied), before starting the game, the SNES console checked for the presence of a CIC chip. It was a powerful defense mechanism that was only cracked by the end of the SNES lifetime.
During the nine years of the console's life, 721 games were released, and among them were hits such as Super Mario World
, Zelda III
[ The Legend of Zelda: A Link to the past
], Mario Kart
, Super Metroid
and Donkey Kong Country
. For all the time, almost 50 million consoles have been sold, so SNES is considered one of the most popular consoles in history, both in terms of sales volumes and the game catalog.
Technically, the superiority of SNES lay in the field of 2D graphics. Its 16-bit processor 65C816 with a frequency of 3.58 MHz had 128 kibibytes of RAM. He managed a PPU (Picture Processing Unit) device with 64 kib-bytes of RAM that was processing large sprites and could support up to 256 colors at a resolution of 256x240. The console's sound system consisted of a powerful combination of an 8-bit Sony SPC700 processor and a 16-bit digital signal processor with 64 kib-bytes of dedicated RAM.
Despite the impressive engine handling two-dimensional sprites and in particular the function Mode 7, the machine lacked the strength for such computationally expensive operations like 3D computing. Nintendo was clearly aware that 3D would be the next important stage in the development of games, but it did not have the capacity to implement it. By the will of fate, a small British company found a solution to this problem.
In 1982, Jez Sun alone developed games designed exclusively for the C64, Atari ST and Amiga computers. To sell his creations he needed a company. Seeing the similarity between his name (J.San) and Jason (Jason) from the myth of the Argonauts, he called it Argonaut Games plc.
The company did not remain a single-person ensemble for long. By 1990, he had assembled talented people in the company's London office, and he had an interest in the 1989 Nintendo Game Boy handheld console. The team managed to accomplish two seemingly almost impossible feats: they created a wireframe 3D engine and hacked CIC protection to install it on the Game Boy.
"The Nintendo logo dropped from the top of the screen, and when it reached the middle, the loader checked if the logo was in the right place.
The game was launched only if the word was in the right place ROM. If someone wanted to create a game without the permission of Nintendo, they would have to use the word Nintendo without licensing; therefore, Nintendo could have filed a trademark claim. We found out that this is just a resistor and a capacitor — about one cent of the price — and figured out how to fool the protection. The system read the word Nintendo twice - first to display it on the screen during the boot process, a second time - to verify its correctness before launching the game from the cartridge. And it was a fatal mistake - the first time the console read the word Nintendo, we forced it to return Argonaut so that it would fall on top of the screen. In the second test, we applied power to the resistor and capacitor so that the correct Nintendo word was in memory, and the game was loaded without any problems. ”- Jez Sun, from an interview with Eurogamer , recorded in 2014.
At CES ’90, his demo engine from the Nintendo booth traveled all the way to the company's office in Kyoto. Then Jez didn't know about it yet, but he chose the perfect time. Just then, Nintendo worked in Japan on Super Famicom games, which were supposed to show its technological superiority at the time of the console release. Super Mario World
was in its infancy, but the Pilotwings
flight simulator was already a bit more complicated game.
To simulate the relief in Pilotwings
, we used the Mode 7 mode of the PPU device (capable of performing such affine transformations as rotation, scaling and cutting the image into parts), as well as the HDMA mode. However, the planes themselves still remained the usual two-dimensional hand-drawn sprites. This worried the game's producer, Sigaru Miyamoto, because it did not allow the camera to rotate smoothly around the planes (the sprites were broken into pieces).
At the time, Nintendo did not like working with third-party companies, and even more so with foreigners. But this time they made an exception and invited Jez with Dylan Cuthbert, who worked on the 3D engine, to their Kyoto head office.
The young people (Gesu was 23 years old, Dylan was 18) met with all the vice presidents of Nintendo: Miyamoto, Gumpay Yokoi, Takehiro Isusi, Yasuhiro Minagawa and Genio Takeda. They were shown everything from secret SNES to secret Mario
. Then they were asked if it was possible to find a way to draw airplanes like real polygonal objects.
“I told them that this is the best thing that they can achieve, unless they allow me to develop the equipment so that SNES becomes better in 3D. Surprisingly, even though I had never worked on equipment before, they said yes and gave me a million dollars to sell. ” - Jez Sun
Jez boldly promised them a “tenfold” increase in productivity, so Nintendo gladly accepted the proposal to develop special equipment for the game. Pilotwings
will have to be released with sprite aircraft to catch the Super Famicom, but the chip, later called Super FX, will be used for another Nintendo project.
It was called Star Fox
According to the contract, Nintendo had the right to all decisions on game design, and also funded Argonaut Games for the production of not only equipment, but also a 3D engine for the game. Jez-san immediately began hiring British specialists known to him.
For equipment development, he signed a contract with Flare Technology (the same people who developed the Atari Jaguar design).The Ben Cheese, Rob Macaulay, and James H. hackill project was codenamed Mathematical Argonaut Rotation I/O, or MARIO. As a result, the device they created turned out to be so powerful that, jokingly, they called Super NES “just a box for installing our chip.” Since it was impossible to upgrade the console, the chip was soldered into each new game cartridge, which significantly increased its retail price.
“We developed the Super FX chip in a way that nobody designed equipment before us - at first we created the software and our own set of instructions for maximum optimization of the software operation. Nobody did that! Instead of creating a 3D chip, we essentially developed a full-featured RISC microprocessor that had mathematical functions and pixel rendering functions, and the rest was software. It was the world's first video processing unit (Graphics Processing Unit), and we have patents that prove it ”- Jez San
Carl Graham and Pete Warns worked on building the engine in the company's London office, while Dylan Cuthbert, Christer Wombell and Giles Goddard (and later Colin Reed) moved to Nintendo’s Kyoto offices and worked closely with the Miyamoto team.
The project was crowned with commercial and technological success. Star Fox
was released on February 21, 1993, and sold four million copies.
The further history of the relationship between the two companies is sad. The Star Fox 2 megahit sequel was completed by the “Argonauts” and is ready for release in 1996, but Nintendo suddenly interrupted the project, fearing its influence on the release of Nintendo 64. Argonaut didn’t like it and its relationship with Nintendo deteriorated. Later Nintendo lured to her Goddard and Wombella. Dylan Cuthbert could also join them, but he was prevented by the clause on the prohibition of competition. He retired from Argonaut and, after joining Sony, began work on a PlayStation.
The “divorce” of the two companies ended when Nintendo did not allow Argonaut to use Yoshi’s character in a platform game that the company planned to release on PS1. As a result, they replaced Yoshi with a crocodile and called the game Croc: Legend of the Gobbos . Nintendo later released Mario 64 , one of whose mechanics suspiciously resembled Croc ... and even won the market for about a year.
The MARIO chip had a simple design based on a 16-bit RISC processor with a frequency of 10.74 MHz and a 512 byte i-cache. It had its own set of instructions, optimized for mathematical calculations, and its own frame buffer, optimized for pixel placement. His job was to render to the frame buffer, the data from which were periodically transferred to the SNES RAM using DMA. It could render up to 76,458 polygons
per second, which provided Star Fox about 15 fps.
Having witnessed the phenomenal success of Star Fox , other studios are interested in its technologies. A new version of the chip, called GSU, was released, capable of operating at 21.4 MHz. The first generation of GSU was used in four games: Dirt Racer , Dirt Trax FX , Stunt Race FX and Vortex . < br/>
The second generation (GSU-2) had the same processor with a frequency of 21.4 MHz and additional contacts soldered to the bus to increase the size of the supported ROM and frame buffer. It was used in three games: DOOM , Super Mario World 2: Yoshi’s Island and Winter Gold .
If you open the DOOM cartridge, you can see all the components mentioned above:
 16-bit GSU-2,  512-kibibytey frame buffer, which was used to write GSU,  2 -MB ROM, in which the code and resources were stored,  module of six inverters and  CIC chip for copy protection.
“A ten-fold increase in productivity was, on my part, pure exaggeration. We did not know if this was possible. But it allowed us to exaggerate, and at the same time exceed the promises. Instead of a tenfold increase in 3D performance, we actually increased it 40 times. In some areas, for example in mathematical 3D-calculations, the growth was even a hundredfold. The chip could not only perform 3D computations and work with vector graphics, but also provide rotation and scaling of sprites, and this function was extremely necessary for Nintendo’s own games, for example, Super Mario World 2: Yoshi’s Island. ” - Jez Sun
Interesting fact: some fans managed to collect all the games (721 titles) from the SNES directory. Typically, the DOOM cartridge can be seen from afar. Only three games were allowed to release in a non-standard gray package. Two were red - DOOM and Maximum Carnage , and Killer Instinct was black.
Doom on Super Nintendo
DOOM appeared on SNES thanks to the genius and determination of one person: Randy Linden. He loved this game and decided to port it to a popular console so that more players could enjoy it. Randy did not have access either to the source code or to the resources of the game versions for the PC or console. He had to start from scratch.
For resources, he could use the “unofficial specification of Doom ” written by Matthew Fell. It described in detail the structure of the .wad files. Sprites, textures, music, sound effects and Randy maps extracted from DOOM.WAD. With the engine, the story was completely different.
" DOOM was a truly revolutionary game, and I wanted people without a PC to play it. DOOM at SNES was another programmer feat that could be commit.
I started the project on my own and having created a fully functional prototype, I showed it to the demo in Sculptured Software. The Sculptured team helped me complete the game so that it could be released on time for the holidays.
The development process was complicated for a variety of reasons, primarily because there were no development systems for the SuperFX chip at that time. Before embarking on the game itself, I wrote a complete set of tools - an assembler, linker, debugger.
The hardware development kit consisted of a Star Fox hacked cartridge (because it had a SuperFX chip) and a pair of modified game controllers connected to both SNES connectors and connected to an Amiga parallel port. A serial protocol was used to download the code, set breakpoints, examine the memory when transferring data between two devices.
I would like the game to have more levels, but, unfortunately, the game occupied the most voluminous of the available ROMs and occupied it almost completely.I vaguely remember that there was only about 16 bytes free, that is, there was no more space left! Nevertheless, I managed to accommodate support for Super Scope, a mouse and an XBand modem! Yes, you could even play with someone online! "- Randy Linden in an interview for Gaming Reinvented
In this version, it’s remarkable how Randy had to “cut corners”, taking into account the capabilities and limitations of the port engine.
In Figure 6.8, it can be seen that, despite only 600 kibibytes of RAM, the blue floor is preserved (albeit the same color). Notice that the geometry has not changed (it must have been extremely difficult to achieve this, because Randy has neither DoomED nor doombsp), and on E1M1 all the steps from the original have been preserved.
The Reality engine, as Randy called it, was able to work with the geometry of the cards with a PC, but he most likely had problems with filling speed and texture sampling, because the ceiling and floor textures are completely absent.
In the screenshot above, you can see that the window is not really displayed in full screen. This problem did not only concern DOOM - Star Fox , Star Fox 2 , and all Super FX games had to reduce the size of the playing area. Most likely this was due to the limited SNES transmission rate, which did not allow DMA transmission for full-screen rendering.
Of the 256x224 pixels of the native resolution of the console, it was possible to draw only 216x176, and only 216x144 were used for 3D (the status bar was drawn on 32 lines). Vertical lines were duplicated, that is, the Reality Engine was able to render only 108x144 in resolution. And even with such a low resolution, the average frame rate was 10 FPS, which was a serious achievement. The “low” frame rate did not deter players from playing DOOM . According to Randy Linden, the cartridges sold very well.
The list of features donated for the sake of precious RAM, got the resolution of sprites, which had to be significantly reduced; sometimes it was even difficult to disassemble them (as opposed to the player’s weapon, which was rendered at a higher resolution). I had to remove all the poses of the enemies, except for the sprites looking at the player, get rid of the monsters' fights with each other, spread the sound (the monsters were awakened only by visual contact), cut out most of the sound effects (all the monsters sounded like imps).
Interesting fact: Nintendo initially banned the use of blood in games on the SNES. By the time DOOM was released, the ESRB rating procedure appeared on the scene. Given the amount of blood and pieces of flesh, it’s not surprising that DOOM received an M rating at SNES ("from 17 years of age").
The full text of the book "Game Engine Black Book: DOOM " is available on the website by Fabien Sanglar .