Sunday 3 September 2023

Hitting the Books: The programming trick that gave us DOOM multiplayer

Since its release in 1993, id Software's DOOM franchise has become one of modern gaming's most easily recognizable IPs. The series has sold more than 10 million copies to date and spawned myriad RPG spinoffs, film adaptations and even a couple tabletop board games. But the first game's debut turned out to be a close thing, id Software cofounder John Romero describes in an excerpt from his new book DOOM GUY: Life in First Person. With a mere month before DOOM was scheduled for release in December 1993, the iD team found itself still polishing and tweaking lead programmer John Carmack's novel peer-to-peer multiplayer architecture, ironing out level designs — at a time when the studio's programmers were also its QA team — and introducing everybody's favorite killer synonym to the gamer lexicon. 

Its the title and author name in Doom font
Abrams Press

Excerpted from DOOM GUY: Life in First Person by John Romero. Copyright © 2023 by John Romero. Published and reprinted by permission of Abrams Press, an imprint of ABRAMS. All rights reserved.


In early October, we were getting close to wrapping up the game, so progress quickened. On October 4, 1993, we issued the DOOM beta press release version, a build of the game we distributed externally to journalists and video game reviewers to allow them to try the game before its release. Concerned about security and leaks, we coded the beta to stop running on DOS systems after October 31, 1993. We still had useless pickups in the game, like the demonic daggers, demon chests, and other unholy items. I decided to get rid of those things because they made no sense to the core of the game and they rewarded the player with a score, which was a holdover from Wolfenstein 3-D. I removed the concept of having lives for the same reason. It was enough to have to start the level over after dying.

There was still one missing piece from the game, and it was a substantial one. We hadn’t done anything about the multiplayer aspect. In modern game development, multiplayer would be a feature factored in from day one, and architected accordingly, in an integrated fashion. Not with DOOM. It was November, and we were releasing in a month.

I brought it up to Carmack. “So when are we going to make multiplayer mode?”

The short answer was that Carmack was ready to take it on. Looking from the outside in, I suspect some might wonder if I wasn’t just more than a bit concerned since we were hoping to ship in 1993. After all, John had never programmed a multiplayer game before. The truth is that I never had a doubt, not for a second. Back in March, Carmack had already done some innovative network programming in DoomEd. He wanted to play around with the distributed objects system in NeXT-STEP, so he added the ability to allow multiple people who were running DoomEd to edit the same level. I could see him drawing lines and placing objects on my screen from his computer. Then, I’d add to his room by making a hallway, and so on.

For multiplayer, Carmack’s plan was to explore peer-to-peer networking. It was the “quick and dirty” solution instead of a client-server model. Instead of one central computer controlling and monitoring all the action between two to four players, each computer would run the game and sync up with the others. Basically, the computers send each other updates at high speed over the local network. The speed of Carmack’s network programming progress was remarkable. He had some excellent books on networking, and fortunately, those books were clearly written and explained the process of using IPX* well. In a few hours, he was communicating between two computers, getting the IPX protocol running so he could send information packets to each computer. I’d worked with him for three years and was used to seeing incredible things on his screen, but this was awe inspiring, even for him. In a matter of hours, he got two PCs talking to each other through a command-line-based tool, which proved he could send information across the network. It was the foundation needed to make the game network-capable. It was great for two players, and good for four, so we capped it at that. We were still on track to deliver on our promise of the most revolutionary game in history before the end of the year.

Carmack called me into his office to tell me he had it working. Both PCs in his office had the game open, and they were syncing up with two characters facing one another. On one PC, Carmack veered his character to the right. On the other monitor, that same character, appearing in third person, moved to the left. It was working!

“Oh my God!” I yelled, throwing in some other choice words to convey my amazement. “That is fucking incredible.”

When I’d first truly visualized the multiplayer experience, I was building E1M7. I was playing the game and imagined seeing two other players firing rockets at each other. At the time, I thought, “This is going to be astonishing. There is nothing like this. This is going to be the most amazing game planet Earth has ever seen.” Now, the moment had finally arrived.

I rushed to my computer and opened the game, connecting to Carmack’s computer.

When his character appeared on screen, I blasted him out of existence, screaming with delight as I knocked “John” out of the game with a loud, booming, bloody rocket blast. It was beyond anything I had ever experienced before and even better than I imagined it could be.

It was the future, and it was on my screen.

“This is fucking awesome!” I yelled. “This is the greatest thing ever!”

I wasn’t kidding. This was the realization of everything we put into the design months earlier. I knew DOOM would be the most revolutionary game in history, but now, it was also the most fun, all-consuming game in history. Now that all the key elements of our original design were in place, it was obvious. DOOM blew away every other game I’d ever played. From that moment on, if I wasn’t playing DOOM or working on DOOM, I was thinking about DOOM.

Kevin, Adrian, and Jay began running the game in multiplayer mode, too, competing to blow away monsters and each other. They were yelling just as much as I did, cheering every execution, groaning when they were killed and had to respawn. I watched them play. I saw the tension in their bodies as they navigated the dark, detailed world we’d created. They were hunters and targets, engaged in a kill-or-be-killed battle, not just with monsters, but with other, real people. Players were competing in real time with other people in a battle to survive. I thought of boxing or an extreme wrestling match, where you go in a cage to fight. This was much more violent, more deadly. It was all simulated, of course, but in the moment, it felt immediate. It was a new gaming experience, and I searched for a way to describe it.

