The Wayback Machine - https://web.archive.org/web/20081123045145/http://www.byte.com/art/9512/sec10/art1.htm
��Archives
��Special
��About Us

Newsletter
Free E-mail Newsletter from BYTE.com

����
Visit the home page Browse the four-year online archive Download platform-neutral CPU/FPU benchmarks Find information for advertisers, authors, vendors, subscribers Request free information on products written about or advertised in BYTE Submit a press release, or scan recent announcements Talk with BYTE's staff and readers about products and technologies

Articles3-D Action


December 1995 / Special Report / 3-D Action

Today's hot first-person 3-D shoot-'em-ups

Rex Baldazo

It's 1980, and you're playing Atari Battlezone. Looking through your computer's monitor, you track down and destroy enemy tanks and flying saucers. The landscape is a sickly green color, and you keep running into pyramid- and box-shape roadblocks. The little red status bar at the top of the screen doesn't change: It's a clear red strip taped inside the CRT. And those beeps and buzzes are actually the sound track.

Cut to 1995. You're playing LucasArts' Dark Forces or maybe Bungie's Marathon. These are the new breed of games. Like Battlezone, they're first-person 3-D games . But in the 15 years that have elapsed since Atari's venture, things have changed a little. Instead of simple vector graphics , these games employ texture-mapped scenery. They handle thousands of colors with ease. Their professionally scored sound tracks employ up to 16 MIDI instruments, digital explosions, and speech. And instead of requiring a special-purpose arcade machine, these modern marvels run on a home computer costing less than $1500.

The Force Is with You

Dark Forces takes place in the Star Wars universe created by George Lucas. The story is straightforward: You are Kyle Katarn, a mercenary hired by the Rebellion to find and help defeat the Empire's newest warriors, the Dark Troopers. Along the way, you must battle your way through 14 levels populated with Imperial forces bent on your destruction.

Games such as id Software's Castle Wolfenstein and Doom were the early masters of this genre, and Dark Forces represents a natural evolution -- so natural, in fact, that we were surprised to learn that the LucasArts team that programmed the core game engine had never worked on a 3-D game before -- not even such earlie r LucasArts games as X-Wing or Rebel Assault.

Under project leader Daron Stinnett, the Dark Forces design team undertook a type of clean-room approach, experimenting with and mastering the techniques required in 3-D action games without taking much from other LucasArts products. They did, however, take key components from previous LucasArts games, such as the iMuse music engine and the Landru cut-scene engine, but the majority of the engine is unique to Dark Forces.

This engine, appropriately code-named Jedi, spends over 50 percent of its time blasting textures onto the wall, floor, and ceiling surfaces of the game's various levels. Some textures are as large as 256 pixels square -- thus, the engine must smoothly render a 32-KB block of memory at 30 frames per second as you move around through 64,000 possible angles of rotation.

But to be able to blast these textures at 30 fps, the developers had to make some compromises. Unlike the X-Wing and Rebel Assault engines, Jedi does not allow curve d or sloping surfaces. And with the exception of Kyle Katarn's spaceship, which appears in only a few scenes, there are no 3-D objects other than the walls, ceilings, and floors. Objects such as enemy soldiers are simply bit maps that the engine rescales as you approach or retreat.

The developers created the objects as 3-D models and then rendered them into bit maps from various angles. They did most of them in 45-degree intervals, which requires eight views to represent an object. The Jedi engine can support up to 32 angles for each object. The additional angles make the object's rotation appear to be smoother but at the cost of requiring more bit maps and thus more room on the CD and in memory.

Objects such as shields and keys don't even bother with the pretense of 3-D. The engine renders them as the same bit map no matter how you move. Clever use of these components -- textured surfaces, bit-mapped objects with different angled views, and bit-mapped objects with one view -- lets the designers p resent the marvelously real illusion of a 3-D world.

