Professional Documents
Culture Documents
Software Design Description For: Defendar (An Augmented Reality Based Strategy Game)
Software Design Description For: Defendar (An Augmented Reality Based Strategy Game)
SOFTWARE DESIGN
DESCRIPTION
(SDD DOCUMENT)
for
DefendAR
(An Augmented Reality based strategy game)
Version 1.0
By
Muhammad Waleed Yousaf CUI/FA15-BSE-058/ISB
Nermeen Haider CUI/ FA15-BSE -081/ISB
Supervisor
Mr Qasim Malik
Software Design Description for DefendAR Page 2
Software Design Description for DefendAR Page 3
Software Design Description for DefendAR Page 4
Table of Contents
Table of Contents
1. Introduction 1
2. Design methodology and software process model 1
3. System overview 1
3.1 Architectural design 2
3.2 Process flow/Representation 3
3.2.1 Activity Diagram 1 3
3.2.2 Activity Diagram 2 3
3.2.3 Activity Diagram 3 5
4. Design models [along with descriptions] 6
4.1 Class Diagrams: 6
4.1.1 Overall Class Diagram: 6
4.1.2 Class Diagrams 1: 7
4.1.3 Class Diagrams 2: 8
4.1.4 Class Diagrams 3: 9
4.2 Sequence Diagrams: 10
4.2.1 Sequence Diagram 1: 10
4.2.2 Sequence Diagram 2: 10
4.2.3 Sequence Diagram 3: 11
4.3 State Transition Diagrams: 12
4.3.1 State Transition Diagram 1: 12
4.3.2 State Transition Diagram 2: 13
4.3.3 State Transition Diagram 3: 14
5. Data design 16
5.1 Data dictionary 16
6. Algorithm & Implementation 18
6.1 Artificial Intelligence: 18
6.1.1 Path Finding: 18
6.1.2 Ray Casting: 18
6.1.3 Enemy Combat: 18
6.2 Augmented Reality: 18
6.2.1 Marker Based AR: 18
6.2.2 Marker Less AR: 18
6.3 Physics: 18
6.4 Weapons: 19
6.5 Game Progress: 19
6.6 Audio: 19
7. Software requirements traceability matrix 19
8. Human interface design 21
9. Appendix I 23
Software Design Description for DefendAR Page 5
Software Design Description for DefendAR Page 6
Revision History
Name Date Reason for changes Version
Software Design Description for DefendAR Page 7
Supervised by
Mr Qasim Malik
Signature______________
Software Design Description for DefendAR Page 8
1. Introduction
The following content is written to provide you an insight about our proposed project. Detailed
descriptions of “Defend AR”, an android game based on augmented reality, have been included
in the document. At present, augmented reality technology is in its initial evolution phase when it
comes to android applications, yet it has a vast, eager audience awaiting its progress. The game
under discussion is being developed to target this specific audience in the gaming world. All the
necessary specifications required to design the game have been provided here; design
methodology, process models, system overview, design models, data design, algorithms,
requirement traceability matrix and interface design. Defend AR is a one of a kind, innovative
application which gives the user a wonderful experience of playing an augmented reality game
without the dependency of any additional hardware.
3. System overview
This project is an augmented reality game, Defend AR. It is based on the popular tower defense
game but it includes the augmented reality aspect. In the proposed game, the user’s primary goal
will be to defend the hideout of the main character. The system will target the cards and augment
objects accordingly, to be seen through the mobile screen. The enemies will be spawning from a
single instantiation marker towards the hideout using intelligent path finding and collision
avoidance. The system will allow user to defend the hideout using weapons. The range of each
weapon, the trajectory of attacks, and the impact will be different for every weapon. User will
also be able to upgrade and get better weapons as the levels progress. Because the game is
physics based, the impact of attacks on both sides will be shown. The enemies will progressively
get better as levels progress. Whatever is happening in the game, the system will allow the user
Software Design Description for DefendAR Page 9
to view it in 3D as the user tilts and rotates phone to enhance AR experience. The game will not
be multiplayer; only one person can play it on their phone. The game is not a one vs. one game,
as it’s primarily defense vs. attack, contrary to attack vs. Attack.
Software Design Description for DefendAR Page 10
This is the architecture diagram of the intended system. In this, we have divided the system
architecture in three levels: game framework, game engine, and game itself. At the framework
level, we have Android OS of the target devices at the bottom. Then, Graphics, sound, and input
are above that OS, which means that they are dependent on the android OS. Graphics define the
resolution, aspect ratio, and level of rasterization the game will run at. The sound will depend on
the inherent sound setting of the android phone. The input will also be mapped onto the graphics
provided by the android OS. In the game Engine level, we will include the algorithms: like
pathfinding, player preferences, occlusion culling etc. User Interface, and the world model the
system will represent. In the top level, we will have the .apk files of the game as well as the
supporting items, and other exported packages of that format.
The activity diagram shows the overall flow of the system, from the point where the user clicks
on the game icon till he exits the game.
Software Design Description for DefendAR Page 11
This activity diagram shows the flow of the system when the user enters the settings menu till, he
clicks back.
Software Design Description for DefendAR Page 12
The activity diagram shows the flow of the system from when the user enters/visits the store till
he exits. The activity diagram shows the flow of the system from when the user enters/visits the
store till he exits.
Software Design Description for DefendAR Page 13
4. Design models
4.1 Class Diagrams
Software Design Description for DefendAR Page 14
The class diagram revolves around the “Player’s Data” class. In this first class diagram,
MainMenu and LevelNavigation are GUI related classes. Level Data stores all the information
about a level may have. Music class deals with the overall sound effects and background effects.
Software Design Description for DefendAR Page 15
The diagram has Environment class which is responsible for the look and feel of the main game
scene. The diagrams main classes are shop and weapon.
Software Design Description for DefendAR Page 16
This class diagram focuses on classes related to Artificial Intelligence i.e. Pathfinding,
Raycasting and Attacking. The other class in the diagram is Augmented Reality which deals
with the algorithms of AR like image detection and ground plane detection.
Software Design Description for DefendAR Page 17
This sequence diagram deals with the interaction among various objects that are related to store
and inventory.
This diagram deals with the main user interface and its components like navigating through the
menu, changing music preferences till selecting the level to play.
In this diagram, the sequence of the main game scene is show. The level data is loaded to
augment environment for that particular level. Enemies are spawned on the game scene and
starts attacking.
Software Design Description for DefendAR Page 18
This State Transition Diagram describes all the states that the object will have during the game
play, as well as the events under which the said states will change
This State Transition Diagram describes all the states the object will have during the
pause/resume scenario
Software Design Description for DefendAR Page 19
This State Transition Diagram describes the states the game will go into as it loads Ads on the
user’s screen.
Software Design Description for DefendAR Page 20
Diagrams Details
Architectural Diagram This is the architecture diagram of the
intended system. In this, we have divided the
system architecture in three levels: game
framework, game engine, and game itself.
At the framework level, we have Android OS
of the target devices at the bottom. Then,
Graphics, sound, and input are above that OS,
which means that they are dependent on the
android OS. Graphics define the resolution,
aspect ratio, and level of rasterization the
game will run at. The sound will depend on
the inherent sound setting of the android
phone. The input will also be mapped onto the
graphics provided by the android OS.
In the game Engine level, we will include the
algorithms: like pathfinding, player
preferences, occlusion culling etc. User
Interface, and the world model the system will
represent.
In the top level, we will have the .apk files of
the game as well as the supporting items, and
other exported packages of that format.
Activity Diagram 1 The activity diagram shows the overall flow
of the system, from the point where the user
clicks on the game icon till he exits the game.
Activity Diagram 2 This activity diagram shows the flow of the
system when the user enters the settings menu
till, he clicks back.
Activity Diagram 3 The activity diagram shows the flow of the
system from when the user enters/visits the
store till he exits.
Class Diagram 1 The class diagram revolves around the
“Player’s Data” class. In this first class
diagram, MainMenu and LevelNavigation are
GUI related classes. Level Data stores all the
information about a level may have. Music
class deals with the overall sound effects and
background effects.
Class Diagram 2 The diagram has Environment class which is
responsible for the look and feel of the main
game scene. The diagrams main classes are
shop and weapon.
Software Design Description for DefendAR Page 21
5. Data design
“Player’s Data Management” module deals with the data design of the system, where creation,
updating, and deletion of data is being done.
As the system under consideration is a single player game and the it doesn’t needs to store a huge
number of entities. So, we wont use any databases and instead, we’ll use Player Preferences
which is a built in class of Unity Engine which is used to store data in user’s device.
Since the data is stored in user’s device via Shared Preferences so it can be easily manipulated by
using programing languages such as C# and JavaScript. The physical storage of this data is in
/data/data/pkg-name/shared-prefs/pkg-name.xml, where pkg-name is the name of the apk file
that is being run on the device.
Software Design Description for DefendAR Page 22
The variables to be stored in our system will be the ones storing player’s identity, his game
progress, the weapons in his inventory, player’s XP’s, and other user’s preferences like music
sounds and player customization.
5.1 Data dictionary
Software Design Description for DefendAR Page 23
1: Returning
player
PlayerXPs Int Checks the amount of player 0: 10000
experience points.
PlayerHPs Int Checks the players/hideouts health 0: 10000
points.
Tutorials TutorialCleared Int Stores if the user has cleared tutorial 0: Not
Cleared
1: Cleared
Weapons WeaponEquipped Int Stored the ID of the current weapon 0-5: Weapon
the player has equipped Choice
Weapon1Lock Int Checks if Weapon 01 is locked or 0: Locked
unlocked 1: Unlocked
Weapon2Lock Int Checks if Weapon 01 is locked or 0: Locked
unlocked 1: Unlocked
Weapon3Lock Int Checks if Weapon 01 is locked or 0: Locked
unlocked 1: Unlocked
Weapon4Lock Int Checks if Weapon 01 is locked or 0: Locked
unlocked 1: Unlocked
Weapon5Lock Int Checks if Weapon 01 is locked or 0: Locked
unlocked 1: Unlocked
As the game is a single player strategy game, so the enemy’s behavior must be dynamic each
time a level is played. Similarly, the enemy’s bots must be intelligent and should have a decent
sense of attack and defense. So for that reason, we’ll use various Artificial Intelligence
algorithms.
This algorithm will determine the path between current location and destination. The enemies
will follow checkpoints in order to navigate through the game scene.
A ray casting algorithm will make the enemies aware of their surrounding, player’s weapons,
traps, obstacles and other enemy’s bots by casting ray on from them towards multiple directions.
Software Design Description for DefendAR Page 24
Once the enemy knows its destination and reaches the hideout by using path finding and ray
casting algorithms, they’ll start attacking the hideout or the weapons or the traps placed by the
player on the game scene.
This generally involves tracking a camera against a planar texture pattern, but sometimes also a
3D object. Key algorithms include interest point(image target) detection and matching, as well as
tools and techniques to filter out erroneous matches, plus a basic geometric model of the scene.
Here you don’t have to put pre-specified markers in the scene, so the system can run in many
environments right out of the box. Algorithms include recreating dense 3d environment and
multi view of 3d augmented objects.
6.3 Physics
The game heavily depends upon physics and the system will have different algorithms for
dealing with that. Like for example algorithms for gravitational effects for all the enemies and
bullets etc. Projectile motion of catapult’s fireballs will also be dealt with algorithms based of
physics.
The speed and velocity of the bots will also be defined in these algorithms. Similarly, the rigid
body and collision detection will be taken care off by the algorithms defined.
6.4 Weapons
The game will have a wide range of weapons broadly classified into two main categories i.e.
Offensive and Defensive. All the weapons will have different behavior which will be determined
in this algorithm. Like how the short range long range weapons will be used to effect enemy’s
and player’s HP.
This algorithm deals with the player’s current level and will determine the intractability options
the player has, the items that are locked and when to unlock them. Like some weapons wouldn’t
be available till the player finishes a certain level. Similarly, the level difficulties will also be
determined by comparing it to the current progress of the player.
Software Design Description for DefendAR Page 25
6.6 Audio
The game will have background music and sound effects for different weapons and enemy’s
types. So an algorithm will be implemented for controlling these music and sound effects
throughout the game. User’s preferences will be taken into consideration for our previous
choices and current results.
Software Design Description for DefendAR Page 26
Software Design Description for DefendAR Page 27
8. Human interface design
Software Design Description for DefendAR Page 28
n Objects ns
gs Clicking this button, the user will be directed to
the settings menu from where he can adjust
the volume of sound, music as well as adjust
controls according to his needs.
ctions will be provided through help to the user.
hop button will lead the user to the game’s shop
from where he can buy items as well as equip
with the items already bought.
clicking this button, the user will enter the
game.
clicking this button, the user will be directed
back to the screen before the one he is already
on right now.
k level clicking this button, if the required constraints
have been met, the selected level will be
unlocked.
em clicking this button, if the required constraints
have been met, the selected item will be
bought.
clicking the button, the selected item, if
unlocked, will be equipped.
Software Design Description for DefendAR Page 29
9. Appendix I
● How to design using UML (OOP): For guidance please follow the instructions mentioned
in the link: http://agilemodeling.com/artifacts/
● How and when to design ER diagrams: For guidance please follow the instructions
mentioned in the link:
http://people.inf.elte.hu/nikovits/DB2/Ullman_The_Complete_Book.pdf
● Data flow diagrams: For guidance please follow the instructions mentioned in the link
and book:
o http://www.agilemodeling.com/artifacts/dataFlowDiagram.htm
o Software Engineering –A Practitioner’s approach by Roger Pressman
● Architecture diagram: For guidance please follow the instructions mentioned in the link
and book:
o Ian Sommerville – Software Engineering 9th Edition– Chapter 6