Gamasutra is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Gamasutra: The Art & Business of Making Gamesspacer
View All     RSS
August 21, 2019
arrowPress Releases







If you enjoy reading this site, you might also want to check out these UBM Tech sites:


Inside the work to get Doom on the Super Nintendo

Inside the work to get  Doom  on the Super Nintendo
June 7, 2019 | By Fabien Sanglard

June 7, 2019 | By Fabien Sanglard
Comments
    Post A Comment
More: Console/PC, Programming, History



The following excerpt is a chapter of "Game Engine Black Book: DOOM", a comprehensive look at the inner workings of one of id Software's most influential games. This chapter examines the trials and triumphs of porting DOOM to the Super Nintendo, and the pivotal role played by Star Fox developer Argonaut Games.

Created by author and programmer Fabien Sanglard, the full text is now available in both physical and digital editions.

The Super Nintendo Entertainment System was released in 1990 in Japan and the following year in USA and Europe.

It was the 16-bit successor to the 8-bit NES. In Japan, the Super Fami-Com ("FAMIly COMputer") was an instant success and the initial shipment of 300,000 units sold out within hours. The frenzy was such that the government requested Nintendo to release its future systems on weekends to avoid further disturbances.

Nintendo had established a merciless system to ensure quality of its games. Publishers were only allowed five games per year. To make sure this rule was enforced, only Nintendo was allowed to produce cartridges; publishers had to buy them from Nintendo. To make sure everybody played by the rules (and also to protect games from being copied) the SNES looked for a CIC lockout chip before a game was allowed to start. It was a powerful mechanism only cracked after the SNES reached its end of life.

During its nine-year lifespan, 721 games were published, among them several critical and commercial successes 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. Having sold close to 50 million units it is arguably one of the most popular consoles of all time both in terms of sales and catalog.

From a technical standpoint, the SNES excelled at 2D. Its 16-bit 65C816 3.58 MHz CPU had 128 KiB RAM available. It piloted a PPU (Picture Processing Unit) with 64 KiB of RAM to manipulate large sprites, using up to 256 colors at a resolution of 256x240. On the audio side, the machine had the powerful combo of an 8-bit Sony SPC700 and a 16-bit DSP with 64 KiB of dedicated SRAM.

Despite its impressive 2D sprite engine and especially its "Mode 7" capability, the machine struggled with computationally-intensive operations such as 3D calculations. Nintendo was vividly aware that 3D would be the next big thing in gaming but was struggling to make it happen. As fate would have it, a small UK firm would hold the solution to the problem.

Argonaut Games

Back in 1982, Jez San was a lone game developer working exclusively on the C64, Atari ST, and Amiga computers. To sell his creations he needed a company. Seeing a similarity between his name (J.San) and the mythological story of Jason and the Argonauts, he named it Argonaut Games plc.

His venture did not remain a single-man project for long. By 1990 he had gathered talent in London offices and developed an interest in Nintendo’s 1989 handset, the Game Boy. The team had managed two feats most deemed impossible: they had a 3D wireframe engine and they had cracked the CIC protection to install it on the Game Boy.

"They had the Nintendo logo drop down from the top of the screen, and when it hit the middle the boot loader would check to see if it was in the right place.

The game would only start if the word was correctly in place in the ROM. If anyone wanted to produce a game without Nintendo's permission, they would be claiming to use the word 'Nintendo' without a licensed trademark, and therefore Nintendo would be in a position to sue them for trademark infringement. We figured out that with just a resistor and capacitor - around one cent's worth of components - we could find out how to beat the protection. The system read the word 'Nintendo' twice - once to print it on the screen at the boot up, and a second time to check if it was correct before starting the game cartridge. That was a fatal mistake, because the first time they read 'Nintendo' we got it to return 'Argonaut', so that was what dropped down the screen. On the second check, our resistor and capacitor powered up so the correct word 'Nintendo' was in there, and the game booted up perfectly." - Jez San, speaking to Eurogamer in 2014

At CES ’90, his demo to the Nintendo booth of the engine on a hacked cartridge was relayed all the way up to the Kyoto headquarters. Unknown to Jez at the time, his timing could not have been better. Back in Japan, Nintendo was working on Super Famicom titles intended to showcase its superior technology upon launch. Super Mario World was in its infancy, but the flight simulator Pilotwings was a bit more advanced.

The SNES PPU’s Mode 7 (capable of affine transformation such as rotation, scaling, and shearing) was used along with the HDMA mode to simulate the terrain in Pilotwings. The planes however were still 2D hand-drawn sprites. This bugged producer Shigeru Miyamoto since it prevented the camera from smoothly rotating around the planes (quantized sprites were jaggy).

