final report of game

46
CRAZY THEIF Department of Computer Science Mohammad Ali Jinnah University, Islamabad. Project Report Prepared By: 1. Fahad Rasheed BC103016 2. Syed Ammar Hussain Kazmi BC103076 Supervise by: Mr.Adnan Khalid January 15, 2015 Supervisor’s Signature ____________ 1

Upload: talhaaftab728

Post on 19-Dec-2015

224 views

Category:

Documents


0 download

DESCRIPTION

hjnhj

TRANSCRIPT

Page 1: Final Report of Game

CRAZY THEIF

Department of Computer ScienceMohammad Ali Jinnah University,

Islamabad.

Project Report

Prepared By:

1. Fahad Rasheed BC1030162. Syed Ammar Hussain Kazmi BC103076

Supervise by:

Mr.Adnan Khalid

January 15, 2015

Supervisor’s Signature ____________

Abstract

1

Page 2: Final Report of Game

The focus of our project is to design a game using unity 3d game engine. The player,

plays as a thief, who has to run and avoid the obstacles in the way, And from the

policeman who is chasing him. The game is designed for Android environment. In our

project, we have used multiple built-in functions that unity 3d game engine provides.

As a final product, we have developed a game that is fun and enjoyable.

2

Page 3: Final Report of Game

ContentsCRAZY THEIF 1

1. Introduction 5

1.1 Purpose 61.2 Scope 61.3 Objective 61.4 Tools & Techniques 61.4.1 Tools 61.4.2 Language 61.5 Time lines 6

2. Software Requirement Analysis 8

2.1 Functional / Non Functional Requirements 82.2 Use Case Diagram 92.2 Use Case Description 112.2.1 Description of Use Case 1 112.2.2 Description of Use Case 2 112.2.3 Description of Use Case 3 122.2.4 Description of Use Case 4 132.2.5 Description of Use Case 5 132.2.6 Description of Use Case 6 142.2.7 Description of Use Case 7 142.2.8 Description of Use Case 8 15

3. System Design 17

3.1 System Sequence Diagram 173.1.1 Move Left 173.1.2 Move right 173.1.3 Slide down 183.1.4 Jump 183.1.5 Make sounds 193.1.6 Calculate score 193.1.7 Measures distance 203.1.8 Increase multiplier 203.2 System Architecture Diagram 21

4 Implementation 23

4.1 Tools and Technologies Used 234.1.2 Unity 3D 234.1.3 Maya 234.2 Software Description (coding) 234.2.1 How Game Starts 234.2.2 Replace the object 24

5 Deployment 31

5.2 Installation process description 315.2.1 How to install the Game 315.3 External dependencies 315.3.1 System Requirements 315.3.2 Android Devices 31

6 Conclusion 33

6.2 Evaluation of objective and aim 33

3

Page 4: Final Report of Game

Appendix 34

CHAPTER 1 Introduction

4

Page 5: Final Report of Game

1. IntroductionThe application is a 3D-Android game Crazy Thief on his big Adventure. The thief

who is not only smart but also a clever runner who is being chased by the policeman

after he beats a lady. But beware! He faces different hurdles and obstacles along the

way. Explore fully interactive level less game and collect gold coins at every turn!

Gain as much money as you can. Everyone try to catch you but you are smart. This

game is pretty simple and casual, which takes you on the adventurous track, you will

never forget.

1.1 PurposeThe purpose of the project is to develop a game with a lighthearted feel and graphics. This probably is going to make a sensation within the first minute.

1.1.1.List of deliverables

A Fully Functional Game at the end of the project.

1.2 ScopeThe Scope of this project is to develop a game that will be challenging for the player. The players will have to make quick decision to avoid the hurdles and obstacles as the policeman try to catch him.

1.3 ObjectiveThe main objectives which are implemented in this project are following.

To build an interesting game for user to play.To build a game that improves the decision making power of a human as he/she has to make a decision quickly.

1.4 Tools & Techniques

1.4.1 Tools

Unity 3D, Maya 2012

1.4.2 Language

C#, JavaScript

5

Page 6: Final Report of Game

1.5 Time lines

Deadlines Artifacts

Final Project Part-2

(Mid-Term) Player’s moves , Track/Path, Score calculation

