How Doom got on Super Nintendo

Original author: Fabien Sanglard
  • Transfer
image

This article is a translation of the chapter of the Game Engine Black Book: DOOM , a detailed analysis of the internal structure of one of the most influential id Software games. This chapter talks about the complex process of porting DOOM to Super Nintendo and the key role that Star Fox developer Argonaut Games played in it .

The book was written by the author and programmer Fabien Sanglar, and its full text can now be purchased in paper and digital form .

The Super Nintendo Entertainment System was released in Japan in 1990, and the next year it appeared in the US and Europe.

She became a 16-bit descendant of the 8-bit NES. In Japan, Super Famicom (FAMIly COMputer) gained instant success, and the entire initial batch of 300 thousand devices was sold out in a matter of hours. The excitement was so strong that the government asked Nintendo for the future to release their consoles on weekends in order to avoid unrest.

To ensure high-quality gaming console Nintendo has created a ruthless control system. Publishers had the right to release just five games a year. For this rule to apply, Nintendo reserves the right to manufacture cartridges only to itself; publishers were forced to buy them from Nintendo. In order for everyone to play by the rules (and also to protect games from copying), before starting the game, the SNES console checked for the presence of a CIC chip. It was a powerful defense mechanism that was only able to be cracked towards 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 , F-Zero, Super Metroid, and Donkey Kong Country . Almost 50 million consoles have been sold over the entire time, so SNES is considered one of the most popular consoles in history, both in terms of sales volumes and the catalog of games.

Technically superior SNES was in the field of 2D-graphics. Its 16-bit 65C816 processor with a frequency of 3.58 MHz had 128 kbytes of RAM. He controlled a PPU (Picture Processing Unit) with 64 kbytes of RAM, which handled 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 kbytes of dedicated RAM.

Despite the impressive engine for processing two-dimensional sprites and in particular the Mode 7 function, the machine lacked the strength for such computationally expensive operations as 3D computing. Nintendo clearly recognized that 3D would be the next important stage in the development of games, but it did not have the ability to implement it. By the will of fate, a small British firm found a solution to this problem.

Argonaut Games


In 1982, Jez San single-handedly developed games designed exclusively for the C64, Atari ST, and Amiga computers. He needed a company to sell his creations. Seeing the similarities 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 gathered talented people in the London office of the company, and he became interested in the Nintendo Game Boy portable console, released in 1989. The team managed to make two seemingly almost impossible feats: they created a wireframe 3D engine and cracked the CIC defense to install it on Game Boy.

“The Nintendo logo went down from the top of the screen, and when it reached the middle, the bootloader checked to see if the logo was in the right place.

The game was launched only if this word was in the right place of the 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 file a trademark lawsuit. We found out that it was just a resistor and a capacitor - parts costing about one cent - 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 check its correctness before starting the game from the cartridge. And it was a fatal mistake - the first time the console read the word Nintendo, we made it return Argonaut so that it dropped to the top of the screen. In the second test, we applied power to the resistor and capacitor so thatJez San, from a 2014 Eurogamer interview .

At CES '90, his demo engine from the Nintendo booth has made it all the way to the company’s office in Kyoto. Jez did not know about it then, but he chose the perfect time. Just then, Nintendo was working in Japan on games for Super Famicom, which were supposed to show at the time of the release of the console its technological superiority. Super Mario World was just in its infancy, but the flight simulator Pilotwings was already a bit more complicated game.

To simulate terrain in Pilotwingsthe PPU device’s Mode 7 was used (capable of performing such affine transformations as rotation, scaling, and cutting the image into parts), as well as the HDMA mode. However, the aircraft themselves still remained the usual two-dimensional hand-drawn sprites. This bothered the producer of the game, Shigeru Miyamoto, because he did not allow the camera to rotate smoothly around the aircraft (the sprites broken into pieces were uneven).

At that 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 Jeza to their head office in Kyoto with Dylan Cuthbert, who worked on the 3D engine.

Young people (Jesu was 23 years old, Dylan was 18) met with all the Nintendo vice presidents: Miyamoto, Gumpei Yokoi, Takehiro Izushi, Yasuhiro Minagawa and Genio Takeda. They were shown everything from secret SNES to secret Mario and Pilotwings . They were then asked if it was possible to find a way to render planes as real polygonal objects.

“I told them that this is the best they can achieve, unless they let me design the equipment so that SNES gets better in 3D. Surprisingly, even though I had never done equipment before, they said “yes” and gave me a million dollars to sell. ” - jes san

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 planes to catch Super Famicom, but the chip, later called Super FX, will be used for another Nintendo project.

It was called Star Fox .

Star fox


According to the agreement, Nintendo had the right to all decisions on game design, and also financed Argonaut Games for the production of not only equipment, but also a 3D engine for the game. Jez-san immediately began hiring British specialists he knew.

To develop the equipment, he signed an agreement with Flare Technology (the same people who were designing the Atari Jaguar). The project of Ben Cheese, Rob Macaulay, and James Hakeville was codenamed Mathematical Argonaut Rotation I / O, or MARIO. As a result, the device they created turned out to be so powerful that they jokingly 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 before us designed the equipment - first we created the software and our own set of instructions to optimize the software. 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, while the rest was dealt with by software. It was the world's first Video Processing Unit (Graphics Processing Unit), and we have patents that prove it. ”- Jez Sun