At the time, it was not in Nintendo’s habit to deal with outsiders or even foreigners. This time they made an exception and flew Jez to their headquarters in Kyoto, along with Dylan Cuthbert who had done the 3D work.

The young pair (Jez was 23 and Dylan 18) met all of Nintendo’s VPs: Miyamoto, Gunpei Yokoi, Takehiro Izushi, Yasuhiro Minagawa and Genyo Takeda. They were shown everything from the secret SNES to the secret Mario/Pilotwings. Then they were asked if there was a way to draw the planes as full-faced polygon objects.

“ I told them that this is as good as it’s going to get unless they let us design some hardware to make the SNES better at 3D. Amazingly, even though I had never done any hardware before, they said YES, and gave me a million bucks to make it happen." 

- Jez San

Boldly promised a "10x" performance increase by Jez, Nintendo embraced the offer to get special hardware designed for their game. Pilotwings would ship with sprite planes so that it could be ready for the Super Famicom release, but the "Super FX" chip as it would be marketed later was to be used for another project Nintendo had up its sleeves.

The name was "Star Fox".  

Star Fox

The agreement was such that Nintendo would make all game design decisions while financing Argonaut Games to produce not only the hardware but also the 3D engine for the title. Jez-san lost no time hiring and contracting the best UK talent he knew.

For the hardware he contacted Flare Technology (the same people who designed the Atari Jaguar). Ben Cheese, Rob Macaulay, and James Hakewill’s project was codenamed Mathematical Argonaut Rotation I/O, or "MARIO". What they ended up designing was so powerful they jokingly labeled the Super NES "just a box to hold the chip". Since there was no way to modify the console, the chip was soldered onto each new game cartridge which increased MSRP significantly.

"We designed the Super FX chip in a way no one had designed hardware before - we built the software first, and designed our own instruction set to run our software as optimally as possible. No one did it that way around! Instead of designing a 3D chip, we actually designed a full RISC microprocessor that had math and pixel rendering functions, and the rest was run in software. It was the world’s first Graphics Processing Unit, and we have the patents to prove it." - Jez San

For the engine, Carl Graham and Pete Warnes worked in the London headquarters while Dylan Cuthbert, Krister Wombell and Giles Goddard (plus later Colin Reed) permanently relocated to Kyoto in Nintendo’s offices to work in close collaboration with Miyamoto’s team.

The project resulted in a critical, commercial, and engineering success. Star Fox shipped on February 21, 1993 and went on to sell four million copies worldwide

The rest of this idyllic story between the two companies is bitter. Star Fox 2, the sequel to their mega-hit, was completed by Argonauts and set to release in 1996 when Nintendo canceled it abruptly, fearing its impact on the launch of the Nintendo 64. Argonaut was not pleased and the relationship with Nintendo soured. Nintendo subsequently poached Goddard and Wombell. Dylan Cuthbert would have joined too, but he was prevented from doing so by a non-compete clause in his contract. He quit his position at Argonaut and joined Sony to work on the PlayStation.

The divorce was finalized when Nintendo refused to let Argonaut use Yoshi for a platform game they were planning for the PS1. They ended up replacing Yoshi with a crocodile in Croc: Legend of the Gobbos. Nintendo later released Mario 64 with a mechanism seemingly inspired by Croc...and even beat it to market by around a year.

The MARIO chip had a simple design based on a 16-bit RISC processor running at 10.74 MHz with a 512 byte i-cache. It had its own instruction set optimized for math and its own framebuffer optimized for pixel plotting. Its mode of operation was to render to the frame buffer where the data would be periodically transferred to the SNES RAM via DMA. It was reportedly capable of rendering 76,458 polygons/s which meant about 15 fps for Star Fox.

Upon witnessing Star Fox’s phenomenal success, other studios became interested in the technology. The chip was revised to be able to run at 21.4 Mhz and it was renamed "GSU"13. The first generation of GSUs powered four games: Dirt Racer, Dirt Trax FX, Stunt Race FX, and Vortex.

The second generation (GSU-2) was the same processor running at 21.4 Mhz with extra pins soldered to the bus to increase the size of supported ROM and framebuffer. It was used in three games: DOOM, Super Mario World 2: Yoshi’s Island, and Winter Gold.

Opening a DOOM game cartridge reveals all the components previously discussed: 

[1] The 16-bit GSU-2, the [2] 512 KiB framebuffer where the GSU writes, [3] 2MiB ROM where code and assets are stored, [4] hex inverter, and the [5] copy protection CIC chip.