“This is deathmatch,” I said. The team latched onto the name. It instantly articulated the sinister, survival vibe at the heart of DOOM.

In mid-November, we buckled down, getting in the “closing zone,” where you begin finalizing all areas of the game one by one. Now that Carmack had multiplayer networking figured out, we needed to fine-tune the gameplay and functionality, delivering two multiplayer modes—one in which players work together to kill monsters and demons, and the other where players try to kill each other (usually without monsters around). The first mode was called co-op, short for cooperative. The second, of course, was deathmatch.

Another important word needed to be coined. Deathmatch was all about getting the highest kill count in a game to be judged the winner. What would we call each kill? Well, we could call it a kill, but that felt like a less creative solution to me. Why don’t we have our own word? I went to the art room to discuss this with Kevin and Adrian.

“Hey guys, for each kill in a deathmatch we need a word for it that is not ‘kill,’” I said.

Kevin said, “Well, maybe we could use the word ‘frag.’"

“That sounds like a cool word, but what does it mean?” I asked.

“In the Vietnam War,” Kevin explained, “if a sergeant told his fire team to do something horrifically dangerous, instead of agreeing to it, they would throw a fragmentation grenade at the sergeant and call it friendly fire. The explanation was ‘Someone fragged the sarge!’”

“So, in a deathmatch we’re all fragging each other!” I said.

“Exactly."

And that is how “frag” entered the DOOM lexicon. 

The introduction of deathmatch and co-op play profoundly affected the possibility space of gameplay in the levels. Crafting an enjoyable level for single-player mode with lots of tricks and traps was complex enough, but with the addition of multiplayer we had to be aware of other players in the level at the same time, and we had to make sure the single-player-designed level was fun to play in these new modes. Our levels were doing triple duty, and we had little time to test every possible situation, so we needed some simple rules to ensure quality. Since multiplayer gameplay was coming in quickly near the end of development, I had to define all the gameplay rules for co-op and deathmatch. We then had to modify every game map so that all modes worked in all difficulty levels. These are the rules I came up with quickly to help guide level quality:

  • Multiplayer Rule 1: A player should not be able to get stuck in an area without the possibility of respawning.

  • Multiplayer Rule 2: Multiple players (deathmatch or co-op mode) require more items; place extra health, ammo, and powerups.

  • Multiplayer Rule 3: Try to evenly balance weapon locations in deathmatch.

  • Multiplayer Rule 4: In deathmatch mode, try to place all the weapons in the level regardless of which level you’re in.

Additionally, we had to make all the final elements for the game: the intermissions and various menus had to be designed, drawn, and coded; the installation files needed to be created, along with the text instruction files, too. We also had to write code to allow gamers to play these multiplayer modes over their modems, since that was the hardware many people had in 1993. Compared to our previous games, the development pace on DOOM had been relatively relaxed, but in November our to-do list was crowded. Fortunately, everything fell into place. The last job for everyone was to stress-test DOOM.

Preparing for release, we knew we needed someone to handle our customer support, so earlier in the year, we’d hired Shawn Green, who quit his job at Apogee to join us. Throughout development, at every new twist and turn, we kept Shawn up to date. He had to know the game inside out to assist gamers should any issues arise. Shawn also helped us by testing the game as it went through production.

I noted earlier that id Software never had a Quality Assurance team to test our releases. For three years, John, Tom, and I doubled as the id QA team. We played our games on our PCs, pounding multiple keys, literally banging on keyboards to see if our assaults could affect the game. On the verge of release, and with more people than ever before in the office, we spent thirty hours playing DOOM in every way we could think of—switching modes, hitting commands—running the game on every level in every game mode we had, using every option we added to the game to see if there were any glitches.

Things were looking good. We decided to run one last “burn-in” test, a classic test for games where the developers turn the game on and let it run overnight. We ran DOOM on every machine in the office. The plan was to let it run for hours to see if anything bad happened. After about two hours of being idle, the game froze on a couple screens. The computers seemed to be okay—if you hit “escape” the menu came up—but the game stopped running.

We hadn’t seen a bug like this during development, but Carmack was on the case. He was thinking and not saying a word, evidently poring over the invisible engine map in his head. Ten minutes passed before he figured it out. He concluded that we were using the timing chip in the PC to track the refresh of the screen and process sound, but we weren’t clearing the timing chip counter when the game started, which was causing the glitch. Ironically, this logic had been part of the engine from day one, so it was surprising we hadn’t noticed it before.

He sat down at his computer, fixed the bug, and made a new build of the game. We put the update on all the machines and held our breath for the next two hours.

Problem solved.

That was the last hurdle. We were ready to launch. That day, December 10, would be DOOM Day.

***

* IPX is an acronym for Internetwork Packet Exchange. In sum, it is a way in which computers can talk to one another.

This article originally appeared on Engadget at https://ift.tt/WRUvk5S

from Engadget is a web magazine with obsessive daily coverage of everything new in gadgets and consumer electronics https://ift.tt/WRUvk5S

No comments:

Post a Comment