Project Number: MXC-1065 Phantasm: a Game Engine A
Total Page:16
File Type:pdf, Size:1020Kb
Project Number: MXC-1065 Phantasm: A Game Engine A Major Qualifying Project Report Submitted to the faculty of the Worcester Polytechnic Institute in partial fulfillment of the requirements for the Degree of Bachelor of Science by ___________________________ Andrew Zafft Date: Friday, August 22, 2008 __________________________ Professor Michael Ciaraldi, Advisor (This page is intentionally left blank) Abstract A game engine containing OpenGL 1, the Win32 API, C++ and common RPG themes was developed. Research into graphics and physics models was performed and then implemented. Fully customizable graphics, storyline development, and internal objects were created using a model-view-controller architecture. 1 OpenGL® is a registered trademark of Silicon Graphics Inc i Acknowledgements I would to thank Professor Mike Ciaraldi for his time and guidance on this project. Without his efforts this project would not have been as successful as it was. ii Table of Contents Abstract................................................................................................................................ i Acknowledgements............................................................................................................. ii Table of Contents...............................................................................................................iii Chapter 1 Introduction..................................................................................................... 1 1.1 Project Description.............................................................................................. 1 1.2 Goals and Plan of Action.................................................................................... 2 Chapter 2 Research.......................................................................................................... 4 2.1 Games in General................................................................................................ 5 2.2 Programming Video Games................................................................................ 6 2.3 Role Playing Games............................................................................................ 7 2.4 Game Engine Structure & Elements................................................................... 8 2.5 Rendering............................................................................................................ 9 2.6 Animation ......................................................................................................... 11 2.7 OpenGL Programming Language..................................................................... 13 2.7.1 Rendering Pipeline.................................................................................... 15 2.7.2 Selection.................................................................................................... 16 2.8 Physics Modeling.............................................................................................. 17 2.9 Artificial Intelligence........................................................................................ 18 2.10 Win32 API Programming Concepts ................................................................. 19 2.11 Model-View-Controller Architecture ............................................................... 23 Chapter 3 Methodology................................................................................................. 24 Chapter 4 System Design .............................................................................................. 25 4.1 Basic Elements.................................................................................................. 26 4.2 Organizational Structure................................................................................... 29 4.3 User Interface.................................................................................................... 30 4.4 OpenGL Graphics............................................................................................. 32 4.5 Physics Modeling.............................................................................................. 34 4.6 Artificial Intelligence........................................................................................ 35 4.7 Game Elements................................................................................................. 36 4.8 Random Map Generation.................................................................................. 37 Chapter 5 Manual .......................................................................................................... 39 5.1 User Interface & Commands ............................................................................ 39 5.2 Creatures ........................................................................................................... 41 5.2.1 Basic Attributes......................................................................................... 41 5.2.2 Advancement & Experience ..................................................................... 41 5.3 Items.................................................................................................................. 41 5.4 Skills ................................................................................................................. 42 5.5 XML File Usage ............................................................................................... 42 5.5.1 Configuration Files ................................................................................... 43 5.5.2 Object Files............................................................................................... 44 5.5.3 Common Base Objects.............................................................................. 47 5.5.4 Adding New Object Files.......................................................................... 51 Chapter 6 Future Plans .................................................................................................. 53 iii Appendix A UML.......................................................................................................... 54 A.1 Class Models..................................................................................................... 54 Appendix B Use Case Scenarios................................................................................... 60 B.1 User Interface Use Cases .................................................................................. 60 B.2 In-Game Use Cases........................................................................................... 64 B.3 Developer Use Cases ........................................................................................ 76 Appendix C Class Descriptions..................................................................................... 79 C.1 Model................................................................................................................ 79 C.2 View.................................................................................................................. 83 C.3 Controller.......................................................................................................... 90 Appendix D Files........................................................................................................... 92 iv Chapter 1 Introduction Games have existed for as long as human beings have lived. The act of entertaining oneself through exercises that serve primarily for self enjoyment is a purely human trait. Through the years, human beings have raised entertainment to an art form. Video games are the latest evolution of the concept. The power of the computer has allowed entertainment and gaming to be taken to a whole new level. We have new technologies that can expand and develop the gaming experience. Game engines are the core of video games. These pieces of code display the virtual world to the computer screen, capture the frantic mouse clicks and keyboard commands from the user and manage the computer artificial intelligence, all to create an enjoyable experience. Advances in game engines create advances in video games, leading to better and better gaming experiences. In fact, it could be argued that since entertainment is exclusively a human trait, advances in entertainment are actually advances to the human race as a whole. The goal of this project was to expand my own personal understanding of game engines and maybe even advance game engine development. 1.1 Project Description I have created a fully functioning role playing game engine. Its features include allowing future users to easily design and import custom graphics, objects and storyline development into the game. The game engine was developed with C/C++ code and interacts with the OS through the Win32 API. The 3-D graphical portion of the game was written using the OpenGL libraries. The game engine was developed and tested on Windows based systems, specifically in the Windows 2000 and Windows XP 1 environments. The game engine can load game data from several different customizable configuration files that are easy to expand and develop. The game engine is designed for use as a single player game. Character development is in the same spirit as the Diablo™ 2 series. The player's character advances in power as they interact in evermore difficult environments. A system to develop character growth has been partially created, and future version will need to finish and polish these aspects of the game engine. The engine presents