Final Project Fully functional tested project.

6

Page 7: Final Report of Game

CHAPTER 2 Software Requirement Analysis

7

Page 8: Final Report of Game

2. Software Requirement AnalysisRequirement analysis is a process of understanding the user needs and expectations from a proposed system or application and is a well-defined stage in the software development life cycle model.

2.1 Functional / Non Functional RequirementsFunctional requirement documents the operations and activities that a system must be able to perform

Ref. No

Functional requirements Priority Nonfunctional requirement’s

Category

R1 System must allow the Player to move the thief left.

Must System should be available for 24/7.

Availability

R2 System must allow the Player to move the thief right.

Must System should be available for 24/7.

Availability

R3 System must allow the Player to swipe the thief when he/she drag the screen Downwards.

Must System should be available for 24/7.

Availability

R4 System must allow the Player to jump the thief up when he/she drag the screen upwards.

Must System should be available for 24/7.

Availability

R5 System should make different sounds if Thief (run, swipe/slide, jump, collect points).

Must System should be available for 24/7.

Availability

R6 System should Calculate the Score and display it.

Must System should be available for 24/7.

Availability

R7 System should measure the Distance travelled by the player.

Must System should be available for 24/7.

Availability

R8 System should increase the multiplier.

Must System should be available for 24/7.

Availability

8

Page 9: Final Report of Game

2.2 Use Case Diagram

Figure 2.2(Use case diagram)

9

System

Player

Move left

Move right

Jump

Swipe down

Measures distance

Increase multiplier

Calculate score

Make sounds

Page 10: Final Report of Game

2.2 Use Case Description

2.2.1 Description of Use Case 1

Use Case ID: 1

Use Case Name: Move left

Author Name: Fahad

Date Created: Jan 15, 2015

Actors/Entity: Player

Brief Description: In order to move the thief left the player has to drag the screen from right to left.

Preconditions: The player drags the screen from right to left.

Post conditions: The system should move the thief on left side on the track on which the thief is running.

Normal Flow: Actor Action System Response

1. The Actor drags the screen from right to left.

2. System moves the thief on left.

2.2.2 Description of Use Case 2

Use Case ID: 2

Use Case Name: Move right

Author Name: Fahad

Date Created: Jan 15, 2015

Actors/Entity: player

Brief Description: In order to move the thief right the player has to drag the screen from left to right.

Preconditions: The player drags the screen from left to right.

10

Page 11: Final Report of Game

Post conditions: The system should move the thief on right side on the track on which the thief is running.

Normal Flow: Actor Action System Response

1. The Actor drags the screen from right to right.

2. System moves the thief on right.

2.2.3 Description of Use Case 3

Use Case ID: 3

Use Case Name: Slide downwards

Author Name: Fahad

Date Created: Jan 15, 2015

Actors/Entity: player

Brief Description: In order to swipe the thief downwards the player has to drag the screen from up to down.

Preconditions: The player drags the screen from up to down.

Post conditions: The system should swipe the thief downwards.

Normal Flow: Actor Action System Response

1.The Actor drags the screen from u. to down

2. System swipe the thief downwards.

11

Page 12: Final Report of Game

2.2.4 Description of Use Case 4

Use Case ID: 4

Use Case Name: jump

Author Name: Fahad

Date Created: Jan 15, 2015

Actors/Entity: player

Brief Description: In order to swipe the thief upwards the player has to drag the screen upwards.

Preconditions: The player drags the screen upwards.

Post conditions: The system should lift the thief up.

Normal Flow: Actor Action System Response

1. The Actor drags the screen upwards.

2. System lifts the thief up.

2.2.5 Description of Use Case 5

Use Case ID: 5

Use Case Name: make sounds

Author Name: Fahad

Date Created: Jan 15, 2015

Actors/Entity: player

Brief Description: In order to make different sounds, the player has to move (left, right), jump, and slide down the thief on the track.

Preconditions: The player drags the screen in any direction to move the thief.

Post conditions: The system should make sound in reaction of player’s action.

12

Page 13: Final Report of Game

Normal Flow: Actor Action System Response

1. The Actor drags the screen. 2. System makes sounds.

2.2.6 Description of Use Case 6

Use Case ID: 6

