The Design and Implementation of a Mobile Game Engine for The
Total Page:16
File Type:pdf, Size:1020Kb
University of Arkansas, Fayetteville ScholarWorks@UARK Computer Science and Computer Engineering Computer Science and Computer Engineering Undergraduate Honors Theses 12-2012 The esiD gn and Implementation of a Mobile Game Engine for the Android Platform Jon Hammer University of Arkansas, Fayetteville Follow this and additional works at: http://scholarworks.uark.edu/csceuht Part of the Graphics and Human Computer Interfaces Commons, and the Software Engineering Commons Recommended Citation Hammer, Jon, "The eD sign and Implementation of a Mobile Game Engine for the Android Platform" (2012). Computer Science and Computer Engineering Undergraduate Honors Theses. 3. http://scholarworks.uark.edu/csceuht/3 This Thesis is brought to you for free and open access by the Computer Science and Computer Engineering at ScholarWorks@UARK. It has been accepted for inclusion in Computer Science and Computer Engineering Undergraduate Honors Theses by an authorized administrator of ScholarWorks@UARK. For more information, please contact [email protected], [email protected]. THE DESIGN AND IMPLEMENTATION OF A MOBILE GAME ENGINE FOR THE ANDROID PLATFORM THE DESIGN AND IMPLEMENTATION OF A MOBILE GAME ENGINE FOR THE ANDROID PLATFORM A Undergraduate Honors College Thesis in the Department of Computer Science and Computer Engineering College of Engineering University of Arkansas Fayetteville, AR December, 2012 by Jon C. Hammer ABSTRACT In this thesis, a two-dimensional game engine is proposed for the Android mobile platform that facilitates rapid development of those games by individual developers or hobbyists. The essential elements of game design are presented so as to introduce the reader to the concepts that are crucial for comprehension of the paper. A brief overview of the Android Operating System is also included for those unfamiliar with it. Three primary design goals are identified, and a prototype solution is described in detail. The prototype is then evaluated against those design goals to see how well it accomplishes each task. The results are collected and presented at the end of the thesis and demonstrate that though there is always room for expansion, the prototype does indeed satisfy the requirements given. ©2012 by Jon C. Hammer All Rights Reserved ACKNOWLEDGEMENTS This project has been a monumental undertaking and would not have been possible without the support of a large number of people. I thank Dr. Russell Deaton and Dr. Nilanjan Banerjee for providing me with the original foundation of the project. Dr. Deaton encouraged the idea of a developing a gaming engine and was kind enough to be my Thesis Director during the preliminary stages of the engine's development, while Dr. Banerjee provided the knowledge and tools necessary to implement it on the Android mobile platform. I also thank Dr. John Gauch and Dr. Craig Thompson. With the departure of Dr. Banerjee and Dr. Deaton, Dr. Gauch graciously took over the task of being my Thesis Director in the last semester while I finished the details of the project and has been a source of encouragement along the way and Dr. Thompson took over the responsibility of coordinating the students in the Honors program, myself included, and served on my thesis committee. I also thank Dr. Gordon Beavers for serving on my committee, and the rest of the Computer Science faculty at the University of Arkansas. I consider my education to be my most valuable asset. My family and friends have been particularly important throughout this process. My mother and father have always pushed be to do my best and to strive for the highest level excellence possible. Their encouragement has pushed me through high school and college and will continue to push me for the rest of my life. My friends have always been available when I need them, either for advice or a distraction, and for that, I wish to thank them. Finally, to all who have helped me along the way, I sincerely thank you. It has been a pleasure working with you. TABLE OF CONTENTS 1. Introduction ...............................................................................................................................1 1.1 Problem ................................................................................................................................ 1 1.2 Objective .............................................................................................................................. 2 1.3 Approach .............................................................................................................................. 3 1.4 Organization of this Thesis .................................................................................................. 5 2. Background ...............................................................................................................................7 2.1 Key Concepts ....................................................................................................................... 7 2.1.1 Digital Images ............................................................................................................... 7 2.1.2 The Game Loop .......................................................................................................... 10 2.1.3 An Introduction To Animation ................................................................................... 13 2.1.4 Android, An Overview ................................................................................................ 15 2.2 Related Work ..................................................................................................................... 16 2.2.1 AndEngine .................................................................................................................. 17 2.2.2 LibGDX ...................................................................................................................... 17 2.2.3 Corona ......................................................................................................................... 18 3. Architecture .............................................................................................................................19 3.1 High Level Design ............................................................................................................. 19 3.2 Design ................................................................................................................................ 20 3.2.1 System Core ................................................................................................................ 20 3.2.2 Graphics Core ............................................................................................................. 20 3.2.3 Input Core ................................................................................................................... 22 3.2.4 Update Core ................................................................................................................ 22 3.2.5 File Core...................................................................................................................... 22 3.3 Implementation .................................................................................................................. 23 3.3.1 System Core ................................................................................................................ 23 3.3.2 Graphics Core ............................................................................................................. 25 3.3.2.1 Renderer ............................................................................................................... 26 3.3.2.2 Resource Managers .............................................................................................. 28 3.3.2.3 Core Drawables .................................................................................................... 31 3.3.2.4 Additional Drawables .......................................................................................... 32 3.3.3 Input Core ................................................................................................................... 36 3.3.4 Update Core ................................................................................................................ 38 3.3.5 File Core...................................................................................................................... 39 3.4 Extensions to the Engine ..................................................................................................... 40 3.4.1 Sprite ........................................................................................................................... 41 3.4.2 Particle System............................................................................................................ 45 4. Results and Analysis ...............................................................................................................48 4.1 Methodology ...................................................................................................................... 48 4.1.1 Ease of Use ................................................................................................................. 48 4.1.2 Modularity................................................................................................................... 49 4.1.3 Efficiency .................................................................................................................... 49 4.2 Results ...............................................................................................................................