<<

Towards Articulate GameEngines Daniel Jeffery Dobsonand Kenneth D. Forbus Northwestern University Department of Computer Science 1890 Maple Ave. Evanston, IL 50201 { wolff, forbus } @cs.nwu.edu From: AAAI Technical Report SS-99-02. Compilation copyright © 1999, AAAI (www.aaai.org). All rights reserved. Abstract difficulties that must be overcomein building articulate Conventional simulators lack explanatory power. gameengines. Traditional simulators provide the dynamicbehavior needed for a gaming world, but do not provide conceptual understandingsof the world to players or gameA.Is. By creating gameengines that havea qualitative understanding WhyTarkin is doomedin today’s of the systemthey describe, authors can moreeasily build richer and smarter gameagents. This paper outlines why engines should include more conceptual Consider first the Sim gamesfrom . In gameslike understandings,suggests some relevant AI ,and SimCity[2] or SimEarth[3], which are combinations of speculateson howthis mightbe accomplished. cellular automata (CA) and system dynamics(plus a other ingredients) are combinedto provide a rich simulated Inroduction world. The CAcomponent provides a sense of space and locality, as well as discrete changesbased on both local properties and global properties from the system dynamics "We’veanalyzed their attack sir, and there is a danger." aspects of the model. The differential equations of the system dynamicscomponent provide global interactions, In "Star Wars," [1] the GrandMoff Tarkin had logistical integrating the properties of cells into aggregate support whenbattling the rebels. His aides founda critical parameters, such as overall crime levels in a simulated . weaknessin their ownsetup and had generated an escape These causal relationships then help drive the interaction of plan. Unfortunately, players never experience such rich the CAcomponent. The very richness of this interaction interactions with their computeradvisors or opponents. which makesthese simulations so appealing can also lead Computeradvisors tend to be simplistic and sensitive only to dreadful confusion on the part of players: Whydid my to simple global features of the situation. Theytend to be attempt to terraform Venussuddenly fail? predictable and often not good enough, relying on hidden information and massive cheating (e..g, accelerated Explaining the simulations developmentand extra resources) to give their human players a good game. If the Grand Moff Tarkin were a Gamedesigners often explicate parts of their modelsin the typical computerplayer, he wouldcontinue to construct interface, documentation,or software advisors, but these Death Star after Death Star, watching the humanplayer partial modelsare usually unsatisfying (to both player and knockone off after another without ever revising the plans designer). Moreover,the advice given is not based on to removethose darn trenches. (Even George Lucas only conceptualunderstanding of the player’s current situation. tried to makeit worktwice.) Typically their advice is morelike a warninglight on a dashboardthan a detailed analysis of the player’s position. Wedescribe howsome ideas developed in artificial "Youdon’t have enoughfire departments" is muchdifferent intelligence, notably qualitative reasoningand self- than "Yourfire departmentsaren’t strategically placed." explanatory simulations, might help improvethis situation. By creating gameengines that have a conceptual Of course, keeping the appropriate amountof mystery in a understanding of the gamingworld, gamescould include gameis important -- experimentingand playing detective is better advisors and opponents, as well as automating more often a critical source of enjoyment-- but the game of the construction process. Westart by designer should have a broad range of options as to how examiningthe need for a built-in conceptual understanding muchinformation to provide and in what form, rather than of the gameworld, then describe how/~qualitative being minimalist because that is the only feasible option. representations could provide that u~derstanding. Then we describe a particular , self-explanatory Computer players simulators, illustrating their potential for creating game Interactions with computerplayers, as opponents, advisors, engines that contain such built-in understandingwith very or just passers-by, help draw a player into the gameworld. small runtimepenalties. Finally, we list someof the Anunderstanding of the events of the simulated world are also important for creating richer computercharacters. In

32 gameslike Civilization II [4] and Ageof Empires[5], description is somethinglike "goes up, comesdown." computerplayers are governedby simple scripts, build- Qualitative representations impose symbolic descriptions lists, and carefully-tuned mechanisms.The conceptual on continuous parameters, making them amenableto description of the gamingworld, which governs the conceptual reasoning. designer’s crafting and tuning of the worldand its bots, is nowhereexplicit in the computationalengine itself. If Whatkind of conceptual reasoning do you need to do? If players find fundamentalweaknesses (say, trenches in what is thrownis a piece of Waterfordcrystal rather than Death Stars), there is no conceptual knowledgeto fall back just a ball, one might decide to maneuverto get underneath on. it before it falls. A feeling for the quantitative is necessary to understand where you need to physically be and how Yet it is this conceptuallevel of knowledge,tied soon you need to get there, but it is qualitative knowledge appropriately to the detailed mechanicsof the world(e.g., that tells you that you have this dilemmain the first place. qualitative humanperception, in the case of the real world), Moreover, qualitative knowledgeprovides concise that is typically used as a guide to categorizing events and summariesthat makeit easier to spot complexbehavior to act accordingly. Computerplayers that understood the patterns. It is easier to extract a pattern like "decaying causal relationships that govern the gameworld could oscillation" from a sequenceof strategize, plan, and advise better. Understandingthe game UP/PAUSE/DOWN/COLLIDEevents where the energy at worldwill also help interpret the humanplayer’s actions, each subsequent PAUSEis lower than it is from the raw enabling responses that help makethe humanplayer feel numericaldata. (In fact, in engineeringqualitative more visible, and hence more engaged, in the gameworld. reasoning techniques are being used to create useful, humanqikedescriptions of very complexbehaviors, A technologyfor articulate game including chaotic systems.) engines Self-Explanatory Simulators Designing and implementingthe physics (or economics) Our group has developed a technology that can help change a gameengine requires selecting appropriate modeling this. Self-explanatory simulators combinethe ability to do assumptions,trading off constraints of physical efficient numerical simulation with the conceptualclarity of verisimilitude, playability, CPUand memorybudgets, and qualitative representations. The basic idea is to makethe developmenttime. In simulation construction, qualitative process of simulation authoring more automatic--- knowledgeprovides an organizing frameworkfor the automatinggeneration of both the code for grinding the physical objects, relationships, processes, and their numbersand articulating the conceptual knowledge.That mathematical models. After deciding what phenomenaare is, a self-explanatory simulator compiler (here, SIMGEN relevant, the engine designer needs to figure out the Mk3)is given as input a conceptual understanding of the appropriate approximations and mathematical models, and domainto be simulated and a description of the structure of then implementthem in efficient code. Unfortunately, the the particular system within that domainto be simulated. conceptual understanding of the simulated world remains in SIMGENfigures out what phenomenaare relevant and the simulationdesigner’s head; it is unarticulated. what modelingassumptions are appropriate, selects the appropriate mathematicalmodels, and writes the simulation If we can embedinto the gameengine itself the kind of code. (It can take advice from a humanpartner, depending conceptual understanding that players (humanand on the application.) SIMGENalso creates, as part of the computer)need to operate in it, we will have an important simulator, a compactversion of the conceptual tool for creating the kinds of explanationtools, post- understandingit used to create the rest of the simulator. mortemdebriefings, and bots that we would like. We This information is used to provide explanations about the propose that qualitative knowledge,expressed for example physical entities and relationships in the simulation. This in the form of self-explanatory simulators, can provide a explanation system enables self-explanatory simulators to basis for articulate gameengines that wouldsupport these generate a conceptual description of simulated behavior as new developments. an inexpensivebyproduct of the simulation itself.

Qualitative knowledgeis the kind of conceptual, everyday The runtime costs of self-explanatory simulators are knowledgethat we use to categorize, explain, and reason slightly higher than traditional simulators: The explanation about the physical events and processes that happen around system takes up a small, fixed amountof memory,and the us. Considera ball thrownup in the air. Viewedas a conceptual explanation of any particular simulated trajectory of real-valued coordinates, it wouldtake an behavior grows according to the qualitative complexity of infinite amountof information to describe. Viewedin that behavior. The qualitative complexitygrows at a rate floating point, the numberof states is smaller but still huge, that is measuredin aggregate timesteps, rather than proportional to the time step used in the simulation. But for whipping around rapidly at every timestep. However,the humanconceptual descriptions, the most natural

33 explanations, and automatically tune the simulation for desired behaviors.

Onemight consider grafting this technology onto existing simulations like Civilization or SimCity.Although this is possible, it’s not actually a particularly efficient use of the technology. It wouldbe a long and tedious task to back-fit a SIMGENdomain theory to the hand-hacked behavior of, say, SimCity without having SimCitydesigners on hand to explicate their qualitative design decisions. It wouldbe possible, too, to maintain SimCity’sexisting numerical simulation code and add hooks to signal numerical changes Figure1. SIMGEN’sinputs and outputs. A to a SIMGENmodel reflecting a qualitative design, but a domaintheory is combined with scenario really horrible task fraught with trial-and-error. SIMGEN’s information to form a qualitative model. This is strength is using qualitative knowledgeto design the compiled to both running numerical simulation backboneof the simulation and compile it into running code and a compact explanation system that code. contains information about relationships in the system. Howarticulate gameengines might help Concepts from self-explanatory simulators have an obvious complexreasoning occurs at compile time, so the time cost application to helping players understand the gaming is basically that of a traditional numericalsimulator. world. Consider for example SimEarth. The back of the manualprovides an interesting attempt to reconstruct the SIMGEN’ssimulations can be run on small platforms -- we causal structure of the simulation, based on design notes have successfully run them on HP200’s (an 8mhzDOS and experimentation.But if players were able to directly palmtop), for instance, and as Java applets. The compiler trace back through the causal structure of events, to find produces CommonLisp, C++, or Java runtimes, which can out the whyof them, they wouldbe able to tie the be used with various runtime shells (with more on the way). appropriate parts of the simulator’s causal accounts to the Examples of simulators built with SIMGENMk3 for specifics of their actions. Articulate modelsalso provide educational purposes include a spring-block oscillator (with the basis for indexing into interesting stories and other static and dynamicfriction, as well as a MEMSspring), an informational resources: "Yes, you’ve just scoured the evaporation laboratory (so experiments that wouldtake Earth of all higher forms. Kind of what mayhave hours occur in seconds), and a modelof the atmosphereto happenedback when... "Detecting and providing relevant explore the effects of greenhousegases. Weare creating a advice to dynamicalpatterns, e.g., mountinginstability or a suite of simulationsas part of a Principles of Operations population death spiral, wouldalso be greatly simplified. manualfor a "virtual DeepSpace One."It is part of a joint project with NASAAmes and University of West Florida. The physics of the gamingworld is only part of the story, Weare also creating self-explanatory simulators for use of course. Qualitative modelscan also be used for with two middle-school science curricula for the economicand resource models, thus providing a stronger Public School system. basis for reasoning about strategic decisions. The qualitative descriptions of events and patterns of physical Currently, the arena in whichself-explanatory simulators and economicbehavior could be used to drive reactive excel are systems of ordinary differential equations without strategies and signal opportunities for reflective planning simultaneities (e.g., the samesorts of systemsthat system by bots. In most , a few simple flags hand-woveninto dynamicsworks for), although the structure of the system the engine are all that are available to drive advisories and of equations can changedynamically during simulation. bots. In Civilization, for instance, the advisors provide The largest cost in developinga self-explanatory simulator amusingsummaries of your global state, but are morelike is the creation of the domaintheory, the conceptual dashboard warning lights than an advisor whocan point out understandingthat fuels the simulator. Domaintheories where you went wrongin the last war and howto avoid cover a broad range of physical situations and phenomena, doing it again. so that while creating a domaintheory can be a large up- front cost, it can be amortized across manysimulators. If mostof the qualitative descriptions of the world are Moreover,the increased representational capacity has a computedautomatically as a consequenceof the normal numberof advantages. For example, we have built a process of simulation, these descriptions can be shared by developmentenvironment that enables developers to add computer players, thus freeing CPUand memorybudget newvirtual entities to existing simulations, adjust their for morestrategic thinking. Explicit symbolicdescriptions of the goals, actions, strategies, and tactics of the gaming

34 world can be used to extract the maximumbenefit from the explanation systems of self-explanatory simulators rich information that wouldbe available in articulate game provide (although their representations provide engines. Imagine a strategy war gamewhere, based on its good starting point). Creating a standard library understanding of your economy,your enemykept targeting of these symbolicdescriptions, and procedures to your weakest supply links. Or a competitor in an economic recognize them based on qualitative and numerical gamethat figured out it could corner the market on energy, descriptions of dynamicalbehavior, would or stop you from cornering a market, or accuse you of simplify bot development. illegal acts based on its understandingof your behavior and the laws of the game. There are other issues that must be addressed before the full potential of articulate gameengines can be realized: Althoughwe think that self-explanatory simulators could be an important technologyfor gameengines, the potential Creatinglibraries of representations for goals, of qualitative reasoning for building better bots goes actions, strategies, and tactics. Developing beyondthem. Consider for examplethe potential use of symbolicrepresentations for these concepts, tied qualitative spatial descriptions. Qualitative spatial to the conceptual knowledgeof behavior and reasoning carves space and shape up into regions that are dynamics, that can be used across multiple games uniformwith respect to somerelevant criteria. These will amortize the cost of bot development. conceptually meaningfuldivisions provide an alternate Examplesof this might be the idea of forking an perspective to -based or numerical spatial models. In opponentas in tic-tac-toe or the conceptof a front gameslike Age of Empires, for instance, a bot could make above. more global deductions, such as "/’m in imminentdanger of Dynamicreconfiguration of simulators. Creating collapse because my enemycontrols all the stone in the simulated worlds where players can create new world," or even ’7 should try to build a bridge to the stone artifacts that can be understoodwithin that world on the island." Bots could actually understand concepts is a difficult challenge. The standard approachof like "front", "line of attack", andproperties of terrain, viewingsuch situations as distributed simulations concepts which often bedevil designers of wargameAIs. provides only part of the answer: Unless there is a shared conceptual understanding, generativity will Technicalbarriers to articulate have to be strictly limited or the bots of the world gameengines will be unableto cope. It is possible that this shared conceptual understanding can actually There are several advancesthat must be madein self- makethe distributed simulation problemeasier explanatory simulators to makethem a practical technology (i.e., two simulations can describe whatthey affect for gamebuilders: and can realize that they can operate independentlyof each other, or that they only ¯ Workingefficiently with grid and cellular depend on each other in certain ways). automata models. SIMGENMk3 does not provide for array-based models, which will require Conclusion somecareful engineering but not deep conceptual difficulties. Webelieve that qualitative reasoning has muchto offer ¯ Creating libraries of domaintheories and gamedesigners and implementers. Articulate game environments for developing new domain engines, by generating a qualitative, conceptual theories. Domaintheories describe the laws of understandingof their behavior in parallel with purely some class of phenomena,including both numerical descriptions, could support the creation of qualitative models and mathematical models. The smarter, savvier computer-controller characters, whether qualitative modelsprovide high-level descriptions they be advisors, allies, or opponents.Progress in other of phenomenathat help determine when specific areas of artificial intelligence (e.g., efforts to formalize mathematical modelsare relevant. A large library manycommon-sense concepts of space, time, causality, of off-the-shelf domaintheories could drastically and domainsof interest to the military, policy-makers,and cut gamedevelopment time, especially if there gamers), combinedwith Moore’s law, provides a tantalizing were tools that enabled these domaintheories to opportunity for creating far richer gamingexperiences. be customizedeasily. And, finally, the Grand Moff Tarkin might be smart enough Creating libraries of high-level behavioral and to escape the DeathStar and really strike back. causal patterns. Recognizing emergent behavior patterns in the simulation, such as a death spiral in a population or hyperinfiation in an economy, requires additional reasoning beyondwhat the

35 References:

[ 1 ] Star Wars, Twentieth CenturyFox Corporation, 1977. [2] SimCity, Maxis, 1989. [3] SimEarth, Maxis, 1996. [4] Civilization II, MicroProseInc., 1996. [5] Ages of Empires, Microsoft Corporation, 1997.

36