Use Case Name: Calculate score

Author Name: Fahad

Date Created: Jan 15, 2015

Actors/Entity: system

Brief Description: In order to calculate the score systems should record the number of coins collected by the player.

Preconditions: Game starts.

Post conditions: The systems calculate the score and display it.

Normal Flow: Actor Action System Response

1.Game starts 2. System calculates the score and displays it.

2.2.7 Description of Use Case 7

Use Case ID: 7

Use Case Name: Measured distance

Author Name: Fahad

Date Created: Jan 15, 2015

Actors/Entity: system

Brief Description: In order to measure the distance systems should follow the thief.

Preconditions: Game starts.

13

Page 14: Final Report of Game

Post conditions: The systems measure the distance and display it.

Normal Flow: Actor Action System Response

1.Game starts 2. System measures the distance and displays it.

2.2.8 Description of Use Case 8

Use Case ID: 8

Use Case Name: Increase multiplier

Author Name: Fahad

Date Created: Jan 15, 2015

Actors/Entity: system

Brief Description: In order to increase the multiplier of the player systems should check the distance covered by the thief. More distance covered, increase multiplier.

Preconditions: Game starts.

Post conditions: The systems system check the distance covered by the thief. And increase the multiplier over time.

Normal Flow: Actor Action System Response

1.Game starts 2. System increases the multiplier over time.

14

Page 15: Final Report of Game

CHAPTER 3 System Design

15

Page 16: Final Report of Game

3. System DesignSystem design is the process of defining the architecture, components and data for the system to satisfy specified requirements.

3.1 System Sequence DiagramSystem diagram are created to show the sequence of events among different objects in system.

3.1.1 Move Left

.

Brief Description:

In order to move the thief left the player has to drag the screen from right to left.

3.1.2 Move right

.

16

Drags the screen right to left

Move the thief on left

: System

Use

Drags the screen left to right

Moves the thief on right

: System

Use

Page 17: Final Report of Game

Brief Description:

In order to move the thief left the player has to drag the screen from right left to right.

3.1.3 Slide down

.

Brief Description:

In order to swipe the thief downwards the player has to drag the screen from up to down.

3.1.4 Jump

.

17

Drags the screen downwards

Force the thief to swipe down

: System

Use

Drags the screen upwards

Lift the thief up in the air

: System

Use

Page 18: Final Report of Game

Brief Description:

In order to swipe the thief upwards the player has to drag the screen upwards.

3.1.5 Make sounds

.

Brief Description:

In order to make different sounds, the player has to move (left, right), jump, and slide down the thief on the track.

3.1.6 Calculate score

.

18

Performs different actions

Makes sounds in response

: System

Use

Start playing the game

Calculates the score over time and display it

: System

Use

Page 19: Final Report of Game

Brief Description:

In order to calculate the score systems follow the distance covered by the thief.

3.1.7 Measures distance

.

Brief Description:

In order to measure the distance systems should follow the thief.

3.1.8 Increase multiplier

.

19

Starts playing the game

Calculate the distance travelled over time

: System

Use

Play game, cross hurdles, moves on

Increase multiplier over time

: System

Use

Page 20: Final Report of Game

Brief Description:

In order to increase the multiplier of the player systems should check the distance covered by the thief. More distance covered, increase multiplier.

3.2 System Architecture Diagram

20

Device

Page 21: Final Report of Game

CHAPTER 4 Implementation

21

Page 22: Final Report of Game

4 ImplementationImplementation is the carrying out, execution, or practice of a plan, a method, or any design for doing something.

4.1 Tools and Technologies Used

4.1.2 Unity 3DUnity is a cross-platform game creation system developed by Unity Technologies, including a game engine and integrated development environment (IDE). It is used to develop video games for web sites, desktop platforms, consoles, and mobile devices. Unity is notable for its ability to target games to multiple platforms. Within a project, developers have control over delivery to mobile devices, web browsers, desktops, and consoles. Supported platforms include BlackBerry 10, Windows Phone 8, Windows, Android, iOS.

4.1.3 MayaMaya 3D animation, modeling, simulation, rendering, and compositing software offers a comprehensive creative feature set on a highly extensible production platform. Maya provides high-end character and effects toolsets along with increased productivity for modeling, texturing, and shade creation tasks.