"The ’ten times’ figure was a complete over-promise on my part. We didn’t really know if that was even possible. But it allowed us to over-promise and yet also over-deliver. Instead of achieving just 10x the 3D graphics performance, we actually made things about 40x times faster. In some areas - like 3D math - it was more like a 100x faster. It was not only capable of 3D math and vector graphics, but it was also able to do sprite rotation and scaling - something that Nintendo really wanted for their own games, like Super Mario World 2: Yoshi’s Island." - Jez San

Trivia: Some passionate fans have managed to collect all 791 games from the SNES catalog. Seeing them on a shelf is impressive. You can usually spot a DOOM cartridge from 20 feet away. Only three games were ever allowed not to be made in the standard gray. Two were red – DOOM and Maximum Carnage – while Killer Instinct was black.

Doom On Super Nintendo

DOOM on SNES happened thanks to the genius and determination of a single man: Randy Linden. The man had an admiration for the game and decided to port it to a mass-market machine so more players could enjoy it. Randy never had access to the source code or the assets from either the PC or the console version. He started from nothing.

To retrieve the assets, he was able to leverage the "Unofficial Doom Specs" by Matthew Fell which explained the .wad lump layout in detail. The sprites, textures, music, sound effects and maps were extracted from DOOM.WAD. The engine was an entirely different story.

DOOM was a truly ground-breaking title and I wanted to make it possible for gamers without a PC to play the game, too. DOOM on the SNES was another one of those programming challenges that I knew could be accomplished.

I started the project independently and demo’d it to Sculptured Software when I had a fully operational prototype running. A bunch of people at Sculptured helped complete the game so it could be released in time for the holidays.

The development was challenging for a few reasons, notably there were no development systems for the SuperFX chip at the time. I wrote a complete set of tools - assembler, linker and debugger - before I could even start on the game itself.

The development hardware was a hacked-up Star Fox  cartridge (because it included the SuperFX chip) and a modified pair of game controllers that were plugged into both SNES ports and connected to the Amiga's parllel port. A serial protocol was used to communicate between the two for downloading code, setting breakpoints, inspecting memory, etc.

I wish there could have been more levels but unfortunately the game used the largest capacity ROM available and filled it almost completely. I vaguely recall there were roughly 16 bytes free, so there wasn't any more space available anyway! However, I did manage to include support for the Super Scope, mouse, and XBand modem! Yes, you could actually play against someone online!"

- Randy Linden, in conversation with Gaming Reinvented

What is remarkable with this version is how Randy, with his engine capabilities and restrictions, had to cut different corners to other console ports.

In figure 6.8 [embedded above], despite having only 600 KiB RAM, see how the blue flooring remained (although as a plain color). Notice how the geometry was not altered (it would have been extremely difficult since Randy had no access to DoomED or doombsp), E1M1’s starting room has all its original steps (compare with the PC on page 223 and the Jaguar on page 305 [in the full book]).

The Reality engine, as Randy named it, was able to deal with PC map geometry but must have had issues with fill rate or texture sampling because ceiling and floor textures were removed altogether.

In the screenshot above we can see the window is not actually fullscreen. This was not an issue exclusive to DOOM since Star FoxStar Fox 2 and all games using the Super FX had to reduce the size of the active area. It was likely due to the SNES’s limited bandwidth which did not permit a DMA transfer for fullscreen rendering.

Out of the native 256x224 resolution, only 216x176 was actually drawn and only 216x144 for the 3D canvas (32 rows for the status bar). With vertical lines duplicated, the Reality Engine was actually rendering at 108x144. Even at this low resolution, the average framerate was around 10 FPS which was a remarkable achievement. The "low" framerate was not enough to discourage players from enjoying DOOM. According to Randy Linden the game sold very well.

On the list of features sacrificed to the holy RAM, sprite resolution was lowered significantly to the point that they were sometimes hard to recognize (contrasting with the player weapon rendered at a higher resolution). Enemy poses were all removed except for the ones facing the player, monster infighting was also removed, there is no sound propagation (monsters are only awoken by visual contact), most SFX were cut and all monsters sound like imps.

Trivia : Nintendo originally forbade blood in SNES games. By the time DOOM came out, ESRB had come into the picture. Given the amount of blood and the pieces of flesh found behind every corner, DOOM SNES understandably received an M rating.

The full text of the "Game Engine Black Book: DOOM" can be found over on Sanglard's website.



Related Jobs

innogames
innogames — Hamburg, Germany
[08.20.19]

Senior Unity Software Developer - God Kings
Red Lens Games, Inc.
Red Lens Games, Inc. — Redmond, Washington, United States
[08.20.19]

Senior Programmer
Daybreak Games
Daybreak Games — Austin, Texas, United States
[08.19.19]

Senior Engine Programmer
Daybreak Games
Daybreak Games — Austin, Texas, United States
[08.19.19]

Senior Server Programmer









Loading Comments

loader image