Despite a lack of 3-D-game programming experience, the developers were able to create the core Jedi engine in less than two staff-years of coding. Of course, developing the music, graphics, and general game play took another 30 staff-years.

One of their key concerns during the development of Jedi was portability. The original Dark Forces was targeted to DOS-based machines with a 486 or Pentium microprocessor. The team coded in ANSI C, avoiding any compiler-specific features.

Programmers writing high-performance software generally write the code in C and compile it. They profile the result to look for bottlenecks. The first step to eliminate bottlenecks is to implement the algorithms more efficiently. Developers may be tempted to hand-optimize the code to get additional performance.

The Dark Forces team did that before backing out and returning to the original C in most instances. They found that a Pentium-aware compiler was far more capable than a human at reordering instructions to keep the Pentium busy. And according to Stinnett, these optimizations had no effect on 486 performance. Of course, those who try to run Dark Forces on a 386 will pay a performance penalty. The Pentium-ordered code will be significantly slower than if it had been optimized for the 386.

Power to the Mac

Translating the Jedi engine for the Mac presented several challenges. One of the more difficult was a self-imposed limit. The PC version of Dark Forces requires 8 MB of RAM, and LucasArts wanted the Mac version to have the same requirement. The challenge is that on an 8-MB PC running DOS, an extended-memory application such as Dark Forces has about 7.5 MB to play with. But because the Mac OS has to run a GUI, much less memory is available, depending on what extensions are installed. After examining some Mac setups, the team decided that an 8-MB Mac could reasonably be expected to have 4.5 MB free, so that was their target.

Aaron Giles, the lone Mac developer on the Dark Forces team, says that the temptation for Mac programmers is to "load everything into memory." But that would not work here. Therefore, one of his main programming challenges was to efficiently manage swapping components of the game in and out of memory.

Because LucasArts had invested much more effort in the game content than in the game engine, the goal was to bring that content essentially unchanged from the PC. That forced the game to take another memory hit, because the team had to add a MIDI module to the Mac version that could support the same instruments and mixing capabilities as the PC -- eating up about 400 KB of the ever-shrinking memory. To keep this memory hit to a minimum, the game loads only the instruments it needs at any particular point in the game.

To satisfy the demanding Mac crowd, the developers implemented Dark Forces in 640- by 480-pixel graphics rather than the PC version's 320 by 200 pixels. In essence, the Power Mac is being asked to move five times as much data through the microprocessor and still play as smoothly as a Pentium. And it can do this.

Running a Marathon

Marathon, from Bungie Software Products, is available only for the Mac. It is a network-playable game that can run on a 68020, though a 68040 is recommended, and a native Power Mac version exists. The scenario is similar to Doom -- you are on a space station inhabited by beasts who enjoy shooting at you. Like Doom, and unlike Dark Forces, Marathon provides multiplayer network support (see the sidebar "A Real Opponent" ).

Even though Marathon is a Mac-only game, Bungie went to the same lengths as LucasArts by writing the game in portable ANSI C. The company has successfully run the code through numerous Mac compilers, such as Metrowerks and MPW C. It has also compiled on a number of unspecified non-Mac compilers. The effort has proven so successful that Bungie is considering licensing its core game engine.

Un like LucasArts, Bungie chose to use the Mac's native sound support rather than develop its own. Sound effects can play on any Mac, but playing background music requires the use of QuickTime 2.0. Bungie developed software to create what it calls active-panning stereo sound. As the orientation of the player relative to the sound source changes, the sound levels in the speakers change accordingly, getting louder in one ear and softer in the other. Marathon 2 will take full advantage of it.

Texture-mapping surfaces was as much of a performance challenge for Bungie as it was for LucasArts. According to Doug Zartman, director of public relations at Bungie, texture-mapping floors and ceilings is especially difficult. In fact, for 680x0 Macs, the floor/ceiling texture mapping can be turned off in Marathon, resulting in a significant speedup.

