FEBURARY/MARCH 1997

GAME DEVELOPER MAGAZINE GGAMEAEM GAME PLAN

MMX Germinates Pod Editor Alex Dunne hile some debate continues were very surprising. That was one of the [email protected] as to the significance of good surprises of MMX.” Managing Editor Tor Berg MMX technology for Helias said that while the Ubi Soft [email protected] today’s game developers, sound team immediately profited from Editorial Assistant Chris Minnick there is at least one compa- the new instructions, the team members [email protected] ny which capitalized on the who created POD’s 3D engine found that Contributing Editors Larry O’Brien MMX launch hype, that getting it to work with MMX was a [email protected] being Paris-headquartered longer process, since the project (and Chris Hecker WUbi Soft. Ubi Soft’s latest game, POD, much of the 3D engine design) started six [email protected] puts you behind the wheel of a customiz- months before Ubi Soft had any specifics David Sieks able race car on a closed track. While on implementing MMX technology. [email protected] that’s not exactly an earth-shattering What advice does Helias give to Web Site Manager Phil Keppeler concept, the game offers good playability developers beginning a project using [email protected] and great graphics and Dolby surround MMX? “You have to change the way you Cover Art sound thanks to MMX, and Intel held it program,” he said. “Include MMX tech- Vector Graphics up at their launch event in San Francisco nology in your structures and algorithms Publisher/Group Director as a model of MMX capabilities. Behind from the start.” KoAnn Vikoren Associate Publisher every game, there’s a story waiting to be Information on POD and a told by the developers, and Bertrand version of the game (two are available, one Cindy Blair (415) 905-2210 Helias, the lead programmer on the POD that’s optimized for MMX and one that’s [email protected] project, explained what it was like work- not) are on the Ubi Soft web site: http:// Western Regional Sales Manager ing with the new MMX instruction set. www.ubisoft.com/usgames/pod2.html. Tony Andrade (415) 905-2156 Helias told me that POD was devel- [email protected] oped by a team of 14 programmers, 5 of Interplay Saves whom worked directly on the MMX World, Buys Dodgers Marketing Manager Susan McDonald portions of the project. The team used I recently received a couple of press releas- Marketing Graphic Designer Azriel Hayes Watcom C/C++ for most of the project, es from Interplay that definitely didn’t fol- Advertising Production Coordinator Denise Temple and, when developing the assembly mod- low conventional PR guidelines. In the Director of Production ule, they dropped into Microsoft Macro first release, Interplay’s CEO Brian Fargo Andrew A. Mickus Assembler (MASM). Helias said that announced that he would be offering mili- Vice President/Circulation Jerry M. Okabe approximately 10-15% of the total POD tary strategists in the Pentagon free copies Group Circulation Manager Mike Poplardo code was rewritten for the MMX chip — of its just released game M.A.X: MECHA- Assistant Circulation Manager Jamai Deuberry NIZED SSAULT XPLORATION about what Intel has said developers A & E to off- Subscription Marketing Manager Melina Kaplanis should expect for an MMX optimization. set government budget cutbacks. Fargo Newsstand Manager Eric Alekman I asked Helias what surprised him was quoted saying “If we are to be ready to about working with MMX. “My first deal with all threats, both terrestrial and Reprints Stella Valdez (916) 729-3633 thought,” Helias explained, “was that it extraterrestrial, the Pentagon’s long-range would be very interesting: 57 new planning must have access to every Chairman/CEO Marshall W. Freeman instructions using 64-bit registers. Ouah! resource without the restrictions of bud- President/COO Donald A. Pazour But after we began to use it, we expected get.” Yeah. In a second release, Fargo Senior Vice President/CFO Warren “Andy” Ambrose other instructions. For example, there is implored 10,000,000 Dodger fans to each Senior Vice Presidents David Nussbaum, Darrell no instruction to transfer a 64-bit MMX purchase a copy of Interplay’s VR BASE- Denny, Ted Bahr, Wini D. Ragus, Regina Ridley register in two 32-bit Pentium registers. BALL ‘97 so that the company could make Vice President/Production Andrew A. Mickus And there are some limitations when you a bid on the Los Angeles Dodgers. Now, I pass from an MMX module to a float can buy the need to beef up our extrater- Vice President/Circulation Jerry Okabe one. But for sound, the MMX is espe- restrial defenses. But c’mon. There’s not Senior Vice President/ cially interesting. Our sound program- 10,000,000 Dodger fans in the universe. ■ Software Development Division Regina Starr Ridley mers quickly found new opportunities Alex Dunne Miller Freeman with the new instructions and the results Editor A United News & Media publication

4 GAME DEVELOPER • MARCH 1997 http://www.gdmag.com/ SEZ U!

BETTER OFF WITH TALISMAN? depth buffer. And to simulate some, but not and C++, and there is no question which one Dear Editor: all, three-dimensional motion effects, Talis- is easier to implement. n the beginning was the sprite. And the man lets the game developer distort the dis- If you're a Developer, I can't see game developer saw that it was good, for it play of the sprite using affine transformations. any reason why you wouldn't want to give Del- Iwas a computationally efficient way of rep- But fundamentally, the three-dimensional phi a try. I've been using the RingZero GDK 1.1 resenting moving objects on the screen. world must still be represented by two-dimen- from SAGE Inc. for about six months now, and Alas, the sprite also had deficiencies, for to sional sprites and is again held captive by the I'm very pleased with the performance. You display a three-dimensional scene with sprites many limitations that they impose. can find MegaRoids 3D, one of my Delphi/ required that the sprites be sorted and dis- Is the game developer better off with Talis- DirectX demos, on their web site. played in depth order. Also, since sprites are man? Does Talisman truly save the game I'm also glad to see some other DirectX compo- inherently two-dimensional images, scenes developer? Maybe. Maybe not. You decide. But nents on the market. Looks like Delphi may that require interaction between concave or be forewarned — there is no free lunch. have a future in game development. interpenetrating objects might not be able to Anonymous Dave Scarbrough be drawn using sprites. However, if the game Via e-mail Via e-mail developer was able to design the game to bypass the limitations of the sprite, highly SEEKING STOUT’S SOURCE PROBLEMS WITH interactive games could be written — even on Dear Editor: GD CODE ARCHIVES relatively slow computers. enjoyed Bryan Stout's article "Smart Move: Dear Editor: Thus the sprite begat the depth buffer, which Path-Finding" (October/November 1996). I have every issue of Game Developer, and overcame the limitations of the sprite by Iespecially liked the PathDemo program. I I've been very content with the quality of recording depth at each pixel on the screen. would like to know if you can send me the Ithe articles. I have been disappointed with The depth buffer is truly a robust device for source code, as I would like to slightly modify the lack of quality control within the source displaying all kinds of three-dimensional it for a project I am working on. code listings, however. There have been miss- scenes. But the game developer despaired at Stephen Hadley ing files in code archives, often there aren't the added computational cost that the depth Via e-mail instructions on how to compile them. Problems buffer entailed, since it required a depth com- like these make readers doubt your ability to parison at each pixel. Fortunately, the hard- Bryan Stout replies: deliver quality information, and these days ware vendors of the world came to the rescue I'm not sure this program is the best way for using the , just one discontented read- of the game developer by accelerating the you to see artificial intelligence implemented. er can electronically inform thousands of pos- functions of the depth buffer in hardware and This — and all the other algorithms I used— sible subscribers to not purchase a magazine. relieving the game developer of the need to are sliced into bits distributed here and there to Ravi Singh write fast, slick rendering code. Thus, the allow the search to be paused and resumed and Via e-mail game developer could concentrate on produc- parameters to be changed midstream. A good ing superior game play instead. And the game place to research AI is Steve Woodcock's game Alex Dunne replies: developer saw that the depth buffer was good, AI web site: http://www.cris.com/~swoodcoc/ You are correct to feel this way. We make every even better than the sprite. ai.html. There, he has pointers to code imple- effort to ensure that source code archives are Then, from on high in Redmond, sprang forth mentations of AI. complete, but sometimes code samples are Talisman to save the game developer. Talis- delivered to us late, or we accidentally omit a man combines depth buffers with sprites and DOIN’ IT WITH DELPHI file from the archives. However, any questions throws in affine transformations for good mea- Dear Editor: or concerns about code printed in the maga- sure. The game developer must still manage hanks for "Delphi Does DirectX" (October/ zine or included in our archives can be sprites and all of the limitations that they November 1996). I'm glad to see I'm not addressed to the edit staff here at Game imply. However, the game developer can now T the only one developing games under Developer ([email protected]), and we'll follow accelerate the creation of sprites with the Delphi. I've used DirectX under both Delphi up with the authors to resolve the situation.

http://www.gdmag.com GAME DEVELOPER • MARCH 1997 7 BIT BLASTS

By Tor Berg

memorate it’s new strategic relation- tioning, spatial enhancement, DVD In This Issue… ship with Mental Images GmbH, the audio decoding, wavetable synthesis, and In early January, at a reverently subdued maker of the Mental Ray rendering Sound Blaster-compatible music synthe- unveiling in a small converted ware- environment, Softimage is offering a sis. It supports both DirectSound and house in downtown San Francisco, Intel free additional Mental Ray license to Dolby AC-3 standards. introduced the Pentium processor with licensees of Softimage Extreme and a ■ EuPhonics Inc. MMX technology. How exactly MMX 50% reduction on the unit price per (303) 938-8448 will benefit game development remains CPU of Mental Ray. http://www.EuPhonics.com hotly debated. Writer John Brothers ■ Softimage chimes in with a level-headed evaluation (800) 576-3846 For a Short Time Only on page 20 of this issue (“The Impact of (818) 365-1359 For Macromedia Director and http://www.softimage.com MMX and AGP on Graphics and Director Multimedia Studio owners, Video”). mFactory Inc. is offering its mTrop- Briefly, the MMX-enabled Tools and Talent olis 1.1 multimedia authoring tool as processor will be offered at 166 and Also on the tool front, Alias|Wavefront a complementary upgrade. Regis- 200 MHz for desktop systems and is shipping PowerAnimator 8.0, the tered Director owners can get 150 and 166MHz for mobiles. Most latest upgrade of its 3D modeling, ren- mTropolis 1.1. for $495 through of the obvious PC manufacturers — dering, and animation package. The March 31, 1997. including IBM, Acer, Gateway 2000, new version includes some features mTropolis is an object-oriented HP, Compaq, Dell and others — have specifically created for game developers. authoring tool with drag-and-drop already shipped MMX-enabled sys- A new translator can export data to functionality. It supports playback of tems. Look for the rainbow-colored format. The polygonal tool- QuickTime and PICS animation files MMX “hat” on the “Intel Inside” box has been enhanced and expanded. created in Director, as well as AIFF, logo. And Metacycle, PowerAnimator’s QuickTime, and WAV sound formats MMX requires that software be character animation system, has been created in SoundEdit and Deck II. optimized for the new instruction set. augmented with Cycle Smoother, a ■ mFactory Inc. And already many ISVs have released tool for creating seamless animation (888) 622-8669 MMX versions of their software. cycles by smoothing the start and end http://www.mfactory.com These include not only consumer frames of a motion sequence, and applications — cool games — but also Dynamics Engine, which can add Get Some Heat tools from manufacturers such as dynamic properties to specific parts of a Online enthusiasts can check out a new Macromedia, Adobe, Microsoft, character. browser tool — for free. Newfire Inc. QSound and others. Again, look for PowerAnimator 8.0 starts at has unveiled Heat, which it calls a the rainbow-colored hat. $9,995. Upgrades are free to existing “game-speed 3D player” for the Inter- ■ Intel Corp. customers on maintenance. net. Heat, based on Java and VRML http://mmx.com ■ Alias|Wavefront 2.0 standards, will be available as a (800) 447-2542 Netscape Navigator plug-in, and is Softimage Special (416) 362-9181 appropriate for demoing and playing http://www.aw.sgi.com/ Also in this issue, Dave Sieks reviews games through a web browser. Newfire Softimage 3.5.1 (“Getting Soft,” p. will make it available in March at its 42). For those interested in the Sounds Good web site. extended package, Softimage Extreme, On the audio side, EuPhonics Inc. ■ Newfire Inc. there is a special promotion in effect has a new audio hardware toolkit. (408) 996-3100 through March 31, 1997. To com- SoundSuite includes full 3D audio posi- http://www.newfire.com

8 GAME DEVELOPER • MARCH 1997 http://www.gdmag.com By Ben Sawyer