4.2 Software Description (coding)

4.2.1 How Game Starts1) When game starts unity call two methods:

.Void Start ()

.Void Update ()

These methods automatically create when you make a script in Unity.

2) Unity call Start () method just one time when game starts.

After that unity call Update method again and again.

3) Now we define two methods which we call in the Start () method

Create Cell () that creates one cell on my defined positionCreate Player () that create player which we already defined as inspector.

Void Start ()

{

Create Cell (); //create one cell on specific position

Create Player (); //create player on the cell

}

4) We define three methods in the method Update():

Void Update ()

22

Page 23: Final Report of Game

{

Update Player();

Update Coins();

Create New Cells If Needed (false) ;

}

Update Player()

Update the player, means when the user will give input to the system then according to given input player perform its actions like jump, slide.

Update Coins()

Second method update the coins on each cells means on which position coins are to be shown. Create coins () is define in update coin(). We write in update() because when game starts on the first cell no coins were placed. That’s why we used update coin() in update () method.

Third method dynamically creates new cells and destroy previous cells when player visit the cell once, then it destroy it and create a new one in different positions. We used only twelve cells in the game. Our dynamically cells creation algorithm randomly select cell out of twelve and place them at random position.

4.2.2 Replace the objectWhen player died and game ends, then the system call two functions:

Ragdoll ();

On GUI ();

First method will call when player died so what id does it replace the player with ragdoll. Basically rag doll is a dead character we also use in our project.

If (player==null)

{

Game Object Rag Doll;

Player=Rag Doll;

}

23

Page 24: Final Report of Game

4.2.3 Game Scripting

PLATFORM GENERATION SCRIPT

using UnityEngine;using System.Collections;using System.Collections.Generic;

public class PLATFORMSCRIPTS : MonoBehaviour{public GameObject runnerRef;public int NumberOfPlatforms = 3;public float DistanceToRecycle = 0;float angle = 90.0f;public List<GameObject> platforms = new List<GameObject>();// Use this for initializationvoid Start(){runnerRef = GameObject.FindGameObjectWithTag("Running");GameObject platformPrefeb = Resources.Load("prefebs/platform") as GameObject;

for (int i = 0; i < NumberOfPlatforms; i++){GameObject g = Instantiate(platformPrefeb, Vector3.zero, Quaternion.AngleAxis(angle, new Vector3(0, 1, 0))) as GameObject;Vector3 tempScale = new Vector3(10, 13, 13);g.transform.localScale = tempScale;Vector3 tempPosition = new Vector3();if (platforms.Count > 0){tempPosition = platforms[platforms.Count - 1].transform.position;tempPosition.z += platforms[platforms.Count - 1].transform.localScale.z * .5f;}g.transform.position = tempPosition;g.transform.parent = gameObject.transform;platforms.Add(g);

}

}

// Update is called once per framevoid Update(){if (platforms[0].transform.position.z + DistanceToRecycle < runnerRef.transform.position.z){

24

Page 25: Final Report of Game

GameObject g = platforms[0];platforms.Remove(g);//----------------------------------Vector3 tempScale = new Vector3(10, 13, 13);g.transform.localScale = tempScale;Vector3 tempPosition = new Vector3();if (platforms.Count > 0){tempPosition = platforms[platforms.Count - 1].transform.position;tempPosition.z += platforms[platforms.Count - 1].transform.localScale.z * .5f;}g.transform.position = tempPosition;g.transform.parent = gameObject.transform;platforms.Add(g);}}}

PLAYER GENERATION SCRIPT

using UnityEngine;using System.Collections;using System.Collections.Generic;public class character : MonoBehaviour{public GameObject gg;

void Start(){

}

// Update is called once per framevoid Update(){

float moveInputZ = Input.GetAxis("Horizontal") * Time.deltaTime * 2;gg.transform.position += new Vector3(0, 0, Time.deltaTime * 2);rigidbody.animation.Play("run");

}//--------------------------------------------------

}

25

Page 26: Final Report of Game

LADY SCENE SCRIPT

using UnityEngine;using System.Collections;

public class lady : MonoBehaviour {public GameObject plarer;int count = 0;

// Use this for initializationvoid Start () {

plarer.animation.Play("punch");plarer.animation.Play("punch");

}

