ECSE 321 - Paranoid Asteroid - Software Architecture Document

Download ECSE 321 - Paranoid Asteroid - Software Architecture Document

Post on 15-Oct-2015




0 download

Embed Size (px)


Property of Payom Meshgin;McGill University, Montreal, Quebec, Canada


<ul><li><p>5/25/2018 ECSE 321 - Paranoid Asteroid - Software Architecture Document</p><p> PARANOID ASTEROIDSoftware Architecture Document (SAD)</p><p>PARANOID</p><p>ASTEROIDSoftware Architecture Document (SAD)</p><p>ECSE 321</p><p>Introduction</p><p>to Software</p><p>Engineering</p><p>Group 8:Alex Bourdon</p><p>Alexander Coc</p><p>Payom Meshgi</p><p>Daniel Ranga</p><p>Jad Sayegh</p><p>Yi Qing Xiao</p><p>Client</p><p>Prof. Haibo Ze</p><p>Revision No.2</p><p>Date:Tuesda</p><p>April 16, 20</p></li><li><p>5/25/2018 ECSE 321 - Paranoid Asteroid - Software Architecture Document</p><p>PARANOID ASTEROID SOFTWARE ARCHITECTURE DOCUMENT (SAD) I</p><p>Table of Contents</p><p>1. INTRODUCTION 1</p><p>1.1 Purpose 1</p><p>1.2 Scope 1</p><p>1.3 Definitions, Acronyms, Abbreviations 1</p><p>2. SYSTEM OVERVIEW 2</p><p>2.1 Window System 2</p><p>2.2 The Ingame 2</p><p>2.3 Data Handling 3</p><p>3. SYSTEM VIEWS 4</p><p>3.1 User View 4</p><p>3.2 Window System 5</p><p>3.3 In-game 6</p><p>4. SOFTWARE UNITS 8</p><p>4.1 GUI 84.1.1Overview 8</p><p>4.1.2Modules 8</p><p>4.2 Data Handling 9</p><p>4.2.1Overview 9</p><p>4.3 In-game 9</p><p>4.3.1Game 9</p><p>4.3.2 InputHandler 10</p><p>4.3.3Key 10</p><p>4.3.4Render 10</p><p>4.3.5Sound 10</p><p>4.3.6Entity (Abstract Super Class) 10</p><p>4.3.7Classes that Extend Entity 11</p></li><li><p>5/25/2018 ECSE 321 - Paranoid Asteroid - Software Architecture Document</p><p>II PARANOID ASTEROIDSoftware Architecture Document (SAD)</p><p>5. ANALYSIS 12</p><p>5.1 SRS Summary 12</p><p>5.2 Traceability Matrix 12</p><p>6. ANALYSIS 12</p><p>6.1 SRS Summary 12</p><p>6.2 Traceability Matrix 13</p><p>6.2.1Mode 1: Menu System 13</p><p>6.2.2Mode 2: In-Game 14</p><p>6.2.3Mode 3: High Score Screen 17</p><p>6.2.4Mode 4: Game Instructions and Preferences 18</p><p>6.2.5Mode 5: Credits 18</p><p>6.2.6Mode 6: Pause Menu 18</p><p>7. DESIGN RATIONALE 18</p><p>7.1 Module 1: GUI 18</p><p>7.2 Module 2: Data Handling 19</p><p>7.3 Module 3: In-Game 19</p><p>8. WORKLOAD BREAKDOWN 20</p><p>8.1 Team 1: Game Development 20</p><p>8.2 Team 2: Menu 20</p><p>APPENDIX A: REQUIREMENTS (FROM SRS DOCUMENT) 22</p><p>Mode 1: Menu System 22</p><p>1.0 General Functionality 22</p><p>1.1 External Interfaces 22</p><p>1.2 Functional Requirements 22</p><p>1.3 Clicking the 'Credits' button will open the Credits window (leaving the main</p><p>menu open)(desirable, medium).Performance 23</p><p>Mode 2: In-Game 23</p><p>2.0 External Interfaces 24</p><p>2.1 Functional Requirements 24</p></li><li><p>5/25/2018 ECSE 321 - Paranoid Asteroid - Software Architecture Document</p><p>PARANOID ASTEROID SOFTWARE ARCHITECTURE DOCUMENT (SAD) III</p><p>2.2 Performance 27</p><p>Mode 3: High Score Screen 28</p><p>3.0 General Functionality 28</p><p>3.1 External Interfaces 28</p><p>3.2 Functional Requirements 29</p><p>3.3 Performance 29</p><p>Mode 4: Game Instructions and Preferences 29</p><p>4.0 General Functionality 29</p><p>4.1 External Interfaces 30</p><p>4.2 Functional Requirements 30</p><p>4.3 Performance 31</p><p>Mode 5: Credits 31</p><p>5.0 General Functionality 31</p><p>5.1 External Interfaces 31</p><p>5.2 Functional Requirements 31</p><p>5.3 Performance 31</p><p>Mode 6: Pause Menu 32</p><p>6.0 General Functionality 32</p><p>6.1 External Interfaces 32</p><p>6.2 Functional Requirements 32</p><p>6.3 Performance 32</p></li><li><p>5/25/2018 ECSE 321 - Paranoid Asteroid - Software Architecture Document</p></li><li><p>5/25/2018 ECSE 321 - Paranoid Asteroid - Software Architecture Document</p><p>INTRODUCTION: PURPOSE</p><p>PARANOID ASTEROID SOFTWARE ARCHITECTURE DOCUMENT (SAD) 1</p><p>1.Introduction1.1 PurposeThis document is the Software Architecture Document for the design project of the first release of</p><p>the Paranoid Asteroid video gaming system and provides an overview of the software architecture</p><p>and its different modules, as well as the rationale behind its conception in relation to the system</p><p>requirements.</p><p>1.2 ScopeThe scope Software Architecture Document is a high level depiction of the Paranoid Asteroid game</p><p>system which is designed to facilitate the game play of the arcade game Asteroids on modern</p><p>household personal computers.</p><p>1.3 Definitions, Acronyms, Abbreviations Asteroids: original name of the Atari space game. playing field : area with wrap-around edges where game sprites move (star field, outer space) PC, spaceship: player animated sprite, controlled via the keyboard Asteroid: inanimate game sprite, travels on the field at constant velocity. varies in size</p><p>(velocity depends on size; smaller, faster)</p><p> Alien, Flying saucer: non-playable character which exists as two different versions, LargeAlien and Small Alien, which travel on the field at constant velocity and fire projectiles</p><p>which cause the PC to lose a life on impact. Exists in 2 formats, large and small (behaviour</p><p>differs)</p><p> Hyperspace: player action. When activated (via keypress), spaceship disappears from currentlocation and reappears at a random space in the playing field.</p><p>SRS: Software Requirements Specification document, which specifies the functionalities ofthe system and its operation constraints.</p><p> GUI: Graphical User Interface. Consists of all the menus and buttons with the user interacts.</p></li><li><p>5/25/2018 ECSE 321 - Paranoid Asteroid - Software Architecture Document</p><p>SYSTEM OVERVIEW: WINDOW SYSTEM</p><p>2 PARANOID ASTEROIDSoftware Architecture Document (SAD)</p><p>2.System OverviewThe game is separated into different parts: a windowing system, an in-game system, and a data</p><p>handling system.</p><p>2.1 Window System All of the game is played inside one frame. Different windows appear, one at a time, within</p><p>the frame.</p><p> The Highscoreswindow will generate the score table and allow the user to check highscores from the main menu. When a high score is reached at the end of a game a dialog</p><p>appears for the user to input his name as it would appear in the Highscores window. It</p><p>appears on screenwhen the player clicks on the Score button while in the main menu</p><p>window.</p><p> The Instructions and Credits windowsare made visible when the buttons ? andCredits, respectively, are clicked from the main menu window, displaying text</p><p>information about the game and the developers.</p><p> The Game window is the window in which the in-game activity happens.</p><p>2.2</p><p>The IngameAfter the menu comes the Game class, which essentially serves as a game launcher and as a</p><p>level watcher. Upon request of one of the three game types in the main menu, the game will</p><p>generate a gamefield appropriately. This class also keeps track of the in-game level the player is</p><p>presently at, and sends command to refill the gamefield with the appropriate amount of entities</p><p>every time the field is emptied by the player (level cleared by player).</p><p>The gamefield is the main class which controls the overall game session. It is the one generating</p><p>or eliminating game entities as the game progress. It possesses a list of all the in-game entities, whichis why it is also responsible for object collisions.</p><p>Basically, any in game related elements are gathered in this class, like scores, number of lives the</p><p>player still has, the level the player is presently at, the power-ups the player presently possess, etc.</p></li><li><p>5/25/2018 ECSE 321 - Paranoid Asteroid - Software Architecture Document</p><p>SYSTEM OVERVIEW: DATA HANDLING</p><p>PARANOID ASTEROID SOFTWARE ARCHITECTURE DOCUMENT (SAD) 3</p><p>The gamefield is also the main class which feeds the renderer class with the position and type of</p><p>each entities, allowing the graphic display to appropriately describe them graphically.</p><p>All entities inherit from the super class Entity, which gives all of them variables for their position,</p><p>orientation, and status (live/death). Each specific entity type will then have its own respective class</p><p>to allow entities of that type to customize variables that they need. For example, only the player(s)s</p><p>ship need a keylistener object.</p><p>The entity types are: Space Ship, aliens, bullets, Asteroids, PowerUps, Particle.</p><p>Note that the Explosion class is simply to facilitate the rendering by providing to the rendering class</p><p>the necessary information for shrapnels movements.</p><p>The user can interact with the game through the keylistener, which is divided into two classes.</p><p>The keylistener is associated to all user related classes (non entity classes, except the space ship entity</p><p>class). The function of a specific key pressed will be determined within the specific class in which</p><p>the key is associated with. This class merely alerts that a key has been pressed, and tells to the class</p><p>it belongs what key has been pressed. Thus, result of key press depends on which class is presently</p><p>active.</p><p>2.3 Data HandlingSome external data must be stored after the game application has ended so that some of the</p><p>previous state of the game may be preserved. Therefore, data such as the high score table and save</p><p>game data are stored in external files on the users hard disk. However, this data is only written to a</p><p>file when necessary, that is, in the case of exiting the game. While the game is running, a copy of the</p><p>data is stored in memory. A number of data handling classes (InputHandler and the Loader classes)</p><p>are responsible for the global access and writing of the data, which are made available to all other</p><p>classes in the application.</p></li><li><p>5/25/2018 ECSE 321 - Paranoid Asteroid - Software Architecture Document</p><p>SYSTEM VIEWS: USER VIEW</p><p>4 PARANOID ASTEROIDSoftware Architecture Document (SAD)</p><p>3.System Views3.1 User ViewThe application window, or game window, is initially displayed upon the game being launched. The</p><p>main menu window, generated above the game window</p><p>Figure 1: Main Menu graphical Representation (Final)</p></li><li><p>5/25/2018 ECSE 321 - Paranoid Asteroid - Software Architecture Document</p><p>SYSTEM VIEWS: WINDOW SYSTEM</p><p>3.2Window System</p></li><li><p>5/25/2018 ECSE 321 - Paranoid Asteroid - Software Architecture Document</p><p>SYSTEM VIEWS: IN-GAME</p><p>3.3 In-game</p></li><li><p>5/25/2018 ECSE 321 - Paranoid Asteroid - Software Architecture Document</p><p>SYSTEM VIEWS: IN-GAME</p><p>Figure 3: Game System Diagram</p></li><li><p>5/25/2018 ECSE 321 - Paranoid Asteroid - Software Architecture Document</p><p>Th b i l di d ibi ll h ifi l l d h l l f h</p><p>SOFTWARE UNITS: GUI</p><p>8 PARANOID ASTEROIDSoftware Architecture Document (SAD)</p><p>4.Software Units4.1 GUI4.1.1 OverviewThe games interface is composed of a collection of JPanels (or extensions of the class) each</p><p>handling their individual information. All panels are part of the same card layout of a single JFrame.</p><p>Each menu (each implemented as a panel) contains a back button returning the user to the main</p><p>menu. Closing the game is done via the default close button (X corner button).</p><p>4.1.2Modules4.1.2.1 MainPanelThe MainPanel is the first panel seen when the game is launched. The panel contains the game name</p><p>and general decorations and buttons. From it, the user navigates by the buttons, which either launch</p><p>the game, or displays the appropriate panel. A table of the buttons available to the user, the classes</p><p>which implement them, and the action executed on click can be seen below:</p><p>Button</p><p>Label</p><p>Action</p><p>Single Player Launches the game in single player mode</p><p>Two Player Launches the game in competitive play mode</p><p>Scores Updates and brings forward the Highscore</p><p>screen</p><p>Load Game Loads previously stored game and resumes it</p><p>Credits Brings forward the Credits screen</p><p>? Brings forward the Help screen</p></li><li><p>5/25/2018 ECSE 321 - Paranoid Asteroid - Software Architecture Document</p><p>SOFTWARE UNITS: DATA HANDLING</p><p>PARANOID ASTEROID SOFTWARE ARCHITECTURE DOCUMENT (SAD) 9</p><p> HelpPanelThe HelpPanel class displays static text which constitutes of gameplay instructions and goals for the</p><p>user. It does not execute any behavior, apart from being able to exit the game the user can return to</p><p>the main menu via a back button.</p><p> CreditsPanelThe CreditsPanel class displays information about the development team and copyright information</p><p>in the form of static text. It does not execute any behavior, apart from being able to exit the game</p><p>the user can return to the main menu via a back button.</p><p> HighScorePanelThe HighScorePanel class is the interface that displays of the top 15 scores achieved in the game andinitiates its updating with newer highscores. The contents are retrieved from the highscores object</p><p>and are formatted for the panel. When a game is won the inputted name and end score are sent to</p><p>the highscores object. Every time the HighScore panel is brought up it is refreshed with any new</p><p>data.</p><p>4.2 Data Handling4.2.1OverviewThe Data Handler module is implemented by the Loader. This class is responsible for storing the</p><p>program into a file to allow the user to load and save a game. This class also stores and saves high</p><p>scores onto the file, which is to be stores on the users home directory. It makes use of the</p><p>writeObject() and readObject() methods defined in the ObjectOutputStream and</p><p>ObjectInputStream classes in order to manipulate the entire game object including all of its</p><p>properties and subproperties.</p><p>4.3 In-game4.3.1 GameOnce a Gameobject is generated by theMenuit keeps track of levels, two player games and saves</p><p>salient information such as high scores and last level completed between the creation of new Games</p><p>and Game_Fields. This subsystem makes the creation of levels and coordination two players modular.</p></li><li><p>5/25/2018 ECSE 321 - Paranoid Asteroid - Software Architecture Document</p><p>SOFTWARE UNITS: IN-GAME</p><p>10 PARANOID ASTEROIDSoftware Architecture Document (SAD)</p><p>This class is the main node for game play. It generates and terminates levels, it holds level</p><p>information and uses this to It generate entitieseither at the onset of a new Gameor circumstantially;</p><p>like Bullets when called on by a shipand debris when objects are destroyed. It keeps a list of live</p><p>Entities and tracks collisions to determine termination or the addition of lives. The live list of entitiesis sent by Gameto be rendered by Renderer. The Gamekeeps track of the score. In addition to</p><p>coordinating the rendering of polygons it also coordinates the rendering of strings; the score, the</p><p>beginning and end of a level, and Game Over. The game sound is coordinated by this class, it is</p><p>done by a call to the Sound class. Gamealso coordinates pausing, by implementing InputHandler.</p><p>4.3.2InputHandlerThis class implement KeyListener and generates Key objects when a key is pressed. Key objects are</p><p>then used by Gamefor pausing and Shipfor bullets and maneuvering.It is a singleton object.</p><p>4.3.3KeyKey objects are created by the InputHandlerand used by Gamefor pausing and the Shipfor bullets and</p><p>maneuvering.</p><p>4.3.4RenderRendererimplements the graphics libraries to render the game entities and strings. It is either passed</p><p>vertices, a point or a string. And has four methods to deal with these parameters. Vertices always</p><p>render a polygon, ship, asteroid or powerup. A point can be a bullet or an explosion there will be a</p><p>method for each. Finally a String can be the score, lives or messages which book end a game or</p><p>level, such as, start level x, level x finished and Gameover.</p><p>4.3.5SoundCalled by the Gameclass to render sound, it generates the music in a constant loop and some sound</p><p>FX. It will use the Java sound libraries to do this.</p><p>4.3.6Entity (Abstract Super Class)All objects on the Gamescreen except stringsextend theEntityabstract super class. Most importantly</p><p>they extend the ability to update their position and generate the vertices for their polygon with the</p><p>knowledge of time since the next update its speed at spawn and it heading. All entitiesuse the same</p></li><li><p>5/25/2018 ECSE 321 - Paranoid Asteroid - Software Architecture Document</p><p>SOFTWARE UNITS: IN-GAME</p><p>PARANOID ASTEROID SOFTWARE ARCHITECTURE DOCUMENT (SAD) 11</p><p>coordinate system. They extend the ability to request the creation of anyEntitysu...</p></li></ul>