A View from Sega Must Focus pointing numbers may be that con- the Retail Trenches Sega’s excellent “three-pack” promotion sumers are holding out for Intel’s The sales numbers from the holidays are (in which the company gave away copies recently launched MMX line of proces- being watched closely. According to Joe of Virtua Fighter 2, Daytona USA, and sors. PC Data numbers for December Catuadella, owner of the New York- Virtua Cop with every Saturn purchase) showed that the venerable Myst had the based retailer Tronix Multimedia, “Sony boosted sales — so much so that Sega is top spot, followed by MICROSOFT did very well right up to the week prior to extending the offer through the end of FLIGHT SIMULATOR, COMMAND & Christmas, Nintendo was unbelievable, March. Unfortunately, this doesn’t help CONQUER: RED ALERT, MADDEN and Sega did much better than expecta- remedy the underlying challenge Sega FOOTBALL ‘97, BARBIE FASHION tions. PC was a disappointment.” Catu- faces, namely to focus on their core DESIGNER, and QUAKE. Many promis- adella says the biggest problem centered game business. Ventures like Net Link ing titles for the PC missed the hot holi- around the number of titles — there (a 28.8 Kbps modem that turns the Sat- day season and are arriving now, such as weren’t enough great titles for the PC urn into a TV-based web browser) and Blizzard’s DIABLO and the upcoming and the Ultra 64. “Aside from West- its new videophone product are stretch- Star Wars games from LucasArts wood’s COMMAND & CONQUER: RED ing the company’s product line and posi- (REBELLION, JEDI KNIGHT, and ALERT [for the PC] and the four avail- tioning at a critical time. Sega took a X-WING VS. TIE FIGHTER). able Nintendo titles, there wasn’t much huge fourth-quarter write-off on unsold to sell.” Interestingly, Catuadella says 16-bit games in its inventory. Deals, Acquisitions, and Sony had too many titles. “The [number] Sega, perhaps sensing a needed Investments of titles that debuted for Sony was over- boost, announced a merger with Bandai. Sega invested $4 million into long-time whelming for many customers, as well as This adds not only a large set of content partner Appaloosa Interactive (formerly myself — many quality Sony titles are and production capability to Sega's Novatrade). Among other games, getting lost in the deluge.” These obser- ranks but also brings Bandai's Pippin. Appaloosa developed ECCO THE DOL- vations seemed to gel with a Nintendo There is speculation that Sega may roll PHIN for Sega. Appaloosa is about to announcement claiming 1.6 million Ultra Pippin technology into Sega's console, begin a big push into web entertainment. 64 units sold, and a Sony announcement in an effort to create a killer set-top- The first effort will be Bonus.com, a col- claiming a worldwide base of nearly nine box/Web-TV/video game machine. lection of sites geared toward children. million units. Despite those upbeat num- Sega's videogame strategy is cer- Ziff-Davis Publishing and Spot bers, though, I see two problems: tainly relying much more on the Web Communications are combining their Sony has to get better control over than its competitors Sony or Nintendo web site efforts. The two will combine PlayStation title development. The flood are. However, this merger also has the efforts to publish one huge game site in of titles can be seen as a powerful potential to distract Sega even more an attempt to dominate the online mar- endorsement of the system, but a crowded from its core console business. If Sega's ket for game information and resources. market can mean some titles that deserve diversification strategy doesn't bear fruit The sites will operate under Spot Media's good exposure and sales might not be get- quickly, this foray into themeparks, the existing operations, Gamespot.com and ting it. There's only so much money and Web and children's toys could implode. Videogamespot.com. Beginning in the time that each consumer has at one On the upside, there is the potential for spring of 1997, however, the sites will instance. Other systems have had big the Sega to morph into a powerful begin incorporating content from Ziff- trouble when their market was flooded entertainment conglomerate, a Japanese Davis’s large stable of game magazines. with titles. Disney of the information age. Ben Sawyer writes gaming industry Nintendo simply needs to get some analysis on a regular basis for Interactive more titles out, in particular another A Slow PC Game Market Update — an industry newsletter. News groundbreaker like MARIO 64. ZELDA According to initial reports, PC sales releases and information can be sent directly 64 could be that title. were sluggish. One reason for the disap- to [email protected].

http://www.gdmag.com GAME DEVELOPER • MARCH 1997 9 BEHIND THE SCREEN

Physics, Part 3: Collision Response

sk anyone who’s experienced Once we’ve detected a collision, the Chris Hecker it before, and they’ll tell you fun physics math starts, as we try to not to get in a car with me decide which directions the objects when I’m driving. For some move in response to the impact. While Once a collision has reason, cars and I just don’t we’re going to restrict our scope to colli- get along very well. Or maybe sions between rigid bodies (so we won’t I should say the front end of be able to model all the crumpling and my car gets along very well buckling that goes on when I run into Aindeed with the rear ends — and various an unsuspecting motorist), we’ll still do additional parts — of other cars. better than you’ve probably seen before. occured between My driving skills notwithstanding, Most current games do simple vector the topic for today is not how to avoid reflections, or maybe even take the collisions (a topic about which I’m objects’ masses into account. However, clearly not qualified to write), but rather in keeping with our goal for this series, “collision response” — what to do once we’re going to do more accurate (and objects, careful we already know there is a collision. interesting) collision response. Our You can probably guess that in the objects will spin and tumble as they col- context of our series on game physics, lide, with heavy objects tossing lighter the term “collision response” doesn’t objects aside, imparting rotation to each refer to calling an ambulance (in con- other when they hit off-center. So, modeling of the trast with the context of my daily com- insurance premiums be damned: Full mute). The term refers to the second speed ahead! half of the collision process in a physical simulator, the first half of which is Impulsive Behavior “collision detection.” While in the real To begin understanding the collision world, the sound of smashing glass is all process, let’s imagine we have two physics involved can the collision detection we need, the objects, labelled A and B, that are about same is not true of our simulator, where to collide at a point P. Coincidentally, we need code to explicitly check our Figure 1 shows these very objects. geometry for collisions. Collision detec- There’s actually a point P on both objects, tion itself is worth a series of columns. so I’ve labeled the vector from the center impart realistic Still, it’s much more a geometric prob- of mass of object A to its point P as rAP, lem than a physical one, so for this col- and likewise with rBP for B. Let’s also umn, we’re going to assume you already denote the velocities of the Ps as vAP have a way to detect collisions (we and vBP. A moment’s thought convinces might return to the collision detection us that even though the Ps will be in the problem in a later column). The physics same exact position at the instant of col- velocities and rotations simulator requires certain information lision (or there wouldn’t be a collision at from the collision detector; we’ll P), their velocities at that instant can be identify this information as we develop quite different — if one object is the collision response formulas and stationary, for example. Given the veloc- summarize the requirements at the end ities of the Ps, we can define their rela- to the objects. of the column. tive velocity as vAB.

http://www.gdmag.com GAME DEVELOPER • MARCH 1997 11 BEHIND THE SCREEN

response. There are many ways to calcu- AB=− AP BP Think about the physics we’ve vvv (Eq. 1) learned so far. Nowhere did velocities, late the impulse’s magnitude and direc- More importantly, if our collision either linear or angular, change instantly. tion, depending on how realistic you detector supplies us with a “normal vec- Both are changed only by forces and want to be. In the interest of space, tor” for the collision (denoted by n, and torques through integration, which by we’re going to go with a relatively sim- pointing toward body A by convention), definition means the velocity changes are ple model, but one that will still give us we can define the “relative normal continuous. In the case of a rigid body the interesting angular collision behav- velocity” as the component of the rela- collision, however, we must change the ior we want. Later in the series, when tive velocity in the direction of the colli- velocities instantaneously. That calls for we’re more comfortable with the mathe- sion normal. a new quantity: the “impulse.” matics, we might try a more complex We shouldn’t feel bad about intro- approximation. vnvvnAB ⋅= ( AP − BP ) ⋅ ducing yet another quantity at this point. The collision model we’ll use is (Eq. 2) After all, it was our idealization of inpen- called “Newton’s Law of Restitution for Choosing a normal vector can be etrable rigid bodies that got us into this Instantaneous Collisions with No Fric- tricky, as we’ll discuss below. But in the discontinuous velocity mess in the first tion.” The easiest part of this model to case of a vertex/edge collision — as in place; it should come as no surprise that understand is the “instantaneous” part. Figure 1 — it’s pretty obvious that the we have to idealize a little more to get The model assumes the collision process normal should be perpendicular to the ourselves out of it. takes no time. Since “no time” is a very edge. Eq. 2 allows us to define the crite- In a real-world collision, a lot of small amount of time, all of our regular rion for a collision: complicated atomic things happen that noncollision forces go away during the A collision occurs when a point we can’t hope to simulate directly. Thus, collision, and only the collision impulses on one body touches a point on in the same way that we’re approximat- are calculated. Thus, noncollision forces another body with a negative ing real-world objects with rigid bodies, such as gravity are not taken into relative normal velocity. we need to approximate the real-world account during the collision, although This statement says Eq. 2 must be collision process with an idealized model. they’re in effect as usual before and after negative at the contact point or there’s no Impulses are part of this model. the collision. collision. Consider the following three An impulse can change velocities Newton’s Law of Restitution intro- cases: If Eq. 2 is greater than 0, then the directly, without waiting — the way a duces yet another new quantity, the points are leaving each other, and we can force must — for integration to do it. “coefficient of restitution” (usually ignore them. If it’s equal to 0, the points You can think of an impulse as a really denoted by an e or an ε, lowercase are neither colliding nor separating — a huge force integrated over a really short epsilon). The coefficient of restitution situation called contact — and we’ll have period of time. The force is so large and models the complicated compression and to deal with that problem in a future col- the amount of time so small that we’re restitution of impacting bodies with a umn. Finally, if Eq. 2 is less than 0, then no longer dealing with an almost infi- single scalar, which relates the contact the points are smashing into each other, nite force over an infinitesimal period of point’s incoming and outgoing relative and we need to do something to stop time, but with a perfectly finite impulse. normal velocities. them from penetrating. That something And, as force changes the momentum AB⋅=−⋅ AB is the collision response. over time (remember F=˙ ), our impulse vnvn21 e (Eq. 3) p The obvious thing to do for colli- changes the momentum sion response is to apply a force to both instantaneously, which in Figure 1. Objects A and B colliding. objects, but that doesn’t actually do the turn changes our velocity job for rigid bodies. A force won’t stop (by the definition of the bodies from interpenetrating because momentum as mass a force can’t instantaneously change a times velocity). We can velocity. That is, a force takes time to calculate and apply im- change a velocity — it can only do so via pulses at the point and BP integration over time, as we learned in instant of collision, and B r previous columns. Yet our objects are these impulses will already touching, so we don’t have any change the bodies’ veloci- P rAP extra time to allow the force to do its ties and prevent them work and counteract the negative relative from interpenetrating. normal velocity. We must change their But how do we cal- n velocities immediately or our objects will culate the impulses to move inside each other. How can we apply? This is the central A affect this discontinous velocity change? problem of collision

12 GAME DEVELOPER • MARCH 1997 http://www.gdmag.com BEHIND THE SCREEN

Eq. 3 uses a subscripted 1 and 2 to indicate the incoming −+(1 e) vnAB ⋅ and outgoing velocities, respectively. The coefficient of restitu- = 1 tion e is a scalar that tells us how much of the incoming energy j  11 is dissipated during the collision. It can range from a totally nn ⋅+   (Eq. 6) AB elastic collision at e=1 (a superball), to a totally plastic collision  MM at e=0 (a lump of clay landing on the floor). Now that we know the impulse magnitude, we can plug it Our collision model makes the final simplifying assump- back into Eqs. 4a and 4b to find the new linear velocities of our tion that there is no friction at the point of collision. Thus, the objects. The collision is resolved! impulse generated by the collision is entirely in the normal Let’s note a few things about Eqs. 4 and 6. First, you should direction n (there’s no tangential impulse at all). We can express notice that n doesn’t have to be a unit-length vector for the colli- the impulse with a single scalar j times the normal, giving us jn. sion response equations to work; the various dot products will Newton’s Third Law of equal and opposite forces says that the cancel out any nonunit magnitude for n without forcing you to impulse felt by A is jn, while the impulse felt by B is simply –jn, explicitly normalize it (thus avoiding normalization’s accompany- the equal and opposite impulse. Now we’re ready to derive the ing square root). Of course, if you know n is unit length, you can collision response equations. avoid some multiplies in the denominator of Eq. 6. The second thing to notice is that these same equations can Hit Me handle a moving rigid body colliding with another rigid body that For starters, we’ll derive the collision response equations for is supposed to stay fixed, such as a building or the ground. To see objects that cannot rotate, then we’ll go all the way and calcu- this, look at what happens when the mass of one of the objects late the angular impact equations, as well. This is going to get a increases: the effect of the impulse on that object decreases. Take bit hairy, so you should probably get a piece of paper. The first this to the limit of infinite mass, and all the mass reciprocals for equations we write relate the incoming and outgoing Center of that object go to 0. Eq. 6 no longer contains the object’s mass, and Mass (CM) velocities under the influence of the (currently it degenerates into the equation for collision with a fixed object. unknown) impulse. Actually, the infinitely massive object doesn’t have to be fixed, as its velocity is still present in Eq. 6. If it is moving, however, it will AA=+j vv2 1 A n brush aside any dynamically simulated object and not feel so much M (Eq. 4a) as a nudge (such an object is called kinematically driven, since it’s ignoring the dynamic quantities of mass, force, and impulse). Finally, if you set A’s mass to 1, set B’s mass to infinity and BB=−j its velocity to 0, make the coefficient of restitution 1, and make vv2 1 n M B (Eq. 4b) n unit length, you might recognize the equation to reflect a vec- tor (vA) about a normal. I was able to write Eqs. 4a and 4b by keeping in mind that the impulse is a change in momentum, and I divided through by Spin Out each object’s mass to convert from a momentum equation to one Now that we’re warmed up, we can derive the complete 2D col- in terms of velocity. Since the objects can’t rotate yet, the veloci- lision response equations, including the terms for angular veloci- ties of the CMs (vA and vB) are the velocities of all the points on ty. To do this, we’ll need to use the equation we learned in the the respective bodies; we can replace vAP with vA in Eq. 1 and last column for calculating the velocity of an arbitrary point on a make a similar exchange for B. Next, we use Eq. 3 to relate the rotating and translating rigid body. incoming and outgoing relative velocities with the coefficient of AP A A AP vv=+ω r⊥ restitution, and substitute in Eq. 1 for the definition of relative 222 (Eq. 7) velocity. Substituting in Eqs. 4a and 4b and distributing the dot I’ve written Eq. 7 for the postcollision velocities using the product, we get subscript 2, but it holds for the precollision velocities as well if you replace the 2s with 1s. Next, in the same way we wrote Eqs. 4a and 4b for the (vvnvvnAB − ) ⋅=− e ( AB − ) ⋅ 22 11 change in linear velocity under the influence of an impulse, we can write equations for the changes in both linear and angular A j B j AB vn ⋅+ nnvn ⋅− ⋅ + nn ⋅=− e v ⋅ n velocities when the impulse is applied. Here, I’ve written the 11A B 1 M M equations for body A: (Eq. 5) j vvAA=+ n We can simplify Eq. 5 by noting that the v terms on the 21M A (Eq. 8a) left-hand side make up the relative normal velocity from Eq. 2 (modified by our assumption that the object can’t rotate). We AP rn⊥ ⋅ j then solve for the scalar j and find (notice all the terms on the ωωAA=+ 21 A (Eq. 8b) right-hand side are known at the time of collision) I

14 GAME DEVELOPER • MARCH 1997 http://www.gdmag.com BEHIND THE SCREEN

Eq. 8a should be familiar from our linear collision example; sion occured, trying to predict ahead of time where the colli- it matches Eq. 4a. Eq. 8b, on the other hand, is the result of sion will occur, or even trying to use the interpenetrating coor- applying the impulse jn at point P on body A. The last term on dinates and hoping it doesn’t look too bad. Also, this discrete the right translates the linear impulse into an angular impulse in collision routine doesn’t catch “tunneling,” where fast moving exactly the same way that we translated linear force into torque objects can move completely through other objects in a single in the last column: using a perp-dot product to the point of integration step. application. Since impulse will change the angular momentum, Once a noninterpenetrating configuration is found, we I’ve divided through by the moment of inertia at the CM to resolve the collision — if present — and update the configura- convert Eq. 8b into an equation in the angular velocities. tion. Then we loop back up to complete the time step and final- Eqs. 8a and 8b together show how the collision impulse ly draw the objects. will affect body A’s precollision velocities. The equations for I’ve glossed over a few things in this presentation, so let’s body B are exactly the same when j is replaced by –j, since the take the remaining space to get out the Bond-O and fill in some impulse is equal and opposite. Our remaining task is to solve for of the holes…. j, and then plug it into Eqs. 8a and 8b (and the counterparts for It should be clear from the collision response equations B) to resolve the collision. that we need to know four pieces of data about a collision: the Solving for j involves the same sort of algebra as in the pre- time of the collision, the objects participating in the collision, vious example. First, start with Eq. 3, replace vAB with the defi- the colliding points on those objects, and the collision normal. nition in Eq. 1, and substitute Eq. 7 for vAP and its twin for vBP. Each of these parameters has some subtleties, and we’ll go into Then, for the unknown postcollision linear and angular veloci- each in turn. ties, substitute in Eqs. 8a and 8b and their B versions. Gather You’ll notice I quoted the word “exact” a few paragraphs the terms, being sure to recognize the expression for the precol- back when refering to the first required piece of data: the colli- lision relative normal velocity (in the same way we brought it sion time. The reason is that there’s really no such thing as the into the numerator in Eq. 6), and solve for j. We end up with exact collision time when you’re working numerically on a computer. We’re forced to use a tolerance value for collision −+ AB ⋅ detection, within which we agree to say we’re colliding (rather (1 e) vn1 j= than interpenetrating or not touching). The sample code 22 AP BP shows this technique.   ( ⊥⊥⋅ ) ( ⋅ ) 11rnrn The next bit of data — the collection of colliding objects — nn ⋅+   + +  MMAB IA IB seems obvious, but note that our current algorithm can only han- dle a single collision between two bodies. A similar limitation (Eq. 9) holds for the third parameter, the collision points. It’s easy to see Once we’ve calculated j, we plug it into Eqs. 8a and 8b that in a 2D collision between convex polygons, you can get an (don’t forget to negate j and plug it into the equivalent equa- edge/edge collision, which means the collision “manifold” — the tions for B), and we’re done with the collision response. The space that represents the parts of the objects that are touching — colliding bodies go flying apart, complete with the correct spin is no longer a point, but a line segment. You can get away with based on their incoming velocities and masses. just using the vertices of the line segment for this kind of colli- sion, but even that is beyond the powers of our current collision A Little Touch Up response routine. It can only handle a single collision point, not Now that you know the collision response equations, let’s see multiple simultaneous collision points. Simultaneous collisions how they fit into our overall simulation loop. Listing 1 shows are much harder and will have to wait for another time. Things the pseudocode for the simulation loop that supports collision get even worse in 3D, where you can get point, edge, and face detection and response from the sample application. I collisions with convex polyhedrons, and collision detection and changed last issue’s step-by-step algorithm to pseudocode response become a nightmare when you get into curved surfaces. because the loop got a bit more complex when it was extended Anyway, the sample application’s collision detector currently to handle collisions. returns only a single collision point, and although we don’t get The root of this new complexity is calculating the “exact” flat-edged bounces (it always looks like one point hits first), it time of collision. Notice we integrate forward by a full time still looks pretty good. step at first, and if there’s interpenetration at the new configu- The collision normal is the final place where ambiguities ration, we subdivide the time interval and try again. The algo- arise. In 2D, on an edge/edge or a vertex/edge collision, the rithm amounts to doing a binary search of the time step look- normal vector is easily obtainable as a vector perpendicular to ing for the time of collision. This is not necessarily the most the edge. However, on a vertex/vertex collision, you need to efficient way to find the collision time, since we throw away all pick a sensible vector to use for the collision normal. The of our previous integration work, but it’s very simple and sample application avoids this problem by treating vertex/ver- robust. Other solutions to this problem include using the pre- tex collisions as vertex/edge collisions, but that can lead to vious integration parameters to help estimate when the colli- unrealistic behavior.

16 GAME DEVELOPER • MARCH 1997 http://www.gdmag.com BEHIND THE SCREEN

The references for this material Listing 1. The Simulation Loop Pseudocode. would just about fill the space of an entire column, so once again, I’m setup initial conditions going to put them on my website at http://ourworld.compuserve.com/homepages/ while(simulating) { DeltaTime = CurrentTime - LastTime checker. The derivations I’ve used here are similar to David Baraff’s equations in his while(LastTime < CurrentTime) { SIGGRAPH tutorial on physically based calculate all forces and torques modeling (it’s in my references). Like compute linear and angular accelerations most results in math and physics, there integrate accelerations and velocities over DeltaTime are a bunch of ways of getting to the same equations, including derivations if(objects are interpenetrating) { based on the laws of conservation of subdivide DeltaTime energy and momentum, and derivations } else { if(objects are colliding) { based on things called “generalized coor- resolve collisions using Eqs. 8 and 9 dinates.” If you study this stuff seriously, } you’ll want to work out the equations in a lot of different ways to make sure you LastTime = LastTime + DeltaTime understand them. The more practice you DeltaTime = CurrentTime - LastTime get, the better mathematician and physi- update positions and velocities cist you’ll become. Now, if only the same } principle held for my driving… ■ } Chris Hecker’s collision response is draw objects in current positions usually to write a large check to some auto- } body shop. Donations are accepted at [email protected].

18 GAME DEVELOPER • MARCH 1997 http://www.gdmag.com MMX AND AGP

The Impact of MMX and AGP on Graphics and Video

he press has devoted a great tiply/accumulate, and compare. MMX up a frame into 16×16-pixel regions, deal of attention to 3D graph- instructions can be paired with each then looks at the same region in one or ics accelerators and higher other and with integer instructions, two reference frames (a previous or speed CPUs lately, especially making it possible to execute two MMX future frame, or both) for the closest to how games benefit from instructions in one cycle. Support for match. This search results in a motion them. This much is true: The these instructions already exists in vector that gives the relative position in basic consumer’s computer is Microsoft Visual C++ 4.1 and the the reference frame of the most similar becoming a much more capa- Microsoft Macro Assembler 6.11, and block. When searching in one-pixel Tble game machine. If you have an Intel- support has been announced for Wat- increments, the absolute differences are based game slated for release a year from com C/C++ 11.0 and the NuMega Soft- computed. This can be done efficiently now, however, you should consider tak- Ice debugger. with the PSUBUSB instruction, which sub- ing advantage two new hardware initia- Several applications will benefit tracts eight 8-bit unsigned numbers and tives: MMX and the Accelerated from MMX instructions, most notably clamps the results to [0:255]. Searching Graphics Port (AGP). those that use DCT-based image- and is also done in half-pixel increments. MMX (not an acronym) is a modi- video-compression/decompression algo- This requires averaging adjacent pixels fication of the Intel Pentium and Pen- rithms like JPEG, MPEG-1, MPEG-2, in the reference block, which can be tium Pro processors that accelerates and H.263. All these algorithms rely on handled with the packed shift and multimedia applications that use video discrete cosine transforms (DCT) to packed add instructions before comput- playback and 3D rendering. MMX- compute a matrix of frequency values ing absolute differences. Although real- enhanced Pentium processors are already from a matrix of color values. The DCT time encoding currently isn’t very in stores. Toward the middle of the year, results are quantized, higher frequencies important in games, it could be in the systems that use the AGP architecture more than lower frequencies, selectively future. Imagine being able to see a video will begin shipping. AGP is a new high- removing some of the relatively unim- feed of your opponent’s grimacing face speed peripheral bus that improves 3D portant high-frequency information. as you shoot him, for instance. texture-mapping quality. Developing This quantization step usually results in In the near term, however, MMX is games that support these two technolo- long sequences of zero values, and the more useful for its ability to accelerate gies will let you significantly improve last step is to use Huffman coding to do decoding. The last stage of decoding certain visual aspects of your title. Let’s the actual compression. The basic idea is interframe-compressed video is motion examine how. to code the most commonly occurring compensation — the counterpart of bit sequences with the shortest bit codes. motion estimation in the encoder. This is MMX Impact on To decompress, the same steps are per- where delta values, decoded in the iDCT Video Performance formed in reverse order. This process is and inverse quantization stages, are Intel’s MMX technology revolves called intraframe compression because it added back to data from the reference around 57 new single-instruction, multi- compresses a fram by itself. frame(s). When the motion vector has a ple-data (SIMD) assembly instructions The JPEG, MPEG-1, MPEG-2, half-pixel component in either or both that operate on eight new 64-bit regis- and H.263 video-compression algo- directions (horizontal and vertical), adja- ters. Each register can be divided into rithms also take advantage of similarities cent pixels must be averaged before the two 32-bit values, four 16-bit values, or between frames to further compress deltas are added. This can be accom- eight 8-bit values, which can be operated video in what’s known as interframe plished, with some loss of precision, by on with special shift, logical, and arith- compression. Normally, over 90% of right-shifting the 8-bit components and metic instructions like AND, NOT, video frames are compressed with inter- then adding the 8-bit results using the OR, XOR, add, subtract, multiply, mul- frame compression. The encoder divides packed shift and packed add instructions.

20 GAME DEVELOPER • MARCH 1997 http://www.gdmag.com By John Brothers But MMX also helps with another MMX-enabled parallelism can help aspect of motion compensation. The when hardware-accelerated rendering is 16-pixel–wide block read from the ref- not available. erence frame(s) isn’t normally aligned to Since the MMX registers and The arrival of MMX and 16-byte boundaries, so the shift and instructions are aliased on the floating- packed logical instructions can be used point instructions and registers, it is to read the data and position it in the prohibitively slow to mix floating-point MMX registers. The parallel add and MMX instructions — on the order instruction can then be used to average of 200 cycles are required to switch components from the reference block between MMX and FPU modes. How- pending release of AGP and add in the delta values. ever, some rendering computations must be done with FPU instructions. To How MMX minimize the hit you incur when Accelerates Rendering switching between MMX and FPU While MMX instructions clearly speed modes, you should process geometry in means a number of up video playback, the technology’s ben- batches. As this has some implications efits to 3D graphics are limited to the for caching data, the size of the batches rendering stage — which is increasingly also needs to be limited. being handled in dedicated hardware To understand how the rendering anyway. Therefore, for systems process is sped up by MMX, let’s exam- changes for game equipped with 3D graphics accelerators, ine how triangles are typically rendered. the MMX instructions are redundant. The input to the triangle-rendering stage The good news is that game developers is three vertices per triangle. In can rely on MMX for much better per- Direct3D, each vertex consists of X, Y, formance on low-end machines (those Z, U, V, and W coordinates specified as systems shipping without hardware- single-precision floating-point numbers, developers. Mastering accelerated 3D). Let’s examine how and red, green, blue, and alpha and fog MMX improves rendering performance. values specified as 8-bit integers. With At the top of the 3D pipeline, conventional rendering algorithms, the geometry is transformed, lit, and clipped slopes of all the components are comput- to a view volume. The result is a list of ed along one triangle edge and in the X- these technologies will 3D triangles, ideally connected into direction across the triangle. Along the strips, fans, or meshes so vertices can be other two triangle edges, ∆X∆Y is com- shared. After the transform stage, each puted. So some amount of floating-point triangle is described with screen coordi- arithmetic (subtracts, multiplies, and nate vertices. Because of the large, four divides) is required before any pixel dynamic range of values involved, trans- values can be computed using integer or offer benefits in image forms, lighting, and clipping need to be MMX instructions. Texture coordinates done with at least single-precision float- are then computed incrementally — ing-point computations (preferably dou- adding the deltas in the direction moved ble). In the rendering stage, however, (∆C∆Y along the triangle edge and integer calculations are sufficient. Here, ∆C∆X along a scan). quality and performance.

http://www.gdmag.com GAME DEVELOPER • MARCH 1997 21 MMX AND AGP

Accurately computing the U and V ing is used, performance significantly Depending on the texture-filtering mode texture coordinates with perspective cor- decreases. On the other hand, simple used, you may experience a couple of rection also requires two divides per pixel, point-sample texturing will be very much undesirable effects: which is very expensive on the CPU (a faster than bilinear filtering — even ● Point-sampling textures (reading one 32-bit integer divide requires 41 cycles on under realistic conditions. texel per pixel generated) results in a Pentium). For this reason, software ren- The bottom line is that MMX blocky triangles; derers generally use methods that avoid instructions raise the baseline 3D perfor- ● Bilinear or trilinear filtering smooths divides to compute approximations of the mance for low-quality (defined as seri- the textures, but results in blurry, perspective-corrected U and V coordi- ously comprimised image quality in washed-out images. nates per pixel. Quadratic interpolation is exchange for higher ) 3D- No matter what filter you use, one of these methods. For large triangles graphics rendering. If hardware is there’s no way to recover the information with little perspective (where the Z coor- already accelerating your 3D, MMX lost in down-sampling. For high-quality dinates do not vary much), this method instructions are redundant. MMX graphics, you should use textures at high works reasonably well. However, where doesn’t accelerate transforms, lighting, or resolution and avoid stretching them. any significant perspective correction is clipping calculations, which current 3D There are a few ways to achieve this. required, this method produces inaccurate accelerators normally leave to the CPU One solution would be to add more results (with the effect that straight lines because of the high-FPU performance frame-buffer memory. Unfortunately, seem to wave during animation). Subdi- there. For video playback, however, this increases the price of the system viding triangles minimizes the problem, MMX instructions make a tremendous (since SGRAM and RAMBUS memory but can also double or quadruple the per- difference. MPEG-2 playback with is more expensive than system memory), triangle computation costs. So, if you rely some degradation should be possible and frame-buffer memory can only be on software (or hardware) that uses qua- without on used for 3D graphics. So this is not a dratic interpolation, you should be pre- 200MHz MMX-enabled processors. great solution for most systems. pared to live with some artifacts. Because Another solution is to use the frame rate is paramount, however, this is The Accelerated frame-buffer memory more efficiently by still the way to go when doing software Graphics Port compressing textures. Many 3D acceler- rendering. The other significant hardware initiative ator manufacturers are adding propri- Quadratic interpolation uses two launched by Intel is AGP (Accelerated etary schemes for compressing textures. deltas per texture coordinate: ∆U∆X, Graphics Port), a peripheral bus standard The Microsoft group working on the ∆∆U∆X, ∆V∆X, ∆∆V∆X. For each pixel, that will be introduced in PCs sometime Talisman initiative has proposed Texture you add ∆U∆X to U and ∆∆U∆X to this summer. This bus will provide a and Rendering Engine Compression ∆U∆X, and the same for V. This makes high-speed dedicated interface between (TREC), a variant of JPEG, as a com- the two divides per pixel unnecessary and system memory and a graphics accelera- pression standard for texture compres- the per-pixel computation much faster. tor, primarily benefiting 3D texture- sion. Unfortunately, TREC has all the As triangles decrease in size, however, mapping applications. One of the biggest disadvantages of JPEG: ringing, color the benefits decrease. The computations problems with dedicated hardware accel- shifting, and blurring. TREC’s biggest per edge and for the whole triangle erators so far has been the limited texture problems, however, are its high imple- become more complex than the conven- storage available — virtually all accelera- mentation costs and the complexity of its tional (two divides per pixel) method. tors read texture data from graphics decoder. While texture compression can The problem is even more severe memory on the card. Nowadays, a typical help, it only partially satisfies a system’s with narrow triangles, since the efficiency $200 graphics adapter has a 4MB frame appetite for texture memory. of the MMX instructions (which operate buffer. However, most of that storage The ultimate solution is to store on multiple pixels at a time) decreases space is taken up by the front and back textures directly in system memory. The because of edge effects. According to buffers, the Z-buffer, and, potentially, current generation of PCI buses don’t Intel, an infinitely long scan requires 73 space for triple buffering. This leaves have the necessary bandwidth to support cycles to compute one bilinearly filtered between 1.6MB and 2.8MBs for texture this scheme. The PCI bus runs at pixel. (An approximation of bilinear fil- storage (and even less at higher resolu- 33MHz and can transfer 32 bits of data tering is also accelerated by the MMX tions and color depths). Clearly, we’ll every clock. That puts its theoretical instruction set.) On a 200MHz proces- need more memory to do high-quality peak bandwidth at 132MB per second. sor, 73 cycles/pixel works out to a little graphics in the future. When you factor in the overhead more than 2.7 million pixels per second This storage limitation has forced incurred by bus arbitration, multiplexing (this assumes no cache misses, no shad- game developers to minimize the num- address and data, system memory arbi- ing or fogging, and infinitely wide trian- ber of textures per scene and to down- tration, and page breaks due to multiple gles, and doesn’t take into account trian- sample textures to fairly low resolutions memory requesters, the bandwidth is gle setup or edge setup). When Z-buffer- and stretch them over the geometry. actually much worse — particularly for

22 GAME DEVELOPER • MARCH 1997 http://www.gdmag.com MMX AND AGP

small data transfers. For example, if an AGP chipsets will still include PCI For DirectX-based games, the entire texture is copied from system functionality, since this is required for all introduction of AGP should be trans- memory to the frame buffer in a long other cards in the system. Only the parent. Still, to take full advantage of sequential burst, the transfer rate will be graphics card can initiate AGP bus the new technology, there are some relatively high, since the transaction transactions — not the CPU or any things game developers should do now. costs are amortized over many bytes. On other adapter in the system. So, unless First, as AGP-equipped systems become the other hand, if the accelerator reads a the system has both a chipset and a more prevalent over the next year, your texel here and a texel there, the band- graphics adapter that support AGP, games should use high-resolution tex- width from the bus and system memory there’s really no way to use it. Still, hav- tures (and lots of them). If you’re can be abysmal — way too low to gener- ing a graphics adapter that uses AGP deploying to systems not equipped with ate pixels at an acceptable speed. Also, also frees up PCI bandwidth for other AGP, you can still resort to down-sam- latency (the time between the read peripherals, such as the sound card, pling textures. Second, the additional request and when data actually arrives at modem, or network adapter. frame-buffer memory freed up by stor- the graphics card) can be very large. AGP has two proposed usage ing textures in system memory makes Unless there’s substantial buffering in modes: DMA mode and execute mode. triple buffering practical. Triple buffer- the graphics chip to compensate for this, In DMA mode, textures are downloaded ing solves a problem that occurs at high the graphics engine will stall. in big sequential bursts to the frame frame rates (rates approaching the Intel’s solution is to improve bus buffer, as needed, from system memory; refresh rate), namely the cost of having bandwidth with the introduction of the the graphics accelerator still reads texels the graphics engine synchronize with 133MHz AGP bus. This transfers 32 from the frame buffer. In execute mode, the screen refresh. bits of data per cycle, but at quadruple texels are read directly from the system While AGP is intended primarily to the of PCI, the bus can memory into the accelerator chip with- boost the number of textures that games potentially move up to 532MB per sec- out ever passing through the frame- can use while maintaining high perfor- ond. Whether this performance will buffer memory. This implies that data is mance, it helps other applications as well. actually be observed in practice in the transferred in much smaller quantities Software MPEG-2 playback from DVD first generation of AGP chipsets over the bus. Both usage modes let you or video capture will also benefit from the remains to be seen. The system memory cache some amount of the texture on the higher bandwidth that AGP provides interface will need to see an equally graphics chip, although DMA mode between system and video memory. large bandwidth gain for all the poten- essentially treats the frame buffer as a With the advent of MMX and tial bandwidth to be available. While we secondary cache for texture data. AGP, we’re seeing major advancements should expect to see a much faster path Which mode is better, DMA or in the basic computing platform. As between the accelerator and system execute? As mentioned before, the game developers, we should be ready to memory, its unlikely to be quadrupled amount of data transferred makes a exploit these advances. In this highly initially. Most likely, it will be just dou- tremendous difference in the actual bus competitive industry, the game develop- bled at first, but it’s definitely a step in and system memory bandwidth ers that provide the next level of graphics the right direction. observed. For that reason alone, DMA and video in their games will reap the Besides the higher clock rate, AGP mode makes more sense in the short rewards. ■ includes a couple of other improvements term. Once the overall path between John Brothers is the director of archi- over PCI. Address and data lines aren’t system memory and the graphics con- tecture at S3 Inc., where he worked on the multiplexed, thanks to the introduction of troller is fully optimized by AGP Virge accelerator chip. He can be reached at “side bands.” This means a new address chipset manufacturers, execute mode [email protected]. can be sent out at the same time data is will make sense. Execute mode makes it coming in (or going out). AGP chipsets practical to use a large amount of tex- will also incorporate the Graphics tures per frame. Above a certain thresh- For Further Info: Address Relocation Table (GART), so old of textures, the performance of that the graphics controller can treat the DMA mode will seriously degrade, Intel’s MMX http://developer.intel.com/drg/mmx part of system memory set aside for tex- because the texture cache (in the frame AGP tures as a linear buffer (even though that buffer) will be trashed every frame. At http://www.agpforum.org memory is scattered into different physi- this point, the cost of managing the The Microsoft support plan cal pages). The operating system (Direct- cache outweighs the benefits of having http://www.microsoft.com/hwdev Draw in Windows 95) will load and it, and execute mode becomes the way /devdes/msagp.htm maintain this address translation table in to go. But for execute mode to work TREC the chipset. Microsoft plans to support well, the whole system has to be up to http://microsoft.com/hwdev GART in version 5 of its DirectX APIs the job, and that probably won’t happen /devdes/trec.htm (slated for release this summer). until mid-1998.

24 GAME DEVELOPER • MARCH 1997 http://www.gdmag.com 3D HARDWARE BENCHMARKS

3D Hardware Acceleration Demystified, Part 2: The Benchmarks

n the last issue of Game Developer, D3DBench cares only about raw The primary problem we encoun- I discussed some of the basics of rasterization speed. While this isn’t a tered while developing D3DBench is 3D hardware acceleration and perfect benchmark, it does provide a Direct3D’s lack of a reference imple- promised a performance bench- basis for comparing hardware rendering mentation or specification. Direct3D mark that would scrutinize some performance. It’s important to realize endorses the concept of capability bits, of today’s popular accelerators. To that D3DBench doesn’t attempt to take or the ability for a particular driver to do this, I defined some standard- into account issues that will affect overall tell an application exactly what 3D ized tests to measure performance game speed, including overlap between acceleration capabilities it supports. It is Iand enlisted the help of Andy Bigos to CPU and hardware, CPU loads, texture the application's responsibility to com- write a rasterization performance bench- download performance, and texture pensate for missing capabilities, a bur- mark called D3DBench. memory size constraints. densome and error-prone requirement I must stress that the performance This is very important — you can- to say the least. The very nature of capa- comparisons within this article take nei- not take the numbers derived from bility bits means that an application can ther price nor availability into account D3DBench and correlate them propor- be bug free when written for a specific — I’m targeting game developers who tionally to frame rate. Besides rasteriza- piece of hardware, yet breaks down the want to know what kind of performance tion, a game’s frame rate is controlled by moment a different piece of hardware is a given accelerator can offer. a number of factors, including geometric inserted. This is where APIs such as complexity, sound, artificial intelligence, Silicon Graphics’ OpenGL really show D3DBench collision detection and response, physics, an advantage — OpenGL requires that D3DBench uses Microsoft’s Direct3D and input management. Our results all functions be available under any Immediate Mode rendering API for don’t necessarily indicate how much implementation, so one OpenGL pro- abstracting hardware access and faster a game will run on Hardware A gram should work fine with any Microsoft’s Foundation Classes (MFC) than on Hardware B. With that said, I OpenGL implementation or driver. for Windows-specific issues. Direct3D encourage you to include a demo loop Direct3D’s paradigm of capability was selected because it is heavily sup- within your game that can be used as determination is completely counter to ported by hardware vendors and is your own benchmark, since the only this and, as we learned, very buggy and specifically targeted towards game devel- valid measurement of true game perfor- error prone. Further complicating the opers. However, Direct3D isn’t an ideal mance uses the game itself. implementation of Direct3D is the fact interface for all hardware, so using a that different hardware drivers interpret vendor’s proprietary API may be a better Flaky Drivers and the capability bit fields differently! The way of achieving maximum perfor- Nonexistent Specs point is that Direct3D programming mance. During the course of developing this isn’t as easy as it should be. I’m taking I don’t have the space to describe benchmark, the issue of flaky drivers this time to warn those of you delving D3DBench’s inner workings, but the reared its head more than once — some into Direct3D programming to be help files distributed with D3DBench drivers reported erroneous capability patient, careful, and cynical. contain additional information on its information or gave weird or incorrect features and implementation. Although output. Unfortunately, I don’t have the The Players D3DBench is capable of controlling space to list each driver’s bugs, especially Every 3D graphics accelerator manu- many types of display options, only a since I’m assuming that most of these facturer with an announced product specific set of feature combinations was bugs will be ironed out by the time this that I was aware of was contacted, pro- tested for this article. article is published. vided they had working silicon, up-to-

26 GAME DEVELOPER • MARCH 1997 http://www.gdmag.com By Brian Hook date Direct3D drivers, and products I really wanted to test Intel’s new with Andy Bigos aimed at the consumer market (no MMX processor with Microsoft’s $5,000 CAD boards need apply). MMX Direct3D driver; unfortunately, I Those that responded with loaner didn’t manage to gain access to such a See what happens boards and working drivers were machine in time for this article. 3Dlabs, ATI Technologies, Cirrus Logic, Diamond Multimedia, Inter- The Field graph, , and Number Nine. All All tests had the following in common: manufacturers were allowed to review 640×480 full-screen resolution, 15/16- when leading the test results and comment privately bpp screen depth, 16-bit Z-buffering, before the article was submitted for dithering, and double buffering. The final publication. For those of you who consensus is that this is the “standard wish to find out more about specific Direct3D game mode” configuration. In products and developer programs, all likelihood, support for lower resolu- 3D accelerator chips manufacturer’s URLs are located at the tions, such as 400×300 and 512×384, end of this article. will still be common because of the Microsoft’s software-only Direct3D lower fill rate requirements. Still, RGB emulation driver was used as a ref- 640×480 seems to be the ideal target erence benchmark. While the resolution for games. All texture-map- Microsoft Direct3D Ramp emulation ping tests were perspective corrected, tackle a Direct3D-based driver and/or an 8-bit display mode had a texel-to-pixel ratio of 1:4 (each would have exhibited better perfor- texel maps to 4 pixels), and all texture mance, they weren’t included in the tests maps were RGB and 64×64 (note that because of their poorer image quality some accelerators will likely perform (hence, they would not exactly have rep- better with paletted textures, but this benchmark resented an even or fair comparison). was beyond the scope of the bench- Table 1 lists the complete set of boards mark). MIP mapping wasn’t used, tested for this article. although it is a feature that should be Table 1. 3D Accelerator Boards and Their Chipsets that measures Board Chipset 3Dlabs PERMEDIA/Delta (reference board) 3Dlabs PERMEDIA/Delta ATI Technologies XPression+ ATI RAGE II Cirrus Logic Laguna (reference board) Cirrus Logic Laguna Diamond Monster3D Voodoo Graphics hardware-rendering Diamond Stealth3D S3 Virge Intergraph Reactor Verite Matrox MGA-1064SG Microsoft D3D RGB Software Driver (software-only) Number Nine 332 S3 Virge/VX performance.

http://www.gdmag.com GAME DEVELOPER • MARCH 1997 27 3D HARDWARE BENCHMARKS

measured in future benchmarks. Trian- ● General Rendering Ability: This test is including multipass lighting effects. If an gles are rotated arbitrarily so that tex- indicative of the most general rendering accelerator is reasonably fast with the tures are stepped through at different case: Z-buffered, texture-mapped, and stress test, it is highly doubtful that it is orientations. smooth RGB-lit triangles, without bilin- slower with any of the other modes. All tests were run on a PC with an ear blending enabled. ● Other Tests: There isn’t enough space Intel motherboard, a Pentium 166MHz ● Rendering BSP trees: This test repre- in this article to present the data for all of CPU, the Triton Chipset, 64MB RAM, sents the rendering mode used when the benchmark tests that we ran. As a and Windows 95 with ServicePak 1 drawing walls, ceilings, and floors using result, the complete benchmark data is installed. The initial release of DirectX a BSP (Binary Space Partition) tree. available on the Game Developer web site 3.0 was used, using the nondebugging When rendering BSP trees, sorting (http://www.gdmag.com). Data from the libraries. The test itself was compiled order is implicit; you don’t need to use following tests appears on the web site: a using Microsoft Visual C++ 4.2 with Z-buffering to handle occlusion of static smooth- test, a BSP front-to- Release Build. All tests were executed objects represented by the BSP tree. back test, a “flight-sim” (non-RGB col- with no buffer swapping so as to remove Instead, you need Z-buffering to cor- ored lighting and no Z-buffering) test, the effects of vertical retrace synchroniza- rectly render dynamic objects (such as and a test that measures rendering per- tion (a final buffer swap is executed after objects that are not part of the BSP). formance of meshed groups of triangles. the timer is stopped and the hardware is When rendering back to front, you idle so that output can be verified visual- can set the Z comparison function to The Score ly). When possible, the display was set to ALWAYS, since you know that anything The accompanying graphs illustrate the 60Hz refresh for all adapters. Triangle rendered will be closer to the viewer than relative performance of the accelerators sizes tested were 3, 10, 25, 50, 100, 250, anything previously drawn. Through this with the different modes mentioned ear- 500, 1000, 2500, 5000, and 10000 pixels. setting, the accelerator no longer needs lier. Drivers or accelerators that didn’t The tests we used represent com- to read a value from the Z-buffer, easing support a particular benchmark configu- mon and important feature sets for 3D memory bandwidth strain. ration are not listed in the relevant games, three of which are shown in It is assumed that something such graph. Whenever possible, the most Table 2. I had to choose a few reason- as ’s surface caching scheme recent drivers were used — whatever the able tests from the 50 or 60 I could (see Michael Abrash’s “QUAKE's Light- company provided, unless more up-to- devise (the original test suite had several ing Model: Surface Caching," Dr. Dobb’s date drivers were available on their web hundred tests). I’m fairly certain that the Sourcebook, Nov./Dec. 1996, pp. 43-47) or ftp site. nine tests I ran gauge features that game is used when rendering BSP walls; thus, There are two sets of graphs: the developers are currently exploiting. In the texture is unlit and bilinear filtered. triangle-throughput graphs and the fill- these tests, I stressed the importance of Lack of a texture-copy mode precludes rate graphs. Triangle throughput mea- Z-buffering, because this feature is now participation in this test. However, since sures the number of triangles per sec- supported by almost every hardware a texture-copy mode can easily be emu- ond that a hardware accelerator can accelerator and is an elegant way to solve lated with flat-modulated texturing process. Fill rate measures the number hidden surface removal problems. How- using a white light source, lack of a tex- of pixels per second that a hardware ever, since D3DBench supports many ture-copy mode doesn’t necessarily imply accelerator can render. more options, those of you interested in a true lack of functionality. ● 3Dlabs Reference Board (3Dlabs PER- doing your own benchmarking should ● The Stress Test: Stress tests the worst- MEDIA/Delta): This board turned in definitely download and play with it. case scenario for an accelerator: huge some excellent triangle throughput num- amounts of memory reads and writes are bers, typically second behind the Dia- The Tests performed, and a large amount of data is mond Monster3D for smaller triangles Each specific test addresses a particular transferred to the accelerator. This ren- (less than 250 pixels), and supported all form of rendering algorithm. The fol- dering mode isn’t that far-fetched, either the modes we requested. The drivers lowing is a short description of the tests, — transparent, texture-mapped objects were robust and fast and definitely the results of which are on the following aren’t necessarily rare, and alpha blending showed that meshing is a big win in per- pages: has many uses other than transparency, formance on 3Dlabs’ hardware. Howev-

Table 2. Feature Sets for 3D Games Tested by D3DBench. Test Name Shading Texture Mode Z-test Z-clear Blend Filter Mesh General Rendering RGB modulate LEQUAL far no PS no BSP Tree none copy ALWAYS far no B no Stress RGB modulate LEQUAL far yes B no

28 GAME DEVELOPER • MARCH 1997 http://www.gdmag.com er, bilinear-filtering performance was mono lighting, preventing its participa- with the S3-based boards than all the extremely lackluster, probably due to the tion in the stress, BSP, and “flight-sim” others combined. The problem seemed extra memory fetches required for proper rendering tests. Overall, the board post- to vacillate between issues with my com- bilinear filtering. Depending on the par- ed average scores, sometimes a little puter system and problems working with ticular test, there seemed to be a faster and sometimes a little slower than D3DBench, depending on the whims of crossover around the 100- to 250-pixel the rest of the pack, with a tendency the Compatibility Gods. I’d like to men- triangle mark where fill rate began to towards lower triangle throughput. tion that both Nicholas Wilt of limit triangle throughput. The 3Dlabs ● Diamond Monster3D (3Dfx Interac- Microsoft and Phil Parker of Number PERMEDIA/Delta board has the tive Voodoo): The Monster3D is king of Nine made valiant attempts at trying to notable distinction of being one of only the hill in pure rendering performance, get these boards working in my system. two boards (along with the Intergraph and it possesses a rich feature set to boot. ● Intergraph Reactor (Rendition Reactor) to execute all tests successfully. Unfortunately, it lacks VGA and Win- Verite): The Intergraph Reactor ● ATI 3DXpression+: The ATI Tech- dows acceleration, meaning that its pen- showed average or slightly below aver- nologies 3DXpression+ was a competent etration into the consumer market will age raw performance, at least in terms performer, with average or above average be limited; I expect this board will only of fill rate. Triangle throughput was fill rates across the board. Lack of a tex- find its way into the hands of hardcore very good, placing third behind the ture-copy mode precluded generating game players. The only feature missing 3Dlabs Delta. BSP test scores. Note that lack of a copy from the Monster3D is mono lighting, In all fairness, I’d like to note that mode isn’t a killer, since you can use so it did not participate in the “flight- games actually written for the Rendition “modulate” with a white light to achieve sim” rendering test. Verite (the chipset used in the Reactor) the same effect. The ATI also lacked a Fill rate was pretty much even on have demonstrated very good perfor- mono-lighting mode, precluding its every test — turning on features such as mance, probably the result of overlap inclusion in the “flight-sim” rendering Z-buffering, bilinear filtering, or alpha more than anything else. For this reason, tests. Triangle throughput was fairly low, blending doesn’t seem to exact a fill-rate D3DBench is not a good measure of but this is a common attribute of lower- penalty. Also, throughput peaks at 100- performance for architectures that cost 3D accelerators, where it is easy to pixel triangles — for some reason, the depend on overlap to realize their opti- offload a lot of setup computation onto Monster3D can process 100-pixel trian- mal performance figures. the host and leave the rendering to the gles faster than it can process 10-pixel hardware. Still, the 3DXpression+ will triangles. This may be because of some probably be a popular board because of hardware anomaly (10-pixel triangles Legend its wide range of features and the fact come too quickly and stall the PCI bus) Permedia that ATI is traditionally a high-volume or something as mundane as the fact that chip vendor. larger triangles require smaller execute Rage II ● Cirrus Logic Reference Board (Cirrus buffers in D3DBench, and thus show Laguna Logic Laguna): The early beta drivers for better caching effects. this board weren’t very stable. I had to ● Diamond Stealth3D, Number Nine MS D3D RGB Driver hack D3DBench a bit to get it to work, 772 (S3 Virge and S3 Virge/VX): No mat- Mystique but once that was done the tests looked ter how hard I tried, I could not get the correct. The Laguna lacks true alpha S3 drivers to work in my system. More Monster3D

blending, a texture-copy mode, and time was spent trying to solve problems Reactor Figure 1. BSP Back-to-Front Fill Rate Results Figure 2. BSP Back-to-Front1 Throughput Results

40 200 180 35 160 30 140 25 120

20 100 80 15

Ktriangles/second 60 Megapixels/second 10 40 5 20

0 0 3 10 25 50 100 250 500 1,000 2,500 5,000 10,000 3 10 25 50 100 250 500 1,000 2,500 5,000 10,000

pixels per triangle pixels per triangle

http://www.gdmag.com GAME DEVELOPER • MARCH 1997 29 3D HARDWARE BENCHMARKS

Figure 3. General Rendering Fill Rate Results Figure 4. General Rendering Throughput Results

40 200 180 35 160 30 140 25 120

20 100 80 15

Ktriangles/second 60 Megapixels/second 10 40 5 20

0 0 3 10 25 50 100 250 500 1,000 2,500 5,000 10,000 3 10 25 50 100 250 500 1,000 2,500 5,000 10,000

pixels per triangle pixels per triangle

● Matrox Mystique (MGA 1064-SG): expected for a software-only renderer. This load generally falls into two cate- The Matrox board’s lack of bilinear fil- Unfortunately, if a game is written with gories: triangle setup and flow control. tering really hurt its usefulness with hardware acceleration in mind, it may not Triangle setup consists of all the D3DBench — the test suite runs on the be usable at all with Microsoft’s RGB work done to compute the triangle assumption that users will be demanding Emulation driver. In Microsoft’s defense, parameters that are relevant to the bilinear filtering from future games, and they have been concentrating on optimiz- accelerator. This may be as simple as with this in mind, the Matrox could not ing the Ramp Emulation driver and their gradient computations, or as complex as execute the general rendering, “flight- MMX driver. The Microsoft RGB soft- splitting up big triangles into smaller sim” rendering, BSP, or stress tests. On ware driver doesn’t support Z-functions triangles that the hardware can handle. the tests that the Matrox could com- other than “less or equal,” so the BSP Triangle setup requires CPU time to plete, however, its performance was back-to-front test couldn’t be performed. calculate parameters, and thus influ- respectable. As with the ATI board, tri- Lack of alpha blending precluded gather- ences load significantly. angle throughput was fairly low, typical ing numbers for the stress test. Flow control is the amount of of less-expensive 3D accelerators that handshaking that the CPU has to do have expensive setup overhead. The Effect of the Processor with the accelerator to send the accelera- ● Microsoft Direct3D RGB Emulation An important measure of a hardware tor the triangle parameter data (and Driver: If you’re writing a game with accelerator’s performance is how much other information) computed during tri- Direct3D, don’t even think about sup- of a load it exacts on the host CPU. An angle setup. Bad flow control may porting software-only rendering, at least accelerator that requires a lot of CPU require the CPU to poll the accelerator not with the RGB Emulation driver pro- time may actually be slower in a game before every hardware register write for vided by Microsoft. This driver pretty than one with low load characteristics, busy status, or poll the hardware before much flatlined near the bottom of the even if it has a faster fill rate. The writing out a new triangle. If your code charts in all modes (at least the ones it amount of CPU load an accelerator con- is subjected to this kind of waiting, you supported), and established the low end sumes consists of all the CPU activities better hope the hardware can render tri- of the performance spectrum, as is to be required to get data to the accelerator. angles significantly faster than your soft-

Figure 5. Stress Test Fill Rate Results Figure 4. Stress Test Throughput Results

40 200 35 180 160 30 140 25 120 20 100 15 80

Ktriangles/second 60 Megapixels/second 10 40 5 20 0 0 3 10 25 50 100 250 500 1,000 2,500 5,000 10,000 3 10 25 50 100 250 500 1,000 2,500 5,000 10,000 pixels per triangle pixels per triangle

30 GAME DEVELOPER • MARCH 1997 http://www.gdmag.com ware can, or it may be just as fast (or specific game on a specific accelerator to Andy Bigos is a software engineer with faster) to render triangles yourself. get a valid idea of performance differ- 3Dlabs, based out of the United Kingdom. Hardware with good flow-control ences between accelerators. He can be reached at [email protected]. characteristics does not subject the CPU D3DBench does not attempt to to busy waiting, either by having very measure overlap — as a matter of fact, For Further Info: deep FIFO write buffers or by using PCI the benchmark discourages it by waiting bus mastering to asynchronously fetch for hardware rendering to complete 3Dfx Interactive ■ triangle data from the host. before stopping the timer. www.3dfx.com When a hardware accelerator lets Brian Hook is a freelance 3D graphics 3Dlabs the CPU do nonrendering tasks in paral- software and hardware consultant based out www.3dlabs.com lel with the rendering, it is called “execu- of Sunnyvale, Calif. He can be reached at ATI Technologies tion overlap.” The less CPU load you [email protected], or http://www. www.atitech.ca have, the more overlap is achievable. In wksoftware.com. Cirrus Logic terms of overlap, the ideal accelerator www.cirrus.com performs triangle setup and has good Acknowledgments Diamond Multimedia www.diamondmm.com flow control characteristics. In this situa- Matrox Graphics tion, the game only has to send vertex We’d like to thank all the manufacturers who provided up-to-date drivers, test- www.matrox.com data to the accelerator. ing hardware, and engineering time Microsoft Corp. Overlap can become a huge factor while we tried to get D3DBench work- www.microsoft.com in game performance, especially if your ing with everyone’s hardware. We’d Number Nine game is consuming a lot of time per- also like to thank the many individuals www.nine.com forming nonrasterization activities. This that contributed their technical insight Rendition is another situation in which rasteriza- to this article and benchmark, especial- www.rendition.com tion performance doesn’t necessarily ly Walt Donovan, Rob Mullis, Miriam S3 Inc. www.s3.com equate to overall game performance — Sedman, Gary Tarolli, and Ken Whaley. you must measure the performance of a

http://www.gdmag.com GAME DEVELOPER • MARCH 1997 31 NETWORK API

The Game Network API Slalom

t came to you like a bolt out of The team bursts into applause. You’ve became such a dominant force, network the blue: the perfect multiplayer done it again, you wacky bastard! programming typically involved calling a game, a game that will transform vendor’s proprietary function library. As the very way the world looks at Components of a recently as 1994, Ralf Browne and Jim entertainment. You assembled a Multiplayer Gaming API Kyle’s important reference work, Net- world-class group of artists, Programmers don’t like to admit igno- work Interrupts (Addison-Wesley, 1994), musicians, and programmers, and rance, but let’s face it, the majority of talked of “three dozen major application you played the venture capitalists game developers have not had any rea- programming interfaces” and detailed Ioff against each other until they gave son to work with networks. Even those over 1,400 interrupts, many of which you all the money you could conceiv- programmers who know every 80x86 were previously undocumented. ably use plus an obscene signing bonus opcode backwards and the quirks of Networking services are typically in exchange for a ludicrously small every videoboard ever made probably described with the ISO Open System block of nonvoting stock. You’ve flown have never used the network for more Interconnection Reference Model the whole staff to Snowbird, Utah, for than file transfer and e-mail. The net- (Figure 1). At every level, corresponding five days of team-building and relax- work really only became a ubiquitous services have an API for talking to each ation before development begins. One presence in the world other, even though that API will be built morning, before the lifts open, you in the past five or six years, and as was on lower-level services. The physical gather the group together to explain typical of the world before Windows layer represents the hardware level, your vision. As the avalanche cannons echo across the val- Figure 1. The ISO Open System Interconnection Reference Model ley, saluting the night’s fall of another six inches of cham- pagne powder, one of your junior programmers raises his hand. “I understand what we want the game to do, but I’ve never done any network Server programming. What is it, exactly, that we’re going to Application have to build ourselves, and what network stuff is done for Presentation RTime Presentation Presentation us? Where can we expect DirectPlay DirectPlay Lobby problems?” Session Session An uncomfortable silence Sockets Sockets is finally broken by the distant Transport Transport sound of the lift engines start- Proprietary ing up. The rest of the staff Network TEN, MPath SDKs MPath TEN Network involuntarily grimaces, know- Data Link Data Link ing their chance to be the first

ISDN, Cable, Programmatic Advantage on the slopes has been shot. xDSL Physical Physical Fundamental Speed Dependencies But you, ever prepared, smile and say, “Read this article.”

32 GAME DEVELOPER • MARCH 1997 http://www.gdmag.com By Larry O’Brien where the raw bits move from device to future beyond a “send” function and a device. The data-link layer packages receiving strategy based on either those bits inside frames and may be polling a receive queue or callbacks. responsible for retransmitting frames This thinking lands them smack dab in Confused about the that have become corrupted. The net- the middle of the session layer. Indeed, work layer’s primary responsibility is to you’ll find just such functions in the two provide a uniform addressing system, so most likely candidates for your session that large networks of perhaps different layer’s API — sockets and DirectPlay. data-link types can be built. The trans- Sockets started out as the interface port layer is the first one that “knows” to TCP/IP of Berkeley UNIX. Since differences between about a remote peer and has a great deal BSD UNIX was the basis for so many of important responsibilities — it has to commercial UNIX flavors, and since be able to maintain multiple open con- the Internet was, until recently, pretty nections and route data to the correct much a UNIX-only ballgame, sockets is session layer, which is the layer respon- a fairly straightforward — and by far sible for maintaining the logical connec- the most well-known — network pro- tion between applications. The presen- gramming API. There are dozens of game networks? tation layer deals with logical data types, books about sockets (and the Windows- and the application layer represents the specific implementation found in highest-level, the application (in our WINSOCK.DLL) and a ton of free case, the game itself). sockets source code. Implementing So, when people talk about “gam- sockets is an easy way to start learning ing network APIs,” they’re talking about network programming. Perhaps Wondering where the about an incredibly large amount of ter- the only way it could be any easier is to ritory. When you start following the use Java’s java.net.* classes, which multiplayer gaming industry, you can encapsulate sockets in a straightforward fall into the trap of thinking that it’s a set of objects. very immature market with no clear It’s important to remember that leaders and a million pretenders to the since sockets is tightly tied with DirectPlay and throne. Over time, however, you’ll see TCP/IP (and UDP/IP, which is a con- that each of these layers only has one or nectionless, datagram-based transport two or three major players, and that in layer that might be beneficial in certain spite of a lot of churning and confusion, gaming scenarios), your hands are tied the potential for a rapid crystallization as far as optimizing the lower layers of of services definitely exists. the reference model is concerned — if the performance isn’t there, you’re not sockets layers fit into Session Layer: going to be able to do a lot about it. DirectPlay vs. Winsock On the other hand, there’s Most programmers new to networking DirectPlay. DirectPlay is a session think in terms of sending and receiving layer developed as part of Microsoft’s messages between one client and anoth- DirectX strategy. Like sockets, Direct- er. They don’t really think about the Play is a pretty straightforward API, the mix? Read on.

http://www.gdmag.com GAME DEVELOPER • MARCH 1997 33 NETWORK API

Figure 2. The RTime “environment.” industry segment of the game development industry, which is already threatened by rising production costs and Hollywood’s increasing attention to games. RTime Server Still, the more that game development stan- dardizes, the less that long and hard experience with graphics programming and multimedia is necessary for Driver Driver 1's 2's development — or so goes Filters Filters the common perception. Driver 1 Driver 2 Michael Abrash of id thinks that the opposite is true, that the cutting edge in graphics programming is pulling away from the main- stream. This may prove true Pilot of network programming as 1 well, since DirectPlay sim- ply doesn’t provide a higher Pilot 1 level of functions to radically ease the burden of network game programming. with just 32 functions that are mostly The great disadvantage of Direct- Presentation Layer: groups of “get capabilitities” and “get- Play is that there are still very few RTime’s RTime set data” functions. Additionally, resources for sample code and discussion If you’re looking for a presentation- DirectPlay 2.0 provides nine Direct- (but then again, that’s why we have layer lift, you’ll need to consider a PlayLobby functions for connecting a Game Developer, isn’t it?). The best dis- tool such as RTime Inc.’s RTime matchmaking service to DirectPlay cussion of DirectPlay in a book that I’ve server and SDK. RTime’s CEO, games. The big advantage that Direct- seen is in David Allen’s Visual Basic 4 Rolland Waters, designed the origi- Play has over sockets is that it is pur- Network Gaming Adventure Set (Coriolis nal wide-area network for SIM- posefully not tied to a transport layer. Group, 1995), which contains virtually a NET, the U.S. Army’s cyber-train- In the latest release of DirectPlay, book-within-a-book on DirectPlay by ing network, and so brings a heavy Microsoft provides four service capabil- Adam Weissman. Also, the more recent dose of credibility to their solution. ities: direct modem-to-modem, serial Spells of Fury, by Michael Norton (Waite Basically, RTime works like as a fast connection, TCP/IP, and IPX. Group Press, 1996) has about forty client/server filtering and message DirectPlay’s multiservice capabili- pages on DirectPlay, including some dispatcher. ties give you some flexibility down the very useful source code annotation. An RTime server maintains global road. If you discover that your game’s Another disadvantage of DirectX, positioning state for the game. When a performance doesn’t cut it using a in general, is the fear that it represents player connects to the game, they specify TCP/IP connection, you should still be some kind of power play on Microsoft’s a series of filters in the form of bounding able to offer LAN play or direct-dial part. And it is, to some extent, because boxes (“Let me know about whispers play without rewriting your source code. Microsoft certainly knows that selling within five feet, let me know about Conversely, if you think the Internet developers is the key to selling operating explosions within ten miles, let me know can’t possibly provide the necessary per- systems or, in the new Internet world, to about a jet’s position within ten miles, let formance for your DirectPlay game, but keeping developers reliant on Microsoft me know about any vehicles markings then along comes advanced lower-layer operating-system services. All of within 1 mile, and so on.”). Then, services (which we’ll talk about in a DirectX is based on COM interfaces, typically at the end of the screen drawing moment), you won’t have to change your and COM is the keystone of Microsoft’s loop, the client calls a single function, source code to gain access to the World operating system structure. I think some rt_tick(), which shoots the client’s posi- Wide Market. of the fear, too, arises from the cottage- tion up to the server and receives a list of

34 GAME DEVELOPER • MARCH 1997 http://www.gdmag.com “real objects” that have made it through RTime filters also include a data about each other, since they’re “over the the filters. RTime real objects have the rate, which specifies how often you want horizon” from one another. Pilot 1 following traits: to receive updates on an object’s posi- would receive data on both drivers. It’s • location tion. So if a jet is still a hundred miles quite possible to imagine a game that • velocity away, you might need to know about it restricted access to vehicles based on • acceleration for your radar display, but you don’t connection speed — perhaps those with • orientation necessarily have to receive updates of its 14.4KBps modems would be restricted • an orientation derivative position every frame. If you design your to a tank with a narrow gunslit and an • an appearance (just an unsigned inte- filters carefully enough and have some undetailed radar screen, while those ger — presumably a selector for your kind of programmatic guard against with ISDN lines could fly jets, and game to interpret) overwhelming “crowds” in a small phys- those with T1s could handle the com- • perhaps a parent and a list of children, ical area, you can use RTime to simulate mand-and-control functions and receive which are themselves real objects. a contiguous environment without “video feeds” from large groups of play- Additionally, “event objects” rep- imposing any kind of “room” or “loca- ers. By setting different data rates and resent transient things, such as explo- tion” structure on your game. In Figure filters, you can effectively adjust your sions and collisions. There are also text 2, for example, both Driver 1 and Driver game’s granularities in space and time, and data objects for transferring addi- 2 would receive data about Pilot 1’s which is directly related to your band- tional data. plane, but they wouldn’t receive data width requirements (see “Multiplayer Math” in Game Developer’s Special Table 1. Representative DirectPlay Functions & Structures Report on Development [http://www.gdmag.com] for a further As a session-level protocol, DirectPlay provides straightforward connection and mes- discussion of bandwidth requirements). saging services. RTime is a client/server solution. Instead of dealing with messages HRESULT WINAPI DirectPlayConnect( Used to connect player to game (session-layer data), you deal with LPDIRECTPLAYLOBBY *lplpDPL, Returns a DirectPlayLobby interface objects (presentation-layer data). You Returns a DirectPlay2 interface LPDIRECTPLAY2 FAR *lplpDP, locally update your objects’ positions, call rt_tick(), and voila, your list of HRESULT Send(DPID idFrom, DPID idTo, DWORD idTo can be individual player or group ID dwFlags, LPVOID lpData, DWORD dwDataSize); dwFlags can signal priority or guarantee external objects has been magically delivery updated as well. The RTime server exists on a dedicated piece of (presum- HRESULT Receive(LPDPID lpidFrom, LPDPID dwFlags can be used to filter for a specific ably quite speedy) hardware running lpidTo, DWORD dwFlags, LPVOID lpData, lpidFrom, or to peek into the stream (to get Solaris, SGI, or NT. The RTime server LPDWORD lpdwDataSize); lpidFrom, for instance) without removing is not an application server — if you message from queue want to have server-side AI, persis- tence, or other application logic, you’ll HRESULT SetPlayerData( New function probably intended for rapid have to hook that in on your own. Since broadcasting of application-specific state DPID idPlayer, the hard stuff (the message filtering and LPVOID lpData, DWORD dwDataSize, data (there’s a complimentary SetGroupData dispatch) happens at the server, RTime DWORD dwFlags); function) can have an innovative pricing struc- ture. It’s free to download the SDK and typedef struct { develop a game; RTime charges based DWORD dwSize; Size of this structure on the number of simultaneous connec- Returns information on session host and DWORD dwFlags; tions to RTime servers. The SDK also service provider includes a development server that sup- DWORD dwMaxBufferSize; DWORD dwMaxQueueSize; No longer used! ports up to 100 client connections and DWORD dwMaxPlayers; runs on Solaris, SGI, or Win32, so you DWORD dwHundredBaud; don’t have to start paying RTime until DWORD dwLatency; Server-provided latency estimate; May be you’re in a broad beta test. 0, indicating “no guess” RTime’s filtering capabilities mean DWORD dwMaxLocalPlayers; that you can have a game with thou- DWORD dwHeaderLength; Size of message header in bytes; Varies sands of connected players, so long as according to service provider the data moving through any client’s fil- DWORD dwTimeout; ters can be handled by the lower-layer } DPCAPS, FAR *LPDPCAPS; infrastructure.

http://www.gdmag.com GAME DEVELOPER • MARCH 1997 35 NETWORK API

Table 2. Representative RTime API Functions & Structures Low-Level Improvements Improving the lot of game-playing at the network layer and below requires trade- As a presentation-level API, RTime is a little more difficult to learn, but is vastly more offs. Obviously, you can get much higher powerful. performance by requiring certain higher- bandwidth capabilities of the physical rt_error_state rt_init( Main initialization function; RTime proper- layer (create games that can be played ly handles all local machine dependencies only over ISDN or direct network con- rt_machine_type local_machine_type, INTEL, MAC, SGI nections); obviously, doing so requires int num_local_objects, Maximum number of RTime objects that you abandon potential marketshare. Fig- will be created by this client ure 1 also shows that at the network and int num_remote_objects, lower layers, there are “middlemen,” net- int num_string_bufs) String buffers used for communication work switches and so forth. By removing middlemen, other major gains in net- rt_error_state rt_new_object( Typical object creation function; RTime work gaming can be had. takes care of storage of new instance of The most dramatic way to remove provided class and type, returns pointer middlemen is by creating a dedicated in object_id network to connect game players. This is the strategy behind Interactive Visual rt_object_class object_class, System’s DWANGO (Dial-up Wide rt_object_type object_type, Area Network Game Operation), which rt_oid *object_id) performs matchmaking on the Internet, but then connects the players via direct rt_error_state rt_update_real_object( Rather than deal with send-receive mes- saging, this is a typical update function; dial-in to servers located in metropolitan changes specified here will be propagat- areas. Obviously, this allows for dramatic ed to other players during subsequent improvements in performance, and call to rt_tick(); notice the richness of DWANGO quickly gained a name for movement data passed itself as the premier host for DOOM rt_oid object_id Deathmatches. The downside is that if a rt_xyz location player’s call to one of the dozen or so rt_acceleration acceleration DWANGO servers is long-distance, rt_orientation_type orient_type even dime-a-minute rates can become rt_orientation orientation fairly substantial, especially if you’re rt_orientation orientation_derivative hoping to charge a subscription or pay- rt_appearance appearance) for-play fee on top of the phone charges. Still, DWANGO is the leader in low- rt_error_statert_register_event_callback(void Register event-callback function; Future latency, dial-in gaming. DWANGO’s (*fname)(rt_oid oid, rt_event_data releases may extend to allow callback chief competitor, Catapult, whose *event_datap)) functions based on event class and type Xband dial-up technology was a hit with cartridge players, is in the process of rt_error rt_tick(void) Main synchronization call being acquired by Mpath, which wants to have a dial-in, low-latency solution to Typedef struct{ Groups of these filters are sent to the complement its other offering. server via rt_real_object_filtering_tem- plate(num_templates, template_array) func- Game Networks — It’s the tion (not shown) Economy, Stupid! rt_object_class oclass; Mpath’s other offering is the strategic rt_object_type otype; complement to their direct-dial services: float range; In the future, this will be extended to sup- port the topology of playing field (floors, a speedy, Internet-based gaming net- doors, and so on) work. Mpath and their arch-rivals, the rt_suppress_level level “Send All,” “Send Fast,” “Send Slow,” Total Entertainment Network (TEN), “Send None,” and so on are the high-profile trailblazers in this }rt_filter_template arena. Both of these companies dedicate physical-layer components to be the “middlemen” of Internet-based games,

36 GAME DEVELOPER • MARCH 1997 http://www.gdmag.com COMPANIES

TEN Mpath’s Microsoft’s RTime Mplayer DirectPlay Founded 1988 1995 1978 1993 Major Daniel Goldman, Brian Apgar, Bill Gates, Chip Overstreet, Players Jack Heistand Brian Moriarty, Alex St. John, Rolland Waters, Jeff Rothschild John Hall John Allred Type of Aggregator and Service Aggregator and Service Session-layer COM Presentation-layer real- service Provider Provider interfaces time API Revenue Royalties: 20-40% Split gross profits on Loss-leader — Free SDK, servers Model retail sales Windows-based games licensed on per-connect means Microsoft basis Operating System sales Strengths Strong out of the blocks Strong strategically — Free multinetwork API. Powerful API that fits with many games. business and partnering No monetary pressure on naturally into games. Good scaling and API strategies. Good company. DoD spin-off means set. High royalties: security. you’ve already paid their 20-40% learning curve. Weaknesses Is the market ready? Ties game to Windows. Newcomers to game development community.

and they cooperate with large Internet your product can see red ink before it “Sure,” he replies. “If we want to do backbone companies (PSINet in the case ever ships. And don’t forget the Catch-22 it all ourselves, we work with sockets or of Mpath, Concentric Network for of the retail channel: Retailers only stock DirectPlay. If we need latency under, TEN). As a result, Mpath and TEN hits, but to be a hit, a product has to say, 250 milliseconds, but still want to promise session-layer latencies in the have high retail sales. offer play over a public network, we region of 150-250 milliseconds (plus the When you develop a network game, should use a gaming network. Much signal-cleaning 25-50 millisecond stall by definition your market has download- under 150 milliseconds and we’re proba- on data going out through analog ing capability, which makes downloadable bly going to have to go with a dial-up modems), significantly slower than teasers, demos, and shareware versions all solution, like DWANGO or Cata- direct dial-up, but better (and far more viable. What better place to advertise than pult/Mpath’s Xband. Between 150 and reliable) than you would get with an on the gaming network that will host 250, we talk to TEN and Mpath. If we “unmanaged” Internet connection. your product? And since TEN and don’t need low latency, but do need Although these companies both Mpath both provide commerce solutions, something to help us with the revenue offer SDKs, as developers become more you can sell your product through them as and commerce side of things, we may sophisticated and experienced with well as collect subscription royalties still want to talk to those guys; but we session- and presentation-layer offerings, through the game networks. These fulfill- might also talk directly with major there’s really no strategic reason for these ment services alone may be reason online service providers, such as America SDKs to evolve. What Mpath and TEN enough to go with a gaming network, but Online. If the fairly thin APIs of sockets really bring to the table is exposure, the lower-latency rates and, most impor- and DirectPlay don’t give us the support marketing, and fulfillment. tantly, reliability are the real keys. we need, we’ll want to consider using a The big benefits of network gaming presentation-layer API, such as that are the marketing and delivery channels Taking the Plunge provided by RTime. It’s really quite and subscription revenue. One of the You get off the gondola at midmorning straightforward. By the way, I don’t ski. greatest challenges of a multimedia and who do you see at the top of the Is that a problem?” developer is reaching an audience, espe- mountain but your junior programmer, “No problem at all,” you say, pushing cially if their product is not a clone of looking nervously down through his ski off. “Just follow me. You’ll be fine.” ■ last year’s best-selling game. Full-page tips at the double black-diamond run. Larry O’Brien left an extremely lucra- ads in Computer Gaming World and Next “Did the article sum things up for you?” tive career at Miller Freeman for a dubious Generation are pretty expensive, and if you ask, sliding up beside him and venture in online gaming. He can be your game’s release date starts to slip, adjusting your goggles. reached at [email protected].

http://www.gdmag.com GAME DEVELOPER • MARCH 1997 37 3D PIPELINE

Inspecting the 3D Pipeline, Part 2: Manipulating 3D Matrices

ell me if this scene sounds clipping, and rasterizing are all difficult, object-space, where the points of an familiar: In the early stages of there’s nothing quite as elusive as gain- object are aligned along the x, y, and z development, you run your ing a firm understanding of 3D rota- axes with no rotation; world-space, where game, and you see that your tions. We’ll try to dispel the confusion the points of all objects and the orienta- 3D test cube is spinning by picking apart 3D-rotation matrices tions of all cameras are expressed relative around the world’s axes and examining what’s really happening. to some global reference frame; and cam- instead of its own local axes. We’ll look at many different ways in era-space, where the points of all objects So you try changing the order which rotation matrices can be concep- are expressed relative to the camera view- Tof a few lines of code and run it again. tualized and see how each can be applied ing the scene. It is important to remem- Now it’s spinning about its local axes, to the practical problems involved in ber these spaces as we look more closely but it’s spinning in the wrong direc- every 3D pipeline. at rotation matrices, because as you’ll see, tion… or at least, you think it’s the Before we begin, let’s run through much of the confusion about 3D rota- wrong direction. Are you using the the typical set of rotation operations a tions can be avoided if we pay attention wrong sign on the angle of rotation? 3D pipeline might involve. We start to the spaces we’re rotating to and from. Then you look closer and realize that with a number of objects, each of which With that in mind, let’s get started. not only is the cube spinning the wrong can be independently rotated. As part of way, but you’re looking at all the back- the game’s state, we store (in one form The Columns faces! So maybe there’s actually a sign or another) the current rotation of each All of our objects, by definition, start in error in the rotation matrix. But wait — of these objects. When it comes time to object-space. They’ve had no rotation maybe the backface-culling code just render a scene, we must loop through applied; we’ve just loaded in their geom- has a greater-than sign where it should each object in turn and generate a rota- etry and taken it as-is. If we were to ren- have a less-than sign…. Did you check tion matrix that puts the object at its der them in this space, they’d all be that code? correct orientation relative to the camera pointing in their original directions, all Though none of us wants to admit we’re using to view the scene. Typically, the time. So, the first rotation matrix it, many of us have experienced this type this involves at least two different rota- we’re likely to need is that of the type of confusion before. While projecting, tion matrices: one that rotates the object shown in Figure 1 — a matrix that from its nonrotat- rotates an object to some other orienta- Figure 1. Object-Space to World-Space Rotation. ed state to its cur- tion in the world. This way, we can place rent orientation our objects at different orientations rela- in the world, and tive to the world axes — we can rotate z one that rotates it from object-space to world-space (which z x from its current I’ll call an object-to-world rotation). orientation in the When we apply such a rotation, world to its orien- think of it as rotating the object’s axes x tation relative to away from the world axes to some new the camera. orientation. As you can see from Figure Thus, as the 1, it’s simple to conceptualize a rotation y 3D pipeline runs as a set of rotated axes for an object. If y its course, we con- you see how the object is aligned along its ceptually move axes when it’s not rotated, you can easily Before (object-space) After (world-space) through three picture what the object would look like if different spaces: you knew the direction of its rotated axes

38 GAME DEVELOPER • MARCH 1997 http://www.gdmag.com By Casey Muratori in world-space. Now, if we could figure matrix contributes. If you try y and z, out how those axes relate to a rotation you’ll see they work out the same way. matrix, we’d be all set; not only could we Still not convinced? Try this: Begin decipher any rotation matrix by looking with the definition of one of the object's Manipulating objects at the direction of the axes, we could also points p in object-space. Its coordinates build arbitrarily complicated rotations, as are given as distances along the three long as we knew what vectors we wanted principle axes of the object. We might our objects to point along. say that, to find p, we start at the origin in 3D space often Fortunately, the gods of mathemat- of the object, move px units along its x ics made this relation easy to find. It just axis, py units along its y axis, and pz units so happens that, for any given rotation along its z axis. matrix, the vectors formed by its three Now apply the rotation. columns actually are the rotated axes for px requires manipulating the objects it transforms. If you think of ==++ the 3×3 matrix as partitioned like this, p' x y zp y pppxyy x y z p xyz z xxx Look at the right side of this equation xyz= xyz yyy — it says, to find the rotated point p¢, 3D rotation matrices. xyz zzz start at the origin, move px units along x, then the column vectors x, y, and z are py units along y, and pz units along z. the new axes your object will point Sound familiar? It’s doing the same along. It’s that simple! thing we did when we originally defined Why does it work out this way? p, only instead of using the object’s local Once you can Well, let’s take the most straightforward axes, it’s using the axes defined by the approach. Consider the three vectors columns of the matrix. The equation that describe the axes of your object in puts the point where it would be if the object-space. If we rotate each of these object’s axes were not coincident with vectors by the rotation matrix, we get the world axes, but were coincident with conceptualize these where they’d end up after the rotation, the vectors x, y, and z — exactly what right? Let’s see what happens when we we thought should happen. try this for the x axis of our object, |1 0 0|T (if you are unfamiliar with the The Rows matrices, working superscript T, take a quick look at the Looking at a matrix as a collection of sidebar, “Vectors and the Transpose columns provided us with a good way to Operator,” before continuing). understand object-to-world rotations. However, a world-space–to–camera- 1 space (which I’ll call world-to-camera) =++= with them becomes xyz 0 100 x y z x rotation is decidedly different. 0 Figure 2 shows this rotation matrix

As you can see, we end up with only the in terms of axes. The camera’s axes are first column of the matrix — it is the described in world-space, and our new x axis, since no other column of the world-to-camera rotation matrix rotates much more intuitive.

http://www.gdmag.com GAME DEVELOPER • MARCH 1997 39 3D PIPELINE

the world so that the camera’s axes are both orthogonal to x (by definition), object in world-space. Now, suppose we become the new world axes. In essence, so their dot-product is 0, and any unit- wanted to view the world from this we are making everything’s orientation vector dotted with itself is 1. So, yTx and object, effectively making it into a cam- relative to the camera. zTx both become 0, and xTx becomes 1, era. What would we do? As with the previous section, we leaving us with |1 0 0|T, the world x axis Using the column picture, we know want to find some way of relating the (if you’re unfamiliar with the vTv form of that the columns of our object’s object- axes of the camera to the elements of the the dot product, see the sidebar “Vectors to-world matrix are the axes of the rotation matrix that we’d use to view and the Transpose Operator”). If you try object. Using the row picture, we know from that camera. As you might have the y and z axes, you’ll see that they work we can build a world-to-camera matrix if guessed from the subheading, the rela- in the same fashion. we have the axes of the “camera,” which, tion is just as simple as it was for the col- As with the column picture, we can in this case, is our object. We can take umn picture — for a world-to-camera verify our assertions in more than one the columns out of the object’s current rotation, the axes of the camera appear way. Take a point p, this time in world- matrix, plug them in as rows of a rota- as the rows of the matrix. Think of the space. Apply the camera-space rotation. tion matrix, and poof! We’re left with the 3×3 rotation matrix like this: world-to-camera rotation that views the x T xpT world from our object. In short, to turn xxx xT ==T T xyz p' y p yp an object-to-world rotation into a world- = T T T yyyxyzy z zp to-camera transform for the same object, T zzz z The result is a single vector comprised of all we have to do is exchange the matrix’s xyz x, y, and z are the camera’s axes. dot-products. We know the dot product columns for its rows. To illustrate the relation, we can maps one vector onto another; for a unit Similarly, if we had a camera’s use similar techniques to those we used vector u, and any other vector v, it world-to-camera rotation, and we want- for the column picture. If our rotation is answers the question, “If u were an axis, ed to make that camera into an actual indeed the world-to-camera rotation, it what would v’s coordinate be along that object in the world, we could build the will rotate the camera’s axes to coincide axis?” In a similar light, the above multi- camera’s object-to-world rotation in with the world axes. So, if we rotate the plication answers the question, “If x, y, exactly the same way. Follow the process camera’s axes by our rotation matrix, and and z were axes, what would p’s coordi- we just used: extract the camera’s axes the world axes come out, our assumption nates be on those axes?” In this way, our from its world-to-camera rotation about the rows must be correct. Let’s try rotation results in a projection of p onto matrix, then plug them into the object- that for the camera’s x axis x. the axes x, y, and z. We are left with to-camera matrix. All you end up doing what the coordinates of p would be if the is exchanging the rows and the columns. x T xxT 1 rows of our transform matrix were the Exchanging a matrix’s rows with its T ==T y x yx 0 new world axes — exactly what we columns is called transposing the matrix. T T z zx 0 thought should happen. But we can see an even more interesting

In the last issue, we looked at the relationship between the rows and orthogonality of the principle axes and The Transposed Matrix columns once we consider one additional made some observations about dot-prod- We’ve come to an interesting place in fact about object-to-world rotations and ucts between them. Those observations our understanding of rotation matrices: world-to-camera rotations: they are per- come into play here; we know y and z we know how to look at them as fectly opposite operations. columns, we know The object-to-world rotation Figure 2. World-Space to Camera-Space Rotation. how to look at them rotates the objects axes away from the as rows, but we origin to the current orientation of the haven’t really looked object. The world-to-camera rotation z at the two pictures rotates the object’s axes away from its z together. Surely, current orientation to the world axes. x since they are both They are opposite, or inverse, operations. rotations, there must Chances are, you’ve heard that “the x be some link be- inverse of a rotation matrix is its trans- tween them. Let’s pose.” The reason is the coupling see if we can find it. between the rows and columns. Take an object- y to-world rotation Matrix Concatenations y matrix. This matrix In the previous sections, we attacked gives us the orienta- rotation matrices as static entities — we Before (world-space) After (camera-space) tion of a particular took a given type of rotation and exam-

40 GAME DEVELOPER • MARCH 1997 http://www.gdmag.com ined what the components of the rota- rotation matrix RZ and postconcatenate it. the equations in that article, you’ll see = tion matrix meant in a more tangible S' SRZ that I led you astray. The value a is way. Now we’re going to change gears Since RZ is applied first, it will happen actually the measure of the amount of slightly and look at matrices in a more before the spaceship is rotated to its cur- distortion that will occur because of the dynamic way. Specifically, we’re going to rent orientation — so the rotation about aspect ratio. Therefore, to correct for see what happens when different rota- the primary z axis will occur when the aspect ratio, you’d actually want to mul- tion matrices are combined, or concate- object’s z axis is still aligned with it. In tiply the y values by the inverse of a. For nated, to form new rotations. essence, we are using the order of multi- the record, here are the corrected pro- We wouldn’t have much to talk plication to go back in time to the jection equations: about if there was only one way to com- object’s original state (object-space),   wpw bine any two rotations. But matrix multi- apply a rotation, then apply all the other p′ =  rx + r x  ()θ  plication is noncommutative — the order rotations afterward. 2tan 2 pz 2 in which the matrices are multiplied   w rhpr p y h affects the resulting matrix. So, to fully Errata p′ =  r  + r y  2tan()θ w  p 2 understand the concatenation of rota- My article in the previous issue of Game 2 r z tions, we need to get the order straight. Developer (“Inspecting the 3D Pipeline, My sincere apologizes to anyone Take the following example: Part 1,” Dec 1996/Jan 1997) had a bug who was bitten by this. ■ in it. In the section on aspect ratio, I Casey Muratori is still too distraught p'= () KLMN p erroneously claimed that the value cal- over the bug in his previous article to finish Here we have four rotation matrices (K, culated for a should be used to scale the writing his bio. Those who wish to offer L, M, and N) multiplied together, trans- y values, and thus correct for the aspect their sympathies should do so at forming a single point. In what order are ratio of the display. If you look back at [email protected]. these rotations being applied? Is K hap- pening first, or is N happening first? Because matrix multiplication is associa- VECTORS AND THE TRANSPOSE OPERATOR tive, we can make the situation clearer by n 3D graphics, the word “vector” is often used without qualification. When dealing with associating the terms differently. matrices or complicated equations, however, it is often necessary to understand that   there are two different ways a vector can be written: as a column or as a row. When a p'= K L() M() Np I   vector is written as a single letter, it is assumed to be a column matrix, such as this: Now we can see what’s happening. N v occurs first, rotating the point p to a 1 v new point. Then M rotates this new v = 2 point, then L, and finally K. So, return- M ing to the original question, when we v n see a set of rotation matrices concate- Now, if we wish to refer to v as a row, we need to make that clear in the notation. We nated together, they will be applied need an operation that makes a column into a row. That operation is called, and it is rep- from right to left. resented by the transpose operator, a superscript T. As a side-note, there are some v T = vvL v interesting tricks we can perform once 12 n we understand the order of rotation con- The transpose operator is not restricted to vectors — it is simply the general operation of catenations. For example, suppose we exchanging columns for rows, or vice versa. For example, a two-dimensional matrix also have a spaceship object that points along has a transpose, given by the exchanging of its rows for its columns. T its z axis in object-space, and we’re keep- AAA AAA ing its current orientation as a rotation 11 12 13 11 21 31 A T ==AAA AAA matrix S. Now, if we want our spaceship 21 22 23 12 22 32 AAA AAA to do a roll, we have two options. We 31 32 33 13 23 33 Another important aspect of the transpose operator is that it shows the equivalence of the can figure out what the spaceship’s z axis dot product and a matrix multiplication. With a matrix multiplication, you multiply the is in world-space, build an arbitrary-axis rows of the first matrix by the columns of the second. The dot product can be expressed rotation matrix RA that rotates about as a matrix multiply by using the transpose operator. that axis, then preconcatenate it onto the ⋅=T spaceship’s current matrix, yielding u v u v = S' RA S If you’d like to read more about vector and matrix operations, a good place to start would However, we would waste a lot of be an introductory linear algebra book, such as Introduction to Linear Algebra by Gilbert time and energy if we went that route. Strang (Wellesley-Cambridge, 1993). Instead, we can build a primary z axis

http://www.gdmag.com GAME DEVELOPER • MARCH 1997 41 ARTIST’S VIEW

Getting Soft

oftimage — known to the small game developer to consider as a certified” OpenGL card (check with the initiated by its UNIX com- standard production tool. Happily, the company for an up-to-date list of com- mand-line nickname “Soft” barrier to entry has been lowered by the patible cards). That’s not a cheap sys- — has long numbered arrival in fall ‘96 of Softimage 3.51 for tem, but you can set up Softimage on a amongst the royalty of 3D Windows NT. Windows NT render farm for about the graphics tools. Its perfor- Microsoft — which purchased Sof- same cost as a single seat on an SGI mance in such high-profile timage in 1994 — saw to it that all the workstation. projects as Saturday morn- features of Softimage for SGI were The base package, Softimage 3D, Sing’s computer animated Reboot, the brought to its own more accessible Win- provides a seemingly bottomless treasure Hollywood special-effects blockbuster dows NT operating system. This means trove of top-shelf modeling, animation, Jurassic Park, and the coin-gobbling you can now run Softimage on Pentium and rendering tools in exchange for a arcade milestone VIRTUA FIGHTER — to Pro, Alpha, and MIPS RISC systems. It goodly chunk of your own treasure: name just a few — have made this soft- remains a demanding application, how- $7,995 to be exact. Softimage Extreme, ware an object of desire for many com- ever, and your Windows NT worksta- at $13,995, includes all these baseline puter animators. Desirable as it may be, tion will have to be stocked with at least features and adds a -based raytrace its home on the SGI platform has made 64MB RAM (you’ll want more), 200- renderer (dubbed “Mental Ray”), a meta- Softimage an expensive choice for the 300MB swap space, and a “Softimage- ball modeler (“Meta-clay”), a standalone particle generator (“Particle”), and a real- time 3D scene viewer (“Softimage Live”). Mental Ray is needed for distributed rendering, with additional licenses for render-only modules starting at $2,495. Note that an additional license is neces- sary even to make use of distributed ren- dering with a multiprocessor computer. In addition to bringing the high- end Softimage toolset to the Windows NT platform, Microsoft hopes to appeal to game artists with a host of new fea- tures tailored to our particular needs. Softimage 3.51 boasts robust polygon reduction tools, palette control, a pain- less UV texture manipulation feature, motion-capture support, and export for- mats for Sega Saturn, Playstation, Direct3D, and VRML. Accordingly, a number of companies, such as Digital Domain, Electronic Arts, and Psygnosis, The Softimage interface showing depth-cue, shaded, ghost, and schematic windows. With have joined Sega in adopting Softimage Matter module active, the menu cells to either side offer an array of tools for assigning and as their 3D standard. So let’s take a clos- manipulating material and texture assignments. er look at its features and see if you want to get on that bandwagon.

42 GAME DEVELOPER • MARCH 1997 http://www.gdmag.com Windows Defenestrated UNIX, drop-down menus follow their David Sieks Though its somewhat windowfied inter- own logic, and even the mouse buttons face may appear friendlier than one behave differently than expected when expects from software with a UNIX used to highlight text entries. A com- With Hollywood pedigree, Softimage still presents a for- puter-literate user can adapt to these midably steep learning curve. Witness differences in relatively short order, but the manuals: over 20 pounds of them, it remains somewhat awkward when occupying roughly a linear foot of shelf one is moving between Softimage and space. Given this abundance, it would be other applications that do follow Win- unfair to slight Microsoft for not provid- dows conventions. special-effects ing sufficient documentation; but under- Despite its quirks, working with the stand that this mass of paper is more a Softimage interface is relatively simple testimony to the breadth and depth of and efficient once you get to know your the Softimage toolset than to the thor- way around. View windows take up most oughness of the manuals themselves. of the screen real-estate, flanked to the credits and SGI roots, After working through two books left and right by vertical rows of “menu of tutorials, you’ve barely scratched the cells” (tool buttons), and below by the surface of Softimage’s features, and the ubiquitous time slider and a handy status encyclopedic reference volumes leave the bar that prompts you for the mouse but- complex workings of many details largely ton functions relating to the currently Softimage 3D comes unilluminated. That’s par for the course selected tool. This layout remains con- with a fully-featured professional tool: stant as you switch freely between five Real mastery of the software can’t be different internal “modules”: Model, printed in a book; or even, apparently, in Motion, Actor, Matter, and Tools. In 20 pounds of books. You can spend an each module, most of the menu cells awful lot of time tinkering with vaguely change to provide an appropriate toolset to Windows NT with a described settings to get the results you for that area of functionality. require. The upside is that, for once, The buttons are called menu cells you’ll have more features than you know because, when clicked, each opens a what to do with. Fortunately, a helpful drop-down menu listing possible appli- user’s e-mail list is available for swapping cations of that tool. Many of those host of welcome new tips and commiserating. List members choices lead to yet another drop-down have even made home-brewed tutorials menu, and another, and another. If the and a searchable archive available on the sheer volume of options isn’t enough to World Wide Web. confuse you, the fact that they appear to Minor though it may be, the non- be in completely random order will. standard interface is another hurdle Here’s a free design tip for Microsoft features for the game that Windows users must overcome. when they tackle the next revision: Softimage runs just fine on Windows alphabetize. Fortunately, oft-used func- NT, but has yet to adopt Windows tions can be more quickly invoked by conventions, despite being a Microsoft employing a variety of shortcuts: most product. The directory structure is pure notably, preset and customized “Supra developer.

http://www.gdmag.com GAME DEVELOPER • MARCH 1997 43 ARTIST’S VIEW

ly, the sheer number of features crammed ship will update the object when the into Softimage, combined with the hap- original curve is edited. hazard placement of many controls, Included in the basic package, makes the package something of a maze NURBS provides a flexible approach to to the uninitiated. Nonetheless, one modeling. A NURBS curve can be pro- quickly discovers that almost any func- jected onto a NURBS surface to easily fit tion is only a couple of mouse clicks curved sections together. It is also possible away, and the Supra keys make it easy to to “trim” a NURBS surface: to punch a get into a productive groove. hole in it or cut away unwanted parts, leaving a tailored shape. This is a very Super Model powerful modeling tool, allowing for a lot Modeling tools in Softimage are numer- of control over the creation of smoothly ous and hard to fault. Modeling ele- curved objects and organic forms. ments can be combined within a scene, Meta-clay in the Extreme package is letting users mix polygons, patches, and a good metaballs modeler that essentially a variety of curves including Linear, lets you build a compound object (a Bezier, Cardinal, B-spline, and NURBS. “meta-clay system”) by globbing together I was somewhat surprised to find that meta-clay “elements.” Elements within a Game developers such as Cyan, CAP- Softimage provides one of the easiest system can be blended together to create COM, Electronic Arts Canada, NAMCO, Mindscape, Rocket Science, and and quickest means for switching smooth, clay-like sculptured forms. This Tribeca Interactive are discovering between manipulation of objects, points, meta-clay system can then be used to Softimage. (Image from TEKKEN2 cour- polygons, or object centers, which is “skin” a skeletal structure for animation. It tesy NAMCO.) especially helpful when creating low- can also be converted to a polygonal mesh, count models for real-time applications. which is a lifesaver if you need to export a As mentioned before, Softimage meta-clay model into another application. keys” on the keyboard. These shortcuts includes excellent polygon reduction help to maintain a productive workflow. tools for rule-based or optimization- Material World The view windows themselves pro- based simplification of geometry. Any The Softimage approach to materials and vide some extremely useful features. production environment will benefit textures is very practical and more Geometry in each window can be shown from having scene geometry optimized. straightforward than other 3D animation in a variety of display modes, including Still, the best way to create a low-count tools with fewer and less flexible features. the standard wireframe and shaded, plus model is to build it up from scratch, rotoscoping in wireframe or shaded rather than optimize a more detailed modes, depthcue (a wireframe display in model. The ease with which polygons which more distant geometry is faded), and points can be manipulated in Soft- ghost (which shows the current frame image makes this approach not only fea- and bracketing keyframes for traditional sible, but enjoyable. in-betweening), and a matte view. You Modeling of an object often begins can also color-code wireframes, which with basic building blocks called geo- helps greatly in keeping track of things metrical primitives. Softimage lets you in a busy scene. A handy schematic win- choose between primitives derived from dow can be opened in place of any of the polygons, spline patches, or NURBS. view windows, showing a hierarchical Boolean operations can combine or sub- tree for all objects in the scene. Also, in a tract objects from one another and can special “Fcurve” window, users can view be performed on polygon, patch, or and edit function curves on which the NURBS objects, though the resulting value of an animated parameter over object is always polygonal. You can also time is plotted graphically. animate boolean operations. Other amenities include a save- Still another modeling approach is scene feature, which stores the current to draw curves (linear, cardinal, bezier, Artists at Psygnosis used the advanced version of the scene without overwriting B-spline, and NURBS), adjust the modeling, animation, and rendering the previous version (up to a user-defined placement of points and spline tension, features of Softimage in the lush intro number of iterations), and an option to and then sweep these curves into an sequence for their new Playstation view thumbnails rather than filenames of object by extruding, skinning, or revolv- title, TENKA. rendered images in a directory. Ultimate- ing them. Defining a modeling relation-

44 GAME DEVELOPER • MARCH 1997 http://www.gdmag.com ARTIST’S VIEW

Multiple image maps can easily be layered Animation Arsenal An even flashier subset of anima- and blended together, allowing complex The animation choices in Softimage tion features is the dynamic simulation. bump, reflectivity, and transparency map- seem limitless. There is, of course, the This defines and simulates the physical ping. The Mental Ray renderer adds a traditional keyframing approach. Com- forces, such as gravity and wind, that act displacement mapping option: Map fea- bined with the useful “ghost” view on objects in your scene; objects blow in tures actually alter object geometry at ren- option, excellent inverse kinematics the breeze of a virtual fan, fall as though der time, letting you render an object that capabilities, and the ability to view and impelled by gravity, or bounce when they is geometrically more complex than what manipulate function curves for all collide with a surface. Dynamic simula- you’ve actually modeled. keyframed events, keyframing gives you tion is an amazing shortcut to certain A simple paint program is inte- all the tools necessary to craft a convinc- realistic animated effects and can be used grated with the Softimage texture tools. ing movement sequence. There are many in conjunction with all other Softimage Its capabilities don’t rival those of a other approaches to animation in Soft- animation tools. dedicated paint program, but it can be image, however, and some of them can Expressions can provide several helpful to paint on a 2D map and see save you a lot of the time and effort of other animation shortcuts. These can be the texture updated on your 3D model keyframing, as well as help you achieve as simple as constraining one object’s after each stroke. More useful, howev- more convincing results. movement to that of another: one actor er, is the UV editing feature that is Traditional squash and stretch turns its head to follow the movement of built into the paint tool. UV editing effects are simplified in Softimage with another, for example. Expressions can tie lets you select a section of a map to the Quick Stretch feature. The linear movement to an external channel, caus- apply to a particular polygon. This is a and rotational velocity of an object auto- ing an object to move in response to very handy tool for editing the default matically deform it to help convey a channel input, such as mouse movement. UV mapping of a polygonal model, and sense of movement. The user can define More involved expressions can be written one that game artists, in particular, are parameters that limit the amount of flex, to create complex interrelations between sure to appreciate. stretch, and yield exhibited by the object, object movement and varieties of channel The standard Softimage renderer as well as set the center of deformation. input. Softimage is also well prepared to provides high-quality ray-traced render- You can actually see the squash and accept motion capture data from various ings. The “mental ray” renderer that stretch effect being applied as you move tracking systems, such as Polhemus, comes with Softimage Extreme, on the the object around the screen. Ascension, Biovision, and others. other hand, is a real standout feature. Mental ray uses “” — procedural routines — to affect how an object is HARDWARE FOR A SOFT WORLD rendered and can actually alter object he availability of Softimage 3.51 on the Windows NT operating system opens this geometry. Shaders are far more powerful high-end software to a whole new class of machine: the “personal workstation.” than the surface fakery of bump maps. While you may no longer need a Silicon Graphics workstation to take advantage of Material shaders can create realistic the power and features of Softimage, some serious hardware is still required to effects ranging from glass to fur. Volume run it at all. To truly work productively, you’ll want a thoroughbred system indeed. shaders can be used to create atmospher- TI’ve been running Softimage on a TDZ-410 from Intergraph’s line of Pentium Pro work- ic effects such as wispy fog, fire, or stations featuring the RealiZm graphics card. With dual 200MHz P-Pro processors, 128MB smoke, or to define areas of transparency ECC memory, 2GB Ultra-SCSI disk, 8x CD-ROM, and a RealiZm Z13 graphics card with 16MB that can extend through an object, such frame buffer and another 16MB texture memory, this is only a middling powerful system as holes through Swiss cheese. Shadow in the Intergraph line-up. It pushes Softimage around the screen with no problem, han- dling large scenes with aplomb, allowing fluid interactivity during transforms of complex shaders affect the shadow cast by an objects, and smoothly performing textured, full-screen playback. Rendering times were object, such as a green glass bottle. Light also impressive — especially so in the more roundly multithreaded 3D Studio MAX, which shaders can be used to create projection can divide its scan-line rendering between processors. effects. Several shaders are packaged Configurations are available sporting as many as four with Softimage Extreme, and some of processors, as much as 1GB four-way-interleaved RAM, them are astounding, such as the Oz hardware RAID, and RealiZm graphics with up to 64MB shader, which creates absurdly realistic frame buffer, 64MB texture buffer, and dual screen user-definable sky effects. Though more support! List price for my workstation configuration canned shader effects would be welcome, with a 21" monitor was $18,690. Expect to pay roughly users can create their own custom 85% of that through a dealer. shaders using the C language. A Mental Intergraph Computer Systems http://www.intergraph.com/ics Ray programmer’s guide is included in (800) 763-0242 the documentation.

46 GAME DEVELOPER • MARCH 1997 http://www.gdmag.com ARTIST’S VIEW

But Wait, There’s More! But until that dream does come true, In the space I’ve got here, I can’t hope to Softimage 3.51 is here; and it’s already a touch on all the features available in Sof- pretty dreamy package. timage, but a few more major ones Regardless of what you might have deserve mention. heard about its “difficulty” (or what you Particle, the pixel-based particle might have heard me muttering during system generator included with Softim- the first week I spent learning it), Soft- age Extreme, can be used to produce image is no harder to use than any other some great effects. With it, you can cre- full-featured 3D software and easier ate particle effects ranging from sand- than many. You’ll find it packed with storms and snowstorms to contrails of features to help you create glitzy and flame and smoke. Global forces such as gritty animation. It also now caters wind or gravity can be created, and enthusiastically to the needs of game their effect on the particle system developers, with polygon- and color- defined. The options and parameters reduction tools; UV texture manipula- provide a lot of flexibility for a wide tion; export formats including DirectX, range of effects. SEGA Saturn, and Sony Playstation; A minor but not insignificant prob- extensive motion-capture support; the lem is that Particle works only as a Softimage Live viewer for interactive standalone utility. You import a 3D previews of 3D environments; plus more scene into Particle and generate effects game-centric features planned for to match an existing animation. It is upcoming service pack updates. possible to define a Z channel so that With Softimage, there’s a way — particles correspond to the depth of the and usually several ways — to accom- scene. The end result is quite good, but plish almost any 3D effect you’re likely an integrated solution would be prefer- to want. When you add the flexibility of able. A related drawback is that, unlike customizable shader effects in Mental Softimage 3D itself, Particle does follow Ray, you’ve truly got a serious package standard Windows interface conven- for the serious user. If you’ve got a tions. This inconsistency makes it all the demanding production environment, if more difficult to segue smoothly from you’ve got 3D needs that range from one to the other. gorgeous, prerendered animation to Another Softimage extra of note is polygon-scrimping real-time models, the free Multiped plug-in, which pro- and if you’ve got a healthy budget, then vides canned walk routines for several- Softimage is hard to beat. ■ legged creatures. This is a nice shortcut Dave Sieks is a contributing editor to to what can be an extremely complex Game Developer. You can contact him via animation task. Realize, though, that e-mail at [email protected]. the motion produced is quite generic and needs to be tweaked with Softim- age’s routine animation tools. Though Softimage it one-ups the Character Studio plug-in for 3D Studio Max by providing a sort Softimage 3.51 for Windows NT of “Animation Helper” for quadrupeds Microsoft Corporation and even leggier actors, in other One Microsoft Way respects it does not match the flexibility Redmond, WA 98052-6399 Tel: (800) 576-3846 of that program. Web: http://www.softimage.com Any day now, we should see the Price: Softimage 3D: $7,995; Softimage next incarnation of Softimage, dubbed Extreme: $13,995 Sumatra, which promises to function as System Requirements: Pentium Pro, Digital an integrated component of a complete Alpha, or MIPS R4400 processor; Windows digital graphics suite. That sounds like a NT 3.51 with Service Pack 2 or higher; 64MB dream come true for anyone who has RAM; 1GB hard disk; 200MB swap file; CD- struggled with compatibility issues ROM drive. (Also available for SGI worksta- between different graphics applications. tions.)

48 GAME DEVELOPER • MARCH 1997 http://www.gdmag.com CHOPPING BLOCK

DreamWorks’ The Neverhood

very once in a while, a game words come up repeatedly: “quirky” and How to Get Stuck comes along that breaks the “simple.” In breaking out on their own, The philosophy of puzzle design at Nev- mold in some form. In the Neverhood was determined to put its erhood is to keep games simple and fair. case of THE NEVERHOOD, it’s own style of simple, quirky humor and “I try to make puzzles that just about somewhat ironic that the art onto the gaming scene. Thanks to anybody can figure out.” TenNapel mold-breaking came from their innovative use of claymation and explained. “We try not to create unfair mold-making. Clay molds, to their overall philosophy of game design, or mean puzzles that punish the player. be exact. they succeeded. Many puzzles in other games are too ETHE NEVERHOOD, released this The game started out as many hard to complete. We deliberately past November, is the first computer game titles do, with eight developers designed easy puzzles to give players the game to use claymation throughout, working out of TenNapel’s home. The feeling of accomplishment.” including all of the characters and developers began the game-design The developers at Neverhood scenery. The game was created by Nev- process by drawing some sample puzzles believe that a game consists of two erhood, a company founded in 1995 by a on paper. The look-and-feel of the game player states: a player is either making small group of designers — including was based on TenNapel’s years working progress or is stuck. According to Ten- five animators who worked on the suc- in fine art. Napel, “The fun part of a game is when cessful EARTHWORM JIM title. Never- While constructing the puzzles you’re making progress. However, you hood’s president Doug TenNapel was and the storyboard for the game, the also want to get stuck, because you the creator of EARTHWORM JIM, as well development team adopted the philoso- want to use your brain. You just don’t as its lead animator. When talking with phy that it was best to overdesign ini- want to get stuck forever. The chal- TenNapel about THE NEVERHOOD, two tially and scale back later if necessary. lenge is to make it a pleasurable experi- “We tend to over- ence to be stuck.” design every- As with its predecessor, EARTH- thing,” TenNapel WORM JIM, THE NEVERHOOD has explained. “As excellent characters, takes place in a production goes novel world made entirely of clay, and on, we cut out the spices up game play with humor. “I like nonessentials or to make the lead characters under- the ideas that are dogs,” said TenNapel. “Imperfect char- too hard to im- acters tend to have an innocent quality plement. This to them.” works out to When it comes to livening up a about half of the game with comedy, TenNapel sticks to ideas. You never the basics. “Humor in games often know if an ele- comes in the form of little one-shot ment is going to jokes. But games aren’t like sitcoms. You The completely clay look of THE NEVERHOOD immediatly sets it apart be strong or weak can’t refer back to broad instances, pre- from any other game out today. This ground-breaking look is backed until you put the vious situations, or running gags — the up by THE NEVERHOOD's simple interface, offbeat humor, and puzzles engine together jokes have to stand on their own. Our designed for a broad audience of game players. and see what jokes tend to rely on physical humor, as works.” you’d see in a clip of Charlie Chaplin.”

50 GAME DEVELOPER • MARCH 1997 http://www.gdmag.com By Ben Sawyer Once the design stage was com- through RAD Software’s Smacker for a plete and the team felt they had enough last blast of compression. These puzzles worked out, actual development sequences are seen in the first-person began. Oddly enough, the catalyst at 3D sections of THE NEVERHOOD. The Not many game this point was office space. “Once we animation worked out to 15 frames per had office space, we could begin the second. Compared to Saturday morn- research and development.” TenNapel ing cartoons, which clock in at 12 needed a bigger working space primarily frames per second, THE NEVERHOOD because THE NEVERHOOD required is actually superior. development teams entire clay sets to be built and filmed. Most of the game’s main charac- Of the 6,000 square feet the company ters were created using latex, which moved into, 2,000 square feet of it was a looks like clay when filmed. These latex warehouse attachment where the clay puppets are supported by a metal skele- sets and puppets were created and ton, which puppeteers use to set the can boast that they filmed. poses during animation. Bolts on the For TenNapel, the creation process skeleton are loosened and retightened for the game’s graphical content was to create a new pose. Small slits in the challenging. “We’re inventing processes latex, which are invisible to the eye, that just didn’t exist before for capturing give the puppeteers access to the skele- images for video games.” The company ton’s joint. After a character has been blew through 3.5 tons became a test site for the Minolta RD175 repositioned, it is bolted down to the digital still camera. set for the shot. Using stop-motion Characters that animation tech- leave the floor niques, images from are positioned of clay during the camera measur- on poles or with ing 1,100×1,400 string, which pixels were crunched can be edited through Equilibri- out later. um’s Debabelizer for To avoid production. Welcome palette and resolu- as many palette tion reduction. Se- problems as quences were then possible, char- assembled in Auto- acters were kept desk Animator. simple and had Once up and run- little detail. The to Doug TenNapel’s ning in Animator, palette for the special effects and After EARTHWORM JIM, Project G.eeK.eR, and lead character, sound were added. now THE NEVERHOOD, what curious characters Klayman, used Finally, the Auto- will Doug TenNapel bring us next? only enough desk files were run colors to show Neverhood.

http://www.gdmag.com GAME DEVELOPER • MARCH 1997 51 CHOPPING BLOCK

the figure’s vol- outside sets, which openly share information. In return, we ume, not excessive are featured in shared our experiences with them,” says detail. The shad- first-person 3D TenNapel. ows and high- scenes as you ven- One of the biggest problems for the lights were made ture to and from stop-motion animation technique was as smooth as pos- various areas in the adequate lighting. Two 30’×30’ ligh- sible, and as Ten- game. “We used tracks were brought in to remedy the sit- Napel pointed Van Akin and uation, and TenNapel said that the team out, “unlike poly- Harpets Clay. had to modify the electrical power in gons, clay casts Harpets is import- their building. A peer-power source was real shadows.” ed from England. brought in to distribute an equal amount For the char- It’s what they used of power to each of the lights to keep acter sprites, to create [Nick them from fluctuating. Bulbs were Smacker was drop- Park’s Oscar-win- changed often. Cameras were reserviced ped in favor of ning characters] and recalibrated to ensure that the CCD Neverhood’s own Animated characters were built with metal Wallace and chips weren’t getting oversensitive to sprite-handling skeletons with laytex skin and then animat- Gromit. Van Akin certain lighting conditions. engine, dubbed ed using digital cameras and stop motion is what Will Vin- To complement THE NEVER- ToolX. All of THE techniques. ton used to create HOOD’s unique graphics, TenNapel NEVERHOOD was the California recruited underground music star Terry coded in C++, Raisins.” Never- Taylor, a favorite of his for many years. using only a few of Microsoft’s DirectX hood consulted frequently with special- Taylor was given a simple mandate: “Just APIs. Actual work (animation testing and effects experts and animators who’d make the music sound sloppy and drunk, main-engine coding) started in October done stop-motion animation. “These and don’t compose anything that 1995, and the game engine was refined experts are a tight-knit group that remotely sounds like videogame music.” and extensive content creation began in January 1996. About four months of the game’s development time was pure MARKET PROFILE R&D. Debut Building a Neverhood. THE NEVERHOOD is shipping now. A Macintosh version is possible, provided sales of the Windows version are good. DreamWorks If any statistic tells the story of the states that only about an eighth of their fan mail comes from Mac making of THE NEVERHOOD, it’s the people looking for a port. three-and-a-half tons of clay that went Distribution into the creation of the game’s sets and CD-ROM. Retail SKU being distributed by Microsoft as part of sprites. Many of the sprites, all of the the DreamWorks label. rooms’ interiors, and the entire outside world were constructed by hand from Marketing Campaign Net advertising and heavy publicity is being provided by clay. It took months to construct the Microsoft and DreamWorks. TenNapel and Co. went on a nation- interiors, exteriors, and characters from wide tour of free media the week the game came out. the storyboards (the sets alone required three months to build and included the Competitors TenNapel’s former company, Shiny, is expected to debut its new bulk of the three-and-half-tons of title, which could court some longtime EARTHWORM JIM fans. clay). The game uses over 20 minutes Other than that, THE NEVERHOOD was up against everything else of animated video and 50,000 frames this Christmas. of film. Outlook Mark Lorenzen, creator of VEC- The reaction from the game press and players has been very posi- TOR MAN, built the interior back- tive, with Microsoft’s solid distribution, novel gameplay, and grounds for THE NEVERHOOD. Wood- DreamWorks marketing touch, the outlook is good. A marketing en boxes and planters from Home stategy that’s focusing on the nongaming press (Headline News, Depot were lined with clay to create USA Today, and others) has generated very favorable response. room interiors, which were then shot While his next product is not a claymation game, TenNapel with the Minolta. hopes that THE NEVERHOOD sparks developer interest in the graph- Ed Schofield, Eric Ciccone, and ic format. John Lorenzon labored intensely on the

52 GAME DEVELOPER • MARCH 1997 http://www.gdmag.com DEVELOPMENT PROFILE Interactive and Microsoft. “The biggest thing DreamWorks brought to the table Development Team: was their hands-off policy. They funded Eight team members, five artists and animators, five program- us, approved our ideas, and let us go.” mers. According to TenNapel, Microsoft Language Used: helped extensively by providing installa- Microsoft Visual C++ 4.1 tion routines and beta-testers. Seeking to Content Tools Used: dispel the Microsoft reputation, Ten- Adobe Photoshop 3.0.5, Autodesk Animator Studio 1.1, Sound Napel praised the giant for its approach. Forge 3.0, and Debabelizer for Macintosh 1.6.5. “Microsoft wasn’t a juggernaut pushing Three-and-a-half tons of Van Akin and Harpets clay and latex pup- us around. They’re very sensitive to game pets over skeletons. developers and respectful of our experi- A complete production-quality lighting scheme. ence. I’d never had this much control on Special Libraries: a project before.” DirectX 2.0 use was limited; sprite-handling routines for charac- “We looked at what the game ters were created and dubbed ToolX. industry was about and just kind of took Hardware Specialties: a great big left turn,” says Tenapal. The camera used was a Minolta RD175 Digital Camera. Calibra- “Simplicity is our number one rule of tion and lighting are key to CCD cameras, which require recali- design. And being quirky.” ■ bration to avoid adaptation to custom lighting conditions. Based in Portland, Maine, Ben Sawyer writes and consults about the interactive and consumer technology The developers at Neverhood opted for For the Neverhood team, the chal- industries. His latest book, The Digital large .WAV files, rather than using the lenge of constructing and working with Camera Companion (Coriolis Group MIDI format, due to .WAV’s superior the clay models was offset by support Books) is out now. He can be reached at audio quality. from big-name partners: DreamWorks [email protected]

http://www.gdmag.com GAME DEVELOPER • MARCH 1997 53