In Scientific Research
Total Page:16
File Type:pdf, Size:1020Kb
Michael Lewis and Jeffrey Jacobson GAME ENGINES IN SCIENTIFIC RESEARCH SERIOUS COMPUTATIONAL province of the military and high-end VR labs seek- ing to drive costly peripherals such as Caves, data- RESULTS ARE DERIVED FROM gloves, and head-mounted displays (HMDs). In COMPUTER-BASED GAMES. the past two years, however, the situation has changed remarkably. Now the mass market for ix-figure workstations and custom soft- computer games, grown even larger than the movie ware are not producing the best graphics industry, has expropriated the best in computer or virtual reality simulations anymore. hardware and software for itself. The most sophisti- Today, the only way to have the fastest, cated rendering pipelines are now found not on most realistic simulations and sophisti- specialized scientific machines but on PC video Scated graphics is to trade down from the expensive cards costing less than $500. The most sophisti- gear to standard PCs running game software. Vir- cated, responsive interactive simulations are now tual reality (VR), augmented reality (AR), and found in the engines built to power games. high-fidelity physical simulation have long posed Despite the stigma of violence and gore associ- too high a barrier to entry for any but the most gen- ated with first-person games, there has been a long erously funded researchers. Significant advances in history of unpublicized cooperation between com- computer graphics in these areas have traditionally puter scientists and the game industry [1, 2]. depended on expensive, specialized graphics hard- Games have provided the first and sometimes the ware running on scientific workstations. High- only market for advanced graphics techniques, fidelity simulation/graphics software has also demonstrating the extent to which realism could remained an expensive niche market largely the be conjured up even from relatively weak graphics COMMUNICATIONS OF THE ACM January 2002/Vol. 45, No. 1 27 environments using artistry and texture maps. Modular game engine structure. The cost of developing ever Level editing more realistic simulations has Virtual Worlds grown so huge that even game Reprogramming Game Code developers can no longer rely on behaviors To other instances recouping their entire investment Net- Server from a single game. This has led Engine work of the game Code to the emergence of game Graphics Drivers engines—modular simulation code—written for a specific game Operating System but general enough to be used for a family of similar games. This separability of function from content is what now clever split of rendering pipelines between entities and allows game code to be repurposed for scientific environment was needed to attain sufficient speed. In research. place of peer-to-peer networking it provided a Early computer games consisted of little more than client/server architecture with the game state main- the event-loop, state tables, and graphic routines tained on the server while the compute-intensive 3D needed by simple 2D games such as Space Invaders, engine ran on the client. Quake also extended its pro- Galaxians, or Raptor. The 1993 release of Doom by id grammability to provide the first game-independent Software ushered in a new era of game design and play. game engine providing both a level editor for changing Although not the first game to offer an immersive first- layouts and QuakeC, a byte-compiled scripting lan- person perspective, Doom was the first to do so suc- guage, for changing behavior in the simulation. cessfully. It achieved a sense of realism even on the Quake II extended the performance and fidelity of 80486-based PCs of the day by assiduous use of texture Quake, adding support for hardware-accelerated maps, 2-1/2 D/4 DF animation, and other program- graphics that were just beginning to appear on PC ming tricks. This tradition of coaxing more realism video cards. With the release of Quake III Arena and than possible by brute force continues to distinguish Epic Games Unreal Tournament in 1999, game gaming simulations from their scientific counterparts. engines reached their present mature state. Both games Two other features significant to scientific users intro- are strictly multiplayer with single-user play simulated duced by Doom were multiplayer play over a network through play against a synthetic opponent. They each and user/third-party programmability. provide extensive support for hardware acceleration, Because Doom and its descendants have been and support user modifications through level editors designed from inception for network play, their archi- and scripting languages. As with Quake II, Quake III tectures have more in common with large-scale distrib- Arena makes the C language game source code avail- uted military simulations such as SimNet or ModSAF able, keeping only the graphics engine code propri- than VR systems such as World Toolkit or languages etary. Unreal Tournament is set up in much the same such as VRML. By elevating the problems of updating way, except that its open source game code is written in and synchronization to a primary concern, game UnrealScript, a bytecode-compiled scripting language engines provide superior platforms for rendering mul- similar to Java. Although there are more than 600 com- tiple views and coordinating real and simulated scenes mercial game engines including the high-concept as well as supporting multiuser interaction. Despite its graphics of Everquest’s LithTech engine, Quake III initial success, Doom’s peer-to-peer architecture with Arena and Unreal Tournament provide the most devel- parallel games updating in lockstep proved cumber- oped, flexible, and usable engines for research purposes. some and has been replaced by client/server schemes in later games. The Doom engine offered only the mini- What are Game Engines? mal degree of programmability by providing a generic In today’s modularly constructed games, the game’s game executable to which the user could add data in a engine refers to that collection of modules of simula- prescribed format. The new levels had changed layouts tion code that do not directly specify the game’s behav- but continued to look and play just like Doom. Later ior (game logic) or game’s environment (level data). games have significantly expanded programmability. The engine includes modules handling input, output Quake [1] was a lessons-learned follow-on from id (3D rendering, 2D drawing, sound), and generic Software. It was truly 3D with environment and actors physics/dynamics for game worlds. The figure here made from texture-mapped polygons, although a shows this overall structure. 28 January 2002/Vol. 45, No. 1 COMMUNICATIONS OF THE ACM At the top level are the virtual worlds or scenarios that object must exist for all the other players and be in with which the players interact. They come in a wide the same state. range of appearances and rules of interaction, even dif- ferent types of simulated physics. Many are authored by Scientific Use of Game Engines fans of the game, who primarily use an advanced pro- While control is the key to science, game engines are by gram development environment that comes free with design opaque. Speed-up strategies such as swapping the game itself. Often they include components of texture maps as distance increases produce the illusion of existing worlds or are built using knowledge the authors reality but can leave the experimenter without cleanly freely exchange via the Web. manipulatable parameters. Precise behavior of control The level below is the game code, which handles systems, as found in Microsoft Flight Simulator, or most of the basic mechanics of game itself, like simple response of materials to stress are not usually part of the physics, display parameters, networking, and the base- worlds simulated by game engines. If, on the other or atomic-level actions for animations such as hand, ecological validity is crucial to the research, pho- autonomous agents or behaviors in the player’s own torealistic game engine graphics and animations will avatar. Altering the game at this level requires a more work far better than well-controlled but more primitive detailed knowledge of its internals and is accomplished scenes constructed in a principled way. If research using a game-specific scripting language. requires only faithful maintenance of player, object, and The rendering engine is the terrain locations then game engine crown jewel of the game. It incor- fidelity is completely adequate. porates all of the complicated code While precise multimodal VE needed to efficiently identify and simulations such as those required render the player’s view from a Coaxing more for remote surgery will continue complex 3D model of the environ- realism than possible to demand custom solutions, for ment. The rendering engine is a by brute force most VE applications a game proprietary black box and not open continues to engine can add value by perform- to any kind of user modification. distinguish gaming ing 3D bookkeeping, providing The networking code supports simulations from networking and synchronization, a robust, built-in networking pro- their scientific or driving high-fidelity hardware- tocol similar to DIS/HLA, which counterparts. accelerated graphics. allows several users in remote loca- The research projects described tions to explore and interact in the in the short articles in this section same virtual environment (VE). illustrate the variety of ways in One computer acts as the server or host for the envi- which game engine capabilities can be repurposed for ronment, while the others support the individual users. research. Gal Kaminka’s GameBots, Bylund and Networking code is so efficient and well-developed in Espinoza’s QuakeSim, and John Laird’s artificial intelli- Unreal Tournament and Quake III that players on a gence systems all de-emphasize game graphics in favor low-latency local-area network can expect to get syn- of game engines’ capabilities as general-purpose 3D chronization that exceeds frame rate of their displays.