Karl Graham and Pete Warns worked on the engine at the company's London office, while Dylan Cuthbert, Christer Wombell and Giles Goddard (and later Colin Reed) moved to Nintendo's offices in Kyoto 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 sequel to the mega hit Star Fox 2It was completed by the Argonauts and was ready for release in 1996, but Nintendo abruptly interrupted the project for fear of its influence on the release of Nintendo 64. Argonaut did not like this and relations with Nintendo deteriorated. Later, Nintendo lured Goddard and Wombella to him. Dylan Cuthbert could also join them, but he was prevented from doing so by the clause of the agreement on the prohibition of competition. He quit Argonaut and, working at Sony, set to work on the PlayStation.

The "divorce" of the two companies ended when Nintendo did not allow Argonaut to use Yoshi's character in the 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, whose mechanics were suspiciously reminiscent of 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. He had his own set of instructions, optimized for mathematical calculations, and his own frame buffer, optimized for placing pixels. His job was to render into a frame buffer, the data from which was periodically transferred to SNES RAM using DMA. It could render up to 76,458 polygons per second, which provided Star Fox at about 15 fps.

Having witnessed the phenomenal success of Star Fox , other studios became interested in its technologies. A new version of the chip called GSU was released, capable of operating at a frequency of 21.4 MHz. The first generation GSU was used in four games: Dirt Racer ,Dirt Trax FX , Stunt Race FX and Vortex .

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 above components:

[1] 16-bit GSU-2, [2] 512-KB frame buffer, which GSU was writing to, [3] 2-mebbyte ROM, in which the code was stored and resources, [4] a module of six inverters and [5]CIC chip for copy protection.

“Tenfold productivity growth was on my part a sheer exaggeration. We did not know if this was actually possible. But this allowed us to exaggerate, and at the same time to exceed promises. Instead of a tenfold increase in 3D performance, we actually increased it by 40 times. In some areas, such as mathematical 3D computing, growth was even a hundredfold. The chip could not only perform 3D calculations and work with vector graphics, but also provide rotation and scaling of sprites, and this function was extremely needed by Nintendo’s own games, for example, Super Mario World 2: Yoshi's Island. ” - jes san

An interesting fact: some fans managed to collect all the games (721 names) from the SNES catalog. Typically, a DOOM cartridgecan be seen from afar. Only three games were allowed to be released in a non-standard gray case. Two were red - DOOM and Maximum Carnage , and Killer Instinct was black.



Doom on Super Nintendo


DOOM on SNES came about thanks to the genius and determination of one person: Randy Linden. He loved this game and decided to port it to the popular console so that more players could enjoy it. Randy did not have access to the source code, nor 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 Doom specification ” written by Matthew Fell. It described in detail the structure of .wad files. Sprites, textures, music, sound effects and maps Randy 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 on SNES was another of the programming feats that could be accomplished.

I started the project on my own and created a fully functional prototype, showed it a demo in Sculptured Software: A team of Sculptured employees helped me complete the game so that it could be released on time for the holidays.The

development process was complicated for many reasons, primarily because there were no development systems for the SuperFX chip at that time. herself and D, I wrote a complete set of tools - assembler, linker, debugger.

A hardware development kit consisted of a hacked cartridge Star Fox(because it had a SuperFX chip) and a couple of modified game controllers connected to both SNES connectors and connected to the Amiga parallel port. To download the code, set breakpoints, examine the memory when transferring data between the two devices, a serial protocol was used.

I would like for the game to have more levels, but, unfortunately, the game occupied the most voluminous available ROM and occupied it almost completely. I vaguely recall that only about 16 bytes were free, that is, there was no more space left! However, I managed to accommodate support for Super Scope, mouse and XBand modem! Yes, you could even play with someone online! "- Randy Linden in an interview for Gaming Reinvented

In this version, it is noteworthy 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 has remained (albeit of the same color). Note that the geometry has not changed (it must have been extremely difficult to achieve this, because Randy had neither DoomED nor doombsp), and all the steps from the original were preserved on E1M1.

The Reality engine, as Randy called it, was able to work with the geometry of cards from a PC, but it most likely had problems with the speed of filling and sampling textures, because the textures of the ceiling and floor are completely absent.


The screenshot above shows that the window is not actually displayed in full screen. This problem concerned not only DOOM - Star Fox , Star Fox 2, and all games with Super FX had to reduce the size of the workspace. Most likely, this was due to the limited SNES transmission rate, which did not allow DMA transmission for full-screen rendering.

Out of 256x224 pixels of the “native” resolution of the console, only 216x176 could be drawn, and only 216x144 were used for 3D (a status bar was drawn on 32 lines). The vertical lines were duplicated, that is, the Reality Engine was able to render at a resolution of only 108x144. And even with such a low resolution, the average frame rate was 10 FPS, which was a major 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 precious RAM included sprite resolution, which had to be significantly reduced; sometimes it was even difficult to disassemble them (as opposed to the player’s weapon, which was rendered in higher resolution). I had to remove all the poses of the enemies, with the exception of sprites looking at the player, get rid of monster fights with each other, spread sound (monsters were awakened only by visual contact), cut out most of the sound effects (all monsters sounded like imps).

Interesting fact: Nintendo initially banned the use of blood in games on SNES. By the time DOOM was released, an ESRB rating procedure had appeared on the scene. Given the amount of blood and pieces of flesh, it is not surprising that DOOMSNES received a rating of M ("from 17 years old").

Full text of the book «the Game Engine Black Book: DOOM » can be purchased on the website of Fabien Sanglara.

Also popular now: