Master Thesis
Total Page:16
File Type:pdf, Size:1020Kb
UNIVERSITY OF OSLO Department of informatics Generating gameplay scenarios through faction conflict modeling. Master thesis Marius Brendmoe 1. August 2012 Abstract A gameplay scenario can be defined as a series of events that emerge from a given context. These events can potentially be influenced by the player through gameplay, which results in meaningful interaction with the simulation. Creating gameplay scenarios in computer games and training simulators is an immensely expensive and time consuming undertaking. A common trait for most scenarios created is that they tend to be static. Once a player has completed the scenario once, he knows exactly how it will behave the next time, reducing or removing the replay value of the gameplay scenario. This thesis investigates how artificial intelligence techniques can be used to define virtual worlds and interaction between entities, such as virtual humans, to dynamically generate gameplay scenarios by simulating the conflict between entities as they clash over conflicting interests in the world. The first part of this thesis introduces the vast field of artificial intelligence, how it is usually applied in games, and how new concepts are slowly trickling into the field of game artificial intelligence. Topics introduced include crowd simulation techniques, agent simulation and how one can describe arbitrary virtual worlds through the use of semantics, smart objects and fuzzy logic. The second part describes the practicalities of the implementation. Here, the game engine used to develop the prototype game world is presented and compared to other alternatives. Next, the design and implementation details of the proof of concept implementation, called the “Faction Interaction Framework”, are described in detail. The design allows for quickly defining the important resources, actions, and potential interactions between entities in a virtual world. Finally, the implementation can be run as an add-on to a virtual world, which can be used to drive scenario generation through conflict simulation. The work presented in this thesis provides a proof of concept solution for dynamically generating gameplay scenarios. By providing game developers with a pattern for defining the elements of their virtual world that is the source of conflict, the “Faction interaction framework” provides an approach to have the virtual world autonomously generate myriads of gameplay scenarios depending on user input. This has potential application especially to large, open world games, massively multiplayer online games and training simulators, where the generation of novel gameplay scenarios is challenging due to the large amount required. 1 Table of contents Abstract ...................................................................................................................................... 1 Chapter 1 Introduction ...................................................................................................... 5 1.1 Background and Motivation .................................................................................... 5 1.2 Problem Statement ................................................................................................... 8 1.3 Limitations ............................................................................................................... 9 1.4 Research Method ................................................................................................... 10 1.5 Contributions .......................................................................................................... 11 1.6 Example Scenario: Hunger Conflict ...................................................................... 12 1.7 Outline .................................................................................................................... 13 Chapter 2 Background ..................................................................................................... 15 2.1 Game engine overview........................................................................................... 15 2.2 Artificial Intelligence ............................................................................................. 19 2.3 Spatial partitioning ................................................................................................. 23 2.4 Summary ................................................................................................................ 24 Chapter 3 Topics in artificial intelligence ....................................................................... 25 3.1 Agent reasoning: finite state machines .................................................................. 25 3.2 Agent reasoning: behavior trees ............................................................................. 26 3.3 Crowd simulation ................................................................................................... 28 3.4 Factions and groups ............................................................................................... 30 3.5 Smart objects .......................................................................................................... 31 3.6 Fuzzy logic ............................................................................................................. 33 3.7 Semantics for game worlds .................................................................................... 37 3.8 Neural networks ..................................................................................................... 39 3.9 Navigation .............................................................................................................. 40 2 3.10 Scaling simulations to larger populations .............................................................. 41 3.11 Summary ................................................................................................................ 42 Chapter 4 Technologies and frameworks ........................................................................ 43 4.1 Evaluating game engines and frameworks............................................................. 43 4.2 Unity in depth ........................................................................................................ 47 4.3 Summary ................................................................................................................ 54 Chapter 5 Core design ..................................................................................................... 55 5.1 World description ................................................................................................... 57 5.2 Behavior model ...................................................................................................... 63 5.3 World model .......................................................................................................... 65 5.4 Actors ..................................................................................................................... 67 5.5 Agents .................................................................................................................... 68 5.6 Actor reasoning engine .......................................................................................... 70 5.7 Summary ................................................................................................................ 74 Chapter 6 Framework implementation ............................................................................ 76 6.1 C# features ............................................................................................................. 76 6.2 Implementing semantic attributes and smart objects ............................................. 78 6.3 Implementing the world representation ................................................................. 79 6.4 Actors ..................................................................................................................... 80 6.5 Faction relations ..................................................................................................... 83 6.6 Defining a world .................................................................................................... 85 6.7 Summary ................................................................................................................ 85 Chapter 7 Game scenario implementation ...................................................................... 87 7.1 Food sources .......................................................................................................... 88 7.2 Villages .................................................................................................................. 89 7.3 Actors and agents ................................................................................................... 89 3 7.4 Observing faction interaction ................................................................................. 92 7.5 Investigating performance...................................................................................... 96 7.6 Discussion .............................................................................................................. 99 7.7 Summary .............................................................................................................. 102 Chapter 8 Conclusion .................................................................................................... 104 8.1 Summary .............................................................................................................