// Update is called once per framevoid Update () {count++;

plarer.animation.Play("run");float moveInputZ = Input.GetAxis("Horizontal") * Time.deltaTime * 6;

// transform.position -= new Vector3(0, 0, moveInputZ);

transform.position += new Vector3(0, 0, Time.deltaTime * 8);if (count == 120){Application.LoadLevel("NEWONE");}

}}

POLICE SCENE SCRIPT

using UnityEngine;

using System.Collections;

public class mainscene : MonoBehaviour {

int count = 0;

26

Page 27: Final Report of Game

void Update()

{

count++;

float moveInputZ = Input.GetAxis("Horizontal") * Time.deltaTime * 6;

// transform.position -= new Vector3(0, 0, moveInputZ);

transform.position -= new Vector3(0, 0, Time.deltaTime * 8);

if (count ==140)

{

Application.LoadLevel("SELECT");

}

}

}

COINS SCRIPT

cc1=PlayerPrefs.GetInt("coin1");

if (cc1 == 1)

{

GameObject coin = (GameObject)Instantiate(m_GoldCoin, pos + laneOffset, Quaternion.Euler(0, 360.0f / (k + 0.5f), 0));

cell.m_coins.Add(coin);

}

if (cc1 == 2)

{

GameObject coin = (GameObject)Instantiate(m_GoldCoin1, pos + laneOffset, Quaternion.Euler(0, 360.0f / (k + 0.5f), 0));

cell.m_coins.Add(coin);

}

if (cc1 == 3)

27

Page 28: Final Report of Game

{

GameObject coin = (GameObject)Instantiate(m_GoldCoin2, pos + laneOffset, Quaternion.Euler(0, 360.0f / (k + 0.5f), 0));

cell.m_coins.Add(coin);

}

private void UpdateCoins()

{

if (m_player == null)

return;

for (int c = 0; c < m_cells.Count; c++)

{

for (int k = m_cells[c].m_coins.Count - 1; k >= 0; k--)

{

if (Vector3.Distance(m_cells[c].m_coins[k].transform.position, m_player.transform.position) < 0.3f)

{

AudioSource.PlayClipAtPoint(m_chingAudio, m_player.transform.position);

Destroy(m_cells[c].m_coins[k]);

m_cells[c].m_coins.RemoveAt(k);

m_coinsCollected++;

}

}

}

}

28

Page 29: Final Report of Game

CHAPTER 5 Deployment

29

Page 30: Final Report of Game

5 DeploymentDeployment is all of the activities that make software available for use.

5.2 Installation process description

5.2.1 How to install the Game

Step 1:

Go to the Google Play Store and search for “Crazy Thief” on your Android tablet or Smartphone. Step 2:

Press the download button.

Step 3:

Install the game and start playing.

5.3 External dependencies

5.3.1 System RequirementsMinimum system requirements are given below,

1 OS 2.3.1 or later2 ARMv7 (Cortex) CPU or Atom CPU3 OpenGL ES 2.0 or later.

5.3.2 Android DevicesWe have tested the game on different devices,

1. Samsung galaxy S32. Samsung galaxy S3(Neo)3. Qmobile Noir A104. Sony Xperia5. Prestigio Multipad 7.0

30

Page 31: Final Report of Game

CHAPTER 6 Conclusion

31

Page 32: Final Report of Game

6 Conclusion

6.2 Evaluation of objective and aim

The main objectives which are implemented in this project are following.

To build an interesting game for user to play.To build a game that improves the decision making power of a user as he/she has to make a decision quickly.

32

Page 33: Final Report of Game

Appendix

Figure 3.2.1(Splash)

33

Page 34: Final Report of Game

Figure 3.2.2(Menu)

34

Page 35: Final Report of Game

Figure 3.2.3(Play)

35

Page 36: Final Report of Game

Figure 3.2.4(Free Character Store)

36

Page 37: Final Report of Game

Figure 3.2.5(Free store for Coins)

37

Page 38: Final Report of Game

Figure 3.2.6(Score)

38

Page 39: Final Report of Game

Figure 3.2.7(Help)

39

Page 40: Final Report of Game

Figure 3.2.8(Game End)

40