
University of British Columbia Department of Electrical and Computer Engineering Final Project Report: Space Invaders 3D In Partial Fulfillment of the Requirements for: EECE 478 Computer Graphics Submitted by: James Luo (63544043) Sihanook Fernando (10891034) Jason Kuo (21006036) Johnty Wang (16234031) TABLE OF CONTENTS 1.0 INTRODUCTION................................................................................ 1 2.0 GAME DESCRIPTION....................................................................... 2 2.1 What is the game? .................................................................................................2 2.2 Objective of the game............................................................................................3 2.3 How is this implementation different from others out there? ..................................3 3.0 GAME PLAY & USER INTERFACE................................................ 4 3.1 User Interface ........................................................................................................4 3.1.1 Audio..............................................................................................................4 3.1.2 User Input.......................................................................................................4 3.1.3 Menu System ..................................................................................................5 4.0 SOFTWARE ARCHITECTURE........................................................ 9 4.1 Class Diagram .......................................................................................................9 4.2 Class Description...................................................................................................9 4.3 External Libraries ................................................................................................16 4.4 3D Models...........................................................................................................18 4.5 Audio Triggered Firing by Player ........................................................................19 4.6 Enemy Firing.......................................................................................................20 4.7 Handling Menu Interface .....................................................................................22 4.8 Collision Detection..............................................................................................24 4.9 Optimization Techniques Used ............................................................................26 5.0 Recommendations.............................................................................. 27 6.0 Conclusion.......................................................................................... 29 Appendix A: System Flowchart .............................................................. 30 ii List of Figure Figure 1: Screenshot of a 2D version of Space Invaders............................................. 2 Figure 2: Screenshot of Hall of Fame screen.............................................................. 6 Figure 3: Screenshot of Main Menu shown at the start of the game............................ 7 Figure 4: Screenshot of Game over Menu.................................................................. 8 Figure 5: A screenshot of the High Score Menu......................................................... 8 Figure 6: Diagram illustrating the different classes within the code ........................... 9 Figure 7: Screen of Explosions when enemy ships are hit........................................ 14 Figure 8: Initial Enemy Model................................................................................. 18 Figure 9: Final enemy model................................................................................... 19 Figure 10: Flow-chart showing enemy fire sequence ............................................... 21 Figure 11: Flow-chart Showing Overall Game Design............................................. 30 iii 1.0 INTRODUCTION The purpose of this report is to explain the game that was developed as a part of EECE 478 course requirements. The game application tries to encapsulate many 3D rendering and modelling concepts that were taught in class. SDL (Simple DirectMedia Layer) libraries were used along with OpenGL for the implementation. The report will start off with a description of the game itself, followed by details on game play. The discussion will then move on to the technical aspects of the game which include the software architecture. Various features such as collision detection, audio and procedural modelling that were implemented will also be discussed. Optimization techniques were used in the game development to improve the efficiency in rendering the models. These will also be highlighted. The report will conclude with possible improvements that could be made to the game in the future. 1 2.0 GAME DESCRIPTION 2.1 What is the game? The game is based on the popular 2D arcade game, Space Invaders , developed in the 70’s by Tomohiro Nishikado. There have been several implementations of different version of the game over time. However, there have been few 3D implementations of this game. The implementation discussed in this report aims to produce a 3D version of the game, with a novel user interface that brings more realism to the player. The figure below is a screenshot of one of the 2D versions of the game. Figure 1: Screenshot of a 2D version of Space Invaders 2 2.2 Objective of the game The objective of the game is simply to destroy a formation of advancing enemy spaceships. The player moves on to the next level upon destroying all enemy ships. Each consecutive level gets tougher and tougher with enemies shooting at the player more frequently. The number of points obtained per enemy destroyed increases with every level. The player should aim to maximize his or her score. 2.3 How is this implementation different from others out there? The versions of Space Invaders out there are mostly designed the way shown in Figure 1. Our version of the game has three significant differences compared to the rest: 1. All the models are rendered in 3D space. 2. The game play is from the perspective of the player, rather than from a 3 rd person perspective. 3. The game makes use of an infrared head-tracker and audio as input. We believe that changing the perspective and adding another dimension to the game would improve the realism of the game. By tracking the player’s real position adds a new level of involvement to the game play experience. 3 3.0 GAME PLAY & USER INTERFACE We will now discuss details on the game play and how exactly the player interacts with the game. 3.1 User Interface 3.1.1 Audio There are two types of audio used in the game. MP3 tracks for music, and WAVE files for sound effects such as shooting and explosions. The WAVE files are found on www.findsounds.com , an online audio search engine of publicly available sounds. The music was performed and recorded on a synthesizer keyboard by one of the team members. 3.1.2 User Input One of the novelties of the game is the use of non-standard input methods. While mouse and keyboard input exist, they are used for debugging during development, and only serve as auxiliary forms of input in the final game. The main inputs required for game play consists of controls for player movement, and shooting. Given the parameters of the game, the movement is simply along a single dimension, and a single trigger for shooting is required. Player Movement An infra-red head tracking scheme was used to move the player to create an interesting effect: Since the game has a first-person point of view, as the player moves from side to side, the computer screen becomes a window into a virtual world with a perspective that depends on the real physical location of the player. As the player moves in the real world, the head tracker relates the physical movement to the virtual position of the player in the game. To implement the head tracker, a Nintendo Wii-mote was used. The Wii-mote contains an infra-red camera, and is used in conjunction with the IR sensor bar for aiming at objects on screen. If the Wii-mote is placed at the screen, pointing towards a player equipped with an infra-red source, it is possible for the position of the player to be tracked. After some issues using an open source Wii-mote driver, the GlovePIE 4 scripting environment was used in conjunction with a custom DLL to capture infra-red position data from the Wii-mote. GlovePIE is a scripting program that can access most of the Wii-mote's useful features. However, there is no straight forward way of exposing the captured Wii-mote data with another program. GlovePIE does however have the ability to call an external dynamic link library (DLL). Therefore, a simple DLL with a shared memory section was used to expose the values acquired by GlovePIE, and the game simply has to link to this DLL and access the functions to retrieve the values. This allows simple two-way communication between the Wii-mote and the game application. In the main game loop, the player's position given by the IR data is queried, and the value is read by the game and interpreted accordingly. Firing Mechanism In most games, the trigger for firing is usually a key (such as space bar) or a mouse click. However, an audio triggered input was developed for this game. Initially it was intended for the firing to be triggered with a certain phrase such as “fire!”, but such analysis of the audio input
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages33 Page
-
File Size-