Communication Inside Game Engine
Total Page:16
File Type:pdf, Size:1020Kb
Coordination and communication inside game engine University of Oulu Department of Information Processing Science Master’s Thesis Tuomas Kukkamaa 29 May 2014 2 Abstract This study examines the communication and coordination among different parts of game engine. As games contain multiple co-operating processes, each of which handles a small part of whole game experience, game engines must handle the management of co-operation efficiently. The issue is that while the competitive and demanding game industry has hastened the development of game engines, the academic research has been lagging behind. This study aims to bridge the gap between industrial know-how and academic research by studying how game engines handle managing the processes and data that they require. The study uses coordination paradigm as the research viewpoint and focuses on finding the coordination model used in game engines. The target of the study is to understand how the coordination model is implemented in game engines. The study followed design science research, whereby both industrial know-how and academic literature were used in finding the coordination model and implementation method of it. The coordination model was first searched among the existing models, but as those were proven inefficient in describing the overall theory, a new architectural theory was built. This new theory, called “Communication-oriented game engine architecture”, was then analysed against communication mechanisms used in open source game engines for verification. The result of the analysis indicates that the theory proposed in this thesis explains the common features among analysed game engines. Since the proposed architecture is based on existing and well-known event-based communication mechanism, the theory behind proposed architecture aids in understanding the design of game engines in respect to the design of other software. Keywords game engine, software architecture, domain-specific architecture, control structures, gaming 3 Foreword Games, be it board games or computer games, have always interested me. As I have witnessed the evolution of gaming from simple toys to complex social platforms, I have learnt to appreciate both technical and artistic merits of games. Especially now, during the later part of my studies, I have noticed the meaning and value of those things that makes games unique among software. They offer new insight to software engineering and I hope that this thesis will encourage others to dive in to explore games as software. I would like to thank following people for supporting me during the development of this thesis: University Lecturer Jouni Lappalainen who guided me as my supervisor; my friends who were always ready to talk about games and game engines; my family for supporting and encouraging me forward; and of course my fiancée for taking care of me when I studied long hours among articles, books, and source code repositories. Tuomas Kukkamaa Oulu, Thursday, May 29, 2014. 4 Contents Abstract...................................................................................................................2 Foreword.................................................................................................................3 Contents..................................................................................................................4 1. Introduction..........................................................................................................5 1.1 Research topic and questions........................................................................6 1.2 Research methodology..................................................................................7 1.3 Structure of the thesis....................................................................................9 2. Games as software.............................................................................................10 2.1 Games as data-driven software...................................................................11 2.1.1 Processes inside game.....................................................................12 2.1.2 Data inside game.............................................................................15 2.2 Game engines as managers.........................................................................17 2.2.1 Process management.......................................................................18 2.2.2 Data management............................................................................20 3. Communication inside game.............................................................................22 3.1 Communication mechanisms......................................................................23 3.2 Architectural solutions................................................................................25 4. Communication architecture of game engine....................................................35 4.1 Events as communication mechanism........................................................36 4.2 Depiction of the architectural solution........................................................37 5. Analysis of existing game engines.....................................................................41 5.1 Blender........................................................................................................43 5.2 Delta 3D......................................................................................................45 5.3 Gameplay3D...............................................................................................48 5.4 Polycode......................................................................................................49 5.5 Comparison between game engines and the proposed architectural solution ..................................................................................................................51 6. Discussion..........................................................................................................55 6.1 On the verification of the architectural solution and theory.......................55 6.2 Implications for game engine theory..........................................................58 6.3 Implications for game engine industry........................................................61 7. Conclusion.........................................................................................................63 References.............................................................................................................65 Appendix A. Structural and functional diagrams of analysed game engines.......70 5 1. Introduction Computer games (hereinafter referred as games) present a great challenge for both developers and scholars: While they can be treated as usual software and designed under common software requirements, they are often required to handle many computationally-challenging tasks that are not present in other software. These tasks, such as simulating independent parts of the game world and rendering that game world efficiently to user, must be often designed and programmed under strict schedule limits that are imposed by the very competive and demanding video game industry. This has led to situation where the best practises of industry have been developed a lot while scientific research has been lacking. This does not, however, mean that there hasn't been any scientific research on games. Many game related topics have been studied from variety of viewpoints during last decades. Some of the most common research topics have been usage of games in different purposes (for example, as a simulation platfrom (Zyda, 2005)), improving a specific technological or mechanical section of game (for example, improving usage of database in games (Demers, Gehrke, Koch, Sowell & White, 2009) and improving the artificial intelligence of a game (Spronck, Ponsen, Sprinkhuizen-Kuyper & Postma, 2006)). The problem is that while research on games has increased (Ampatzoglou & Stamelos, 2010), most of the research focuses on studying how games, as an abstract entity, work in different situations (“usage”) or how certain low-level functions can be implemented (“implementation”). This imbalance can be especially noted in the research done on game engines. Game engines form the “heart” of modern games and since early 1990s, when the first game engines were constructed, have developed into large and complex pieces of software. Game engines function as a link between different major parts of the games, driving their actions and facilitating their co-operation and thus form an important base architecture for the games. These roles and the related complexity would make them prime targets for studies on architecture and communication but currently, the academic research is mostly focusing on how to perform simulations and mathematically complex issues efficiently (Anderson, Engel, McLoughlin & Comninos, 2008). This research focus has also shown up in the industry-based literature as, for example, the books by industry veterans such as McShaffry (2009), Rabin (2009) and Zerbst and Dueval (2004) all focus on telling how the specific parts of the game engine can be implemented without discussing the overall architecture and design reasoning behind it. These circumstances have led to a situation where the modern game engines have seen little focus from the academic research and thus their developments have not been analysed as a part of larger software engineering literature. While there has been some