Because you can install the game on a hard drive (Dark Forces runs the main executable file from the hard drive but leaves most of the game on the CD-ROM), you can ch ange the way components operate. Just as with Doom, third-party editors allow you to customize every level and creature in the game. But unique to Marathon is the physics model, which lets the characteristics of the game be changed. For example, you can edit the physics model so that the recoil from your weapon will send you flying.

Cheats are common to many games. These let you get weapons and lives without earning them or reach certain levels without having to fight your way through aliens. But the only "cheats" in Marathon involve changing the physics model.

End Game

Game developers are a tight-lipped cabal. At least one company, id Software (the maker of Doom), makes it a policy not to talk to the press. Interplay (Descent) and Apogee (Rise of the Triad) didn't even bother to return repeated fax, voice, and E-mail messages. Nobody wants to give another company a competitive advantage.

The two companies we did talk to were always careful with how far they would go in revealing their secrets. We did manage to get Bungie's Jason Jones to admit there is actually one cheat in Marathon. But we had to promise not to tell.

One thing is clear: The next generation of games will be pushing the envelope harder and further. Bungie's Marathon 2 will feature improved graphics and a more- realistic sound environment. The next major game from LucasArts, Rebel Assault 2, will have cut scenes featuring real actors and will let you fly the fabled Millennium Falcon.

The adventure has only just begun.


PRODUCT INFORMATION


ATARI BATTLEZONE (part of Microsoft Arcade)........$40

Microsoft Corp.
Redmond, WA
(800) 426-9400
(206) 882-8080
fax: (206) 936-7329

http://www.microsoft.com




DARK FORCES........................................$60

LucasArts Entertainment Co.
San Rafael, CA

(800) 782-7927
(415) 721-3300
fax: (415) 721-3344



MARATHON...........................................$70

Bungie Software Products Corp.
Chicago, IL
(312) 563-6200
fax: (312) 563-0545


The Future of Eyeglasses

photo_link (58 Kbytes)

Virtual i-O's i-glasses ($799) are a relatively inexpensive way to add some realism to 3-D games that support stereo headsets (e.g., Descent). (Virtual i-O, Seattle, WA; (206) 382-7410)


Hot 3-D Shoot-'Em-Ups

screen_link (90 Kbytes)


Most Valuable Tools

screen_link (52 Kbytes)

DARK FORCES
-- AutoCAD: Used to create levels

MARATHON
-- Metrowerks and MPW C: Used to compile ANSI C
-- Adobe Photoshop: Used to create graphics
-- Sound Edit Pro: Used to edit sounds


Rex Baldazo is a technical editor for BYTE. You can contact him on the Internet or BIX at [email protected] .

Up to the Special Report section contentsGo to next article: A Real OpponentSearchSend a comment on this articleSubscribe to BYTE or BYTE on CD-ROM��
Flexible C++
Matthew Wilson
My approach to software engineering is far more pragmatic than it is theoretical--and no language better exemplifies this than C++.

more...

BYTE Digest

BYTE Digest editors every month analyze and evaluate the best articles from Information Week, EE Times, Dr. Dobb's Journal, Network Computing, Sys Admin, and dozens of other CMP publications—bringing you critical news and information about wireless communication, computer security, software development, embedded systems, and more!

Find out more

BYTE.com Store

BYTE CD-ROM
NOW, on one CD-ROM, you can instantly access more than 8 years of BYTE.
The Best of BYTE Volume 1: Programming Languages
The Best of BYTE
Volume 1: Programming Languages
In this issue of Best of BYTE, we bring together some of the leading programming language designers and implementors...

Copyright � 2005 CMP Media LLC, Privacy Policy, Your California Privacy rights, Terms of Service
Site comments: [email protected]
SDMG Web Sites: BYTE.com, C/C++ Users Journal, Dr. Dobb's Journal, MSDN Magazine, New Architect, SD Expo, SD Magazine, Sys Admin, The Perl Journal, UnixReview.com, Windows Developer Network