bomb hunter - technical university of...

111
05 - 07 - 2007 Final Thesis Technical University of Copenhagen The department of COM ________________________________________________________________________ Bomb Hunter -- Final thesis report Synopsis BOMB HUNTER IS A LOCATION BASED MOBILE GAME. BY USING GPS TECHNOLOGY AND GOOGLE EARTH MAP AS THE GAME BACKGROUND, PLAYERS CAN PLAY THE GAME WITHIN THEIR CITY. THE GAME WILL BECOME MORE VIVID AND FUNNY. Supervisor: Michael Rose Participant: Student number: Signature: YuQin Cao 041451 ZhiQiang Sun 041450

Upload: hoangkhuong

Post on 11-Jun-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 05 - 07 - 2007

    Final Thesis Technical University of Copenhagen

    The department of COM

    ________________________________________________________________________

    Bomb Hunter -- Final thesis report

    Synopsis

    BOMB HUNTER IS A LOCATION BASED MOBILE GAME. BY USING GPS

    TECHNOLOGY AND GOOGLE EARTH MAP AS THE GAME BACKGROUND,

    PLAYERS CAN PLAY THE GAME WITHIN THEIR CITY. THE GAME WILL

    BECOME MORE VIVID AND FUNNY.

    Supervisor: Michael Rose

    Participant: Student number: Signature:

    YuQin Cao 041451

    ZhiQiang Sun 041450

  • - 2 -

    Content Page

    Acknowledgements --------------------------------------------------------------------------------------------------------- 6

    Chapter 1 Introduction --------------------------------------------------------------------------------------------- 7

    1.1 Project Statement ---------------------------------------------------------------------------------- 8

    1.2 Project Schedule and Outline ---------------------------------------------------------------- 8

    Chapter 2 Mobile Game Design------------------------------------------------------------------------------- 11

    2.1 Game Scenarios Design -------------------------------------------------------------------------- 11

    2.2 The System Structure ----------------------------------------------------------------------------- 12

    2.2.1 Define the System Structure --------------------------------------------------------- 13

    2.2.2 The Data Exchange Protocol -------------------------------------------------------- 14

    2.2.3 Game Server ---------------------------------------------------------------------------------- 15

    2.2.4 Game Client ----------------------------------------------------------------------------------- 15

    2.3 The System Specification ----------------------------------------------------------------------- 16

    Chapter 3 Location-Based Mobile Game Market Analysis --------------------------------- 17

    3.1 Current Mobile Game Market Overview -------------------------------------------- 17

    3.2 LB Mobile Game Features ------------------------------------------------------------------- 20

    3.3 Bomb Hunter Game Apply Google Earth Map ---------------------------------- 21

    3.4 Analysis the Future Market for Bomb Hunter ----------------------------------- 22

    Chapter 4 Location Technology ------------------------------------------------------------------------------ 23

    4.1 Cellular Positioning -------------------------------------------------------------------------------- 23

    4.2 Indoor Positioning ---------------------------------------------------------------------------------- 24

    4.3 Satellite Positioning -------------------------------------------------------------------------------- 25

    4.3.1 GPS-------------------------------------------------------------------------------------------------- 26

    4.3.2 GPS Service ------------------------------------------------------------------------------------ 27

    4.3.3 GPS Positioning ----------------------------------------------------------------------------- 27

  • Content

    - 3 -

    4.3.4 Galileo --------------------------------------------------------------------------------------------- 30

    4.3.5 BH Design Based on GPS-------------------------------------------------------------- 31

    Chapter 5 Define the System Structure and the Transfer Protocol---------------------- 32

    5.1 Comparison and Choice-------------------------------------------------------------------------- 32

    5.1.1 How to Get the Location Information------------------------------------------ 32

    5.1.2 Choose the Proper Geographic Map-------------------------------------------- 33

    5.1.3 Modified the System Structure----------------------------------------------------- 35

    5.2 The Transfer Protocol ---------------------------------------------------------------------------- 35

    5.2.1 The Area List Data Scheme----------------------------------------------------------- 36

    5.2.2 The Game Scenario Data Structure---------------------------------------------- 36

    5.2.3 The Puzzle Data Structure------------------------------------------------------------- 37

    5.2.4 The Top Ten Score Data Scheme ------------------------------------------------- 38

    Chapter 6 Mobile Client Application Design---------------------------------------------------------- 39

    6.1 Application Flow------------------------------------------------------------------------------------- 39

    6.1.1 The Game Scenario Analysis------------------------------------------------------- 39

    6.1.2 Flow Design ---------------------------------------------------------------------------------- 39

    6.2 The Game Client Class Structure-------------------------------------------------------- 41

    6.3 Interface Design --------------------------------------------------------------------------------------- 44

    6.3.1 Screen Design ----------------------------------------------------------------------------------- 45

    6.4 Game Background Map ---------------------------------------------------------------------------- 49

    6.4.1 Map the GPS Coordinate to the Images--------------------------------------- 49

    6.4.2 Google Map ------------------------------------------------------------------------------------ 51

    Chapter 7 Mobile Client Implementation--------------------------------------------------------------- 56

    7.1 Module and Relationships --------------------------------------------------------------------- 56

    7.1.1 Modules Implementations ------------------------------------------------------------ 56

    7.1.2 Relationships of the Modules ------------------------------------------------------ 62

    7.2 Game Component ---------------------------------------------------------------------------------- 63

    7.2.1 Map Implementation --------------------------------------------------------------------- 63

    7.2.2 Sprite Implementation ------------------------------------------------------------------ 65

  • Content

    - 4 -

    7.2.3 Make Transparent Image for Sprite ------------------------------------------- 66

    7.2.4 Sprite Animation---------------------------------------------------------------------------- 67

    7.2.5 Sound Effect ----------------------------------------------------------------------------------- 69

    7.2.6 Score Counting Rules ------------------------------------------------------------------- 69

    7.3 Complement -------------------------------------------------------------------------------------------- 70

    7.3.1 Text Drawing---------------------------------------------------------------------------------- 70

    7.3.2 Using Buffer to Avoid Screen Flick---------------------------------------------- 70

    7.4 Interfaces Implementation -------------------------------------------------------------------- 71

    Chapter 8 Game Server Design ------------------------------------------------------------------------------ 75

    8.1 Game Functions Specification--------------------------------------------------------------- 75

    8.2 Game Server Analysis --------------------------------------------------------------------------- 76

    8.3 Game Server Design------------------------------------------------------------------------------- 78

    8.3.1 Game Server Database Structure ------------------------------------------------ 79

    8.3.2 Web Page Prototype and Web Site Map-------------------------------------- 82

    8.3.3 How to Maintain the Game Data ------------------------------------------------- 83

    Chapter 9 Game Server Implementation --------------------------------------------------------------- 87

    9.1 Web Page Implementation -------------------------------------------------------------------- 87

    9.2 Web Page with Form ----------------------------------------------------------------------------- 88

    9.3 Game Area and Scenario Editor ---------------------------------------------------------- 89

    9.4 The Pages for the Game Client ------------------------------------------------------------- 93

    Chapter 10 Testing------------------------------------------------------------------------------------------------------ 95

    10.1 Testing Strategy--------------------------------------------------------------------------------------- 96

    10.1.1 Game Server Test Plan --------------------------------------------------------------- 96

    10.1.2 Mobile Client Test Plan--------------------------------------------------------------- 97

    10.1.3 System Test Plan--------------------------------------------------------------------------- 98

    10.1.4 Playability Test Plan-------------------------------------------------------------------- 98

    10.1.5 Playability Test Plan ------------------------------------------------------------------- 98

    10.2 Test Result ---------------------------------------------------------------------------------------------- 99

  • Content

    - 5 -

    10.2.1 Game Server Test----------------------------------------------------------------------- 99

    10.2.2 Mobile Client Test ---------------------------------------------------------------------- 100

    10.2.3 System Test --------------------------------------------------------------------------------- 101

    10.2.4 Memory Cost Test ---------------------------------------------------------------------- 102

    10.2.5 Playability Testing ---------------------------------------------------------------------- 103

    10.3 Test Conclusion---------------------------------------------------------------------------------------- 103

    Chapter 11 Conclusion and Future Work Proposal------------------------------------------------- 106

    11.1 Project Review----------------------------------------------------------------------------------------- 106

    11.2 Future Work Proposal---------------------------------------------------------------------------- 107

    11.3 Personal Achievements--------------------------------------------------------------------------- 109

    Appendix 1. Reference ------------------------------------------------------------------------------------------------- 110

    Appendix 2. Testing Report ---------------------------------------------------------------------------------------- 112

    Appendix 3. The Mobile Client Source Code ------------------------------------------------------------ 144

    Appendix 4. The Game Server Source Code ------------------------------------------------------------- 194

    (CD Attached)

  • - 6 -

    Acknowledgements

    The Location Based Mobile game --- Bomb Hunter Project has been done at the

    Technical University of Denmark (DTU) under the supervision of Michael Rose and

    Jakob Eg Larsen from the Research Center COM. We would like to thank for their

    good hints and helpful discussions along this project phase so as to make us finish the

    project on time.

  • - 7 -

    Chapter 1

    Introduction

    In the start point, we have done some research to find the project design idea for the

    master thesis. We choose location based mobile game as our project subject. We call our

    game name Bomb hunter. The game inspiration comes from one of our favorite Xbox

    Game Spy Hunter. Certainly, Spy Hunter is neither a location based game nor a mobile

    game. In Spy Hunter, the player drives vehicle around the city and performs different

    missions. We think, if the game can combine the real world with the virtual cyber space

    together, players performing the virtual mission in the real city would be a good

    experience. Besides that, it is also a developing field for the mobile game integrated with

    the different kinds of location technologies. It attracts us to implement one location based

    mobile game within this master thesis period. So Bomb Hunter pops up from our brain

    storm.

    After we discuss the design idea with our supervisor, we get some good hints and guiding

    about how to implement the whole project during the given project period. In addition,

    from the Internet, we found a Japanese mobile game [1], which is called Mogi, the item

    hunt from French company Newt Games. It uses the GPS functions of the KDDI AU

    phones and allows players to pick up virtual items spread on the whole of Japan. Our idea

    has the same principle as this. The difference is that we want our game to be a shooting

    and puzzle game. In the game, players can shoot some virtual enemies along the real

    streets. At the same time, they should solve or answer some puzzles. We dont find the

    same product from the current location based mobile game marketing.

    We do believe that we will learn more things from this project, like mobile game

    development, mobile game marketing, location technologies, location-based service,

    python programming language and so much more.

  • Introduction

    - 8 -

    1.1 Project Statement

    Bomb hunter is a location based mobile game. The purpose of the application is to

    investigate how the location technology can be used in mobile game, how we can connect

    a virtual cyber environment with the real world, how to extend the game field from

    indoor or in-computer area to outdoor / out-computer area. Along the project process, we

    will research mobile game market, the status of the location based mobile game and the

    current location technologies. At the same time, we will design and implement a location

    based mobile game - Bomb Hunter.

    In our game design, there are three aspects, which are brand new ideas. At least we

    havent found who has done this before during our research.

    First, we make useful of the Google Satellite Map which is as the background

    of the game. This makes the game connect the virtual world and the real world

    very well.

    Second, we add the shooting scenario in our game. This scenario is so common

    in the desktop computer game, but seldom in the location based game.

    Third, in the game server, we implement a visual scenario editor by using

    Google Satellite Map, which is used to maintain and design the game scenario.

    This makes the administration job easier and clearer.

    1.2 Project Schedule and Outline

    The whole project includes three main parts. The first part is about the project

    investigation and research, which contains the game scenarios, the game design ideas,

    marketing analysis and the location technologies. The second part describes the product

    design, implementation and system testing. The last part summary the conclusion and the

    future work of the product. Based the project structure, we make a detail time schedule to

    control the project process in order to finish it within the given time.

  • Introduction

    - 9 -

    The project outline is as following:

    Chapter 1: Introduction

    This chapter describes the basic game idea, the idea origination, and the purpose of

    doing such project. We also state the problems to be solved along this period.

    Chapter 2: Mobile Game Design

    This chapter introduces the game scenarios and pops up the design idea. Base on the

    research, we will define the system structure.

    Chapter 3: Location-Based Mobile Game Market Analysis

    We make some researches about the mobile game market based on the GPS location

    technology. We analyze the location mobile game characteristics. This Bomb Hunter

    game applied for the Google Earth map as the game background. It shows some new

    vivid features which is not used by the normal traditional game. At last it looks

    forward a nice future among the mobile games market.

    Chapter 4: Location Technology

    In this chapter, GPS location technology will be discussed in detail and the other

    location technologies will be mentioned as well.

    Chapter 5: Define the System Structure and the Transfer Protocol

    Comparing the research results, we make a last decision for our system structure. The

    system is the server-client mode. We analyze the information, which will be

    exchanged between the server and the client, and define some protocols as the

    conventions for the system.

  • Introduction

    - 10 -

    Chapter 6: Mobile Client Application Design

    Design the game loop for the mobile client and construct a class diagram to divide

    functions into different sub modules. Furthermore, we explain Google map principle

    in detail and design the application interfaces.

    Chapter 7: Mobile Client Implementation

    This chapter, we implement each class module and specify the properties, functions

    for each class. All the game sprites have been designed here. We specify the sprite

    images, animations, sound effects, background map, and score counting rules. In

    additional, we complement some extra modules which are used to fix some bugs of

    the Pys60. At the end of the chapter is the client interface implementation.

    Chapter 8: Mobile Server Design and Implementation

    In this chapter, we analyze and design the database structure of the game server,

    design the web site map, design the game scenario editor interface.

    Chapter 9: Game Server Implementation

    We follow the design outline to implement the game server. One of important

    implementation is the game scenario editor. It realizes the game scenario visual

    editing purpose.

    Chapter 10: Testing

    We summary all the system testing cases and the testing results. The tests include the

    three levels function testing and the playability testing. Finally, we draw a conclusion

    for the testing.

    Chapter 11: Conclusion and Future Work Proposal

    The last chapter, we review our design process, the implementation result and draw a

    conclusion for the whole project. As an extension, we explain how to improve our

    game in several aspects in the future.

  • - 11 -

    Chapter 2

    Mobile Game Design

    Bomb hunter is a location based mobile game. As a game, it is better to have a

    background story. Following the story, we can easy to imagine some scenarios and

    construct a game. This chapter we describe a game background story first. Then, explain

    the system structure.

    2.1 Game Scenario Design

    In 2010, one terrorist organization called COBRA will break down the peace of Denmark.

    COBRA has planned a series of terrors. Their notorious manner is using bomb. Paul

    Smith is pre-employed bomb specialist of FBI, fired as leaking top secret to a laser

    product company. Currently he is employed by COBRA. He is a key bomb designer of

    BOBRA. According to the information from the spy, there are three different types of

    bombs designed and launched soon.

    Bomb type I: Normal Bomb - This type bomb can be eliminated by shooting.

    Bomb type II: Puzzle Bomb - Each puzzle bomb has been set a puzzle. The

    player must give a right answer to eliminate the bomb.

    Bomb type III: Tiny Embedded Biologic Bomb.

    This kind of bomb is embedded into the mouse body. This is very headache

    problem. The mouse can run everywhere in the sewer pip of city. They inject

    some special medicine to keep mouse life after embedded bomb. This medicine

    makes embedded mouse like to eat chocolate very much. This is a good hint for

    hutting them.

  • Mobile Game Design

    - - 12 -

    It should be careful of the bomb watcher. The watchers are walking along the streets.

    They prevent a bomb from being destroyed. Youd better take them away before you

    remove the bomb.

    Another bad news, COBRA has installed some bombs in the downtown area of the

    Copenhagen. In order to make the affection as big as possible, terrorists major targets are

    metro, train station, sightseeing areas and downtown walk streets.

    Denmark Government organizes a team, Bomb Hunter, which has the duty to find and

    eliminate the bombs. The tasks of Bomb Hunter are following:

    Find and eliminate bombs.

    Take away all terrorists.

    Every player is a member of the team. The task of a player is to go around the

    Copenhagen city and eliminate bombs and terrorists.

    2.2 The System Structure We decide to make our system work in the server-client mode. There are three reasons to

    use this structure.

    First, the mobile phone is a small device, which has small memory size and slow CPU

    speed. So, it is not good to put all modules and functions in such a device. By adding a

    server, it can share the part of the job load.

    Figure2.1 Server Client Structure

    Game Server

    Mobile Client

  • Mobile Game Design

    - - 13 -

    Second, it is easy to update some game scenarios and contents. When an application is

    installed in the mobile phone, the application is somehow fixed. For some applications or

    games, it seems fine. But it isnt good for our game. We mentioned above that a player

    answer some puzzles to eliminate a puzzle bomb. If those puzzles are kept the same every

    day, the players will loss the interest soon. By adding a game server, it is possible to

    update puzzle frequently and arrange the bombs and the watchers in different locations in

    order to increase the game playability.

    Third, the location is not the same for different players. Our game is a location based

    game. The players may live in different areas. Some players may just want to play this

    game in their local areas. In this case, it is better to have a different game scenarios based

    on the player local area. Also, it makes no sense to install the whole Copenhagen area

    game scenarios data into one phone which is only used the local area data.

    2.2.1 Define the System Structure

    We have defined the basic structure is the server client mode. Now, there are two key

    issues we havent decided yet. One is how to retrieve the location information. Another is

    how to construct a geographic map. Those two factors are the base of the location based

    application.

    How to retrieve the location information

    In research process, we have investigated several location technologies. From the

    coverage point of view, we intend to use GSM or GPS technology. About the choice,

    we will decide after a further research around those two technologies.

    How to construct a geographic map

    When we considered this issue, the first mind is the routing used GPS map. Later, we

    discarded this idea.

  • Mobile Game Design

    - - 14 -

    There were two reasons:

    1) the most GPS map is copyright reserved and we couldnt find free used GPS map.

    2) GPS routing used map isnt as vivid as our expected in the game. In the further

    search, we noticed that Google earth [2] and Krak1 provide the map information. The

    Google can provide almost all the global earth map. The KRAK focuses on the map

    information of Denmark. Which one is our choice? The decision will be drawn after

    the further research and comparisons. At this moment, we define our system structure

    as Figure 2.2

    Figure 2.2 the System Structure

    2.2.2 The Data Exchange Protocol

    When we define the server client structure, the coming issue is how to exchange data

    between the game server and the mobile client. So we need to define a protocol to specify

    the data exchange format between the game server and the mobile client. According to

    our programming experiences, XML is a good manner to specify some data standard.

    XML allows developers to set standards defining the information that should appear in a

    document, and with which sequence. XML, in combination with other standards, makes it

    possible to define the content of a document separately from its formatting, makes it easy

    to reuse that content in other applications or for other presentation environments. Most

    1 KRAK.DK a Danish map provider.

    Game Server Google Earth or

    Krak.dk

    Smartphone GPS / GSM

    Exchange information by

    GPRS

  • Mobile Game Design

    - - 15 -

    important, XML provides a basic syntax that can be used to share information between

    different kinds of computers, different applications, and different organizations without

    needing to pass through many layers of conversion [3]. But, using XML may cause the

    other problems, 1) is there any XML parser for Python? 2) How about the memory cost

    for the mobile phone? We will do the further reaserch and make a choice later.

    2.2.3 Game Server

    As we mention before, we put part of the job load into the server. Currently the game

    server is mainly used to maintain and store game scenario data for the game client. When

    the game client is launched, it will ask some updated information from the server. We

    choose to use a web server to implement the game server function. There are three

    advantages to do so.

    First, it is simple to implement.

    Second, the administrator can easily maintain the game server data through a designed

    web interface.

    Third, as a game pulication place, players can get to know the game and download the

    game from the game server.

    To construct the game server, we choose Linux based web server. The server script

    language is PHP [4] and the database is MYSQL [5]. Because they are open source

    software and free to use.

    2.2.4 Game Client

    Nokia mobile phone is our first choice. The reason is that the Nokia phone support third

    party software installation. It is easy to build a develop environment in the Nokia phone.

    Currently, there are three languages used in Nokia mobile phone programming, C++,

    Java and Python. We have some experience in using Symbian OS C++ [6] and J2ME [7]

    for mobile programming. We feel that Symbian OS C++ is somehow complex in use.

    J2ME is a Java platform for mobile device; it is wide spread in mobile phones, PDAs,

    even TV set-top boxes. It is a good choice in mobile programming. Bute, we choose the

  • Mobile Game Design

    - - 16 -

    Python as mobile client side programming language finally. One reason is we want to

    learn some new things. Another is we heard that Python is a very rich language with

    many features [8]; it has a clear and simple syntax; it is easy to make program in a short

    order. At present, there are three different Python versions for Nokia S60 phone.

    2.3 The System Specification

    Review the system analysis; we summarize our system specification as following:

    The transfer protocol script format: XML or plain text

    The game server type: web server

    The server side script language: PHP

    The server side database: MySQL

    The web interface script language: HTML, JavaScript, CSS

    Mobile phone and platform: Nokia, Symbian S60 OS

    Mobile client side program language: Python (pys602)

    Location Technology: choose between GSM and GPS

    Geographic map: choose between Google map and Krak

    Above, the location technology and the geographic map will be decided after the further research.

    2 Python for Nokia s60 system

  • - 17 -

    Chapter 3

    Location Based Mobile Game Market Analysis

    Games are so attractive for the people all over the world. Games have a very long history

    since the human being has existed. People follow some rules to solve problems and

    puzzle when they play games. During the playing, games can provide for the players

    entertainment and relaxation. At the same time, people learn skills and new knowledge by

    playing. Today people enjoy playing too many kinds of games day and night. Location-

    based Mobile game is one of the games, which is a very young phenomenon in the

    history of the games. This project is a location-based mobile game. First of all, the market

    for this kind of game will be analyzed.

    3.1 Current Mobile Game Market Overview

    Mobile games are computer software games played on a mobile phone, smart phone,

    Personal Digital Assistant or handheld computer.

    Mobile games may be played using the communication technologies present in the device

    itself, such as by text message (SMS), multimedia message (MMS) or GPRS location

    identification. More common are games that are downloaded to the mobile phone and

    played using a set of game technologies on the device.

    Mobile games are usually downloaded via the mobile operators radio network, but in

    some cases are also loaded in to the mobile handsets when purchased, or via infrared

    connection, Bluetooth or memory card. Mobile games are developed using platforms and

    technologies such as Windows Mobile, Palm OS, Symbian OS, Macromedias Flash Lite,

    DoCoMos Doja, Sun Microsystemss J2ME, Qualcomms BREW (Binary Runtime for

    Wireless) or Infusios ExEn (Execution Environment).

  • Location Based Mobile Game Market Analysis

    - - 18 -

    Device limitation, business-model fluctuations and bandwidth constraints hindered

    innovation in all aspects of mobile game design in its early years. In recently years,

    mobile devices have developed from rudimentary mobile phones to sophisticated mobile

    computers with high-resolution multicolor displayers, high-speed processors and several

    megabytes of storage. Mobiles have so many capabilities that can be used not only for

    making phone calls and are also very attractive to be used as mobile consoles for playing

    games. The users remember clearly that Nokia introduced its snake-game on its mobile

    phone in the middle of 1990s as Figure3.1.

    Figure3.1 Snake Game

    Figure3.2 LB Mobile Game

    After that, games become an essential part of mobile phones regardless of manufacturer.

    Figure 3.2 shows the location- based mobile games merge the virtual and the real worlds

    together. The current locations of the users become a part session of the play. For

    example, the online players have to catch the professional players who run through the

    real city streets. And the online players are equipped with a mobile device for tracking

    the runner and communication with the game server. Or the players have to cruise the

    streets of a city to collect virtually hidden treasures. The mobile device indicates the

    hiding places of the treasures on a map. The players have to move to that place as soon as

    possible before the other players find the treasures.

  • Location Based Mobile Game Market Analysis

    - - 19 -

    More recently, technological advancements have enabled to start purchasing more games

    on the mobile telephone networks.

    Figure3.1.3 declares that the habits of playing mobile games from the six different

    countries. The detail investigation aspects with the corresponding data percents show

    that the current mobile game market trends:

    Investigation aspects China Germany India Spain Thailand United

    States

    1

    The majority of the respondents play mobile games at least once a week

    73 % 70 % 96 % 77 % 83 % 79 %

    2 The average session lasting (minutes) 18.6 27.8 38.9 21.6 28.9 30.6

    3 Play at home 60 % 41 % 87 % 50 % 74 % 57 %

    4 Playing while travelling/commuting 62 % 85 % 87 % 50 % 48 % 65 %

    5 while waiting 41 % 54 % 41 % 40 % 79 % 57 %

    6

    Nokia's next generation mobile gaming option is preferred

    68 % 68 % 68 % 52 % 83 % 49 %

    7 Over Java 2D 18 % 12 % 14 % 12 % 7 % 12 %

    8 Over Java 3D 26 % 20 % 17 % 36 % 11 % 39 %

    9 Quality of graphics 77 % 85 % 93 % 74 % 94 % 74 %

    10 Quality of sound 72 % 74 % 91 % 76 % 85 % 77 %

    11 Get the games over-the-air 28 % 29 % 48 % 33 % 44 % 60 %

    12 Get the games over-the-Internet 56 % 45 % 31 % 48 % 27 % 27%

    13

    Being given an opportunity to trial games before buying it

    50 % 43 % 43 % 41 % 60 % 38 %

    14

    Paying for a full game outright is strongly preferred

    40 % 79 % 49 % 83 % 69 % 68 %

    15 Paying by subscription 50 % 17 % 36 % 11 % 19 % 28 %

    16 Paying by the level 10 % 4 % 15 % 5 % 12 % 4 %

    17 Play multiplayer games at least once a week 24 % 17 % 33 % 16 % 22 % 28 %

    18 Interested in sending demos to friends 54 % 39 % 89 % 62 % 74 % 53 %

    19 Likely to trial games sent by friends 66 % 73 % 92 % 81 % 86 % 74 %

    Figure3.3 Exploring Worldwide Mobile Gaming Habits

    3

    On the revenue side, the mobile gaming market is expected to generate nearly $2 billion

    by 2011 in the United States and more than $7 billion globally. Mobile gaming isn't as

    big as traditional console gaming now but the mobile market will eventually overtake the

    console market. It has a big potential.

    3 Evolution_Of_Mobile_Gaming_1_0_en.pdf

  • Location Based Mobile Game Market Analysis

    - - 20 -

    The recent study on wireless gaming reveals the extent of that potential. The number of

    mobile game purchasers is predicted to grow more than 16% annually, reaching nearly 50

    million customers by 2010. The price per mobile game is expected to raise more than

    $2.50.

    Experts agree it will take a considerable effort to educate people about mobile gaming.

    The trend is to focus on educating consumers about mobile gaming and double the size of

    the market. Many people don't even know they have games on their mobile devices.

    It's about getting games to play on hundreds of different cell phones. The customers

    shouldn't have to worry about what handsets are playing the games. Creating a mobile

    culture is to get people to try games. The payoff is still a few years away. Mobile gaming

    is still in the early stage. It's not a huge industry and expected to be an explosion and

    ramp-ups in 2008 and 2009.

    But preparing a game for launch doesn't happen overnight. It takes three to four years

    with 100 to 200 developers to build a game, so it's a huge investment. It takes longer to

    build a game than to film a movie.

    And what makes a mobile game successful? The success of casual games over mobile

    phones is simple games, accessible, digestible and replay able.

    3.2 LB Mobile Game Features

    Games played on a mobile device using location technology like GPS are called

    Location-based game. These are not only played on mobile hardware but also integrate

    the players position into the game concept. In other words: while it does not matter for a

    normal mobile game where exactly you are (play them anywhere at any time), the

    players coordinate and movement are main elements in a location-based game. More and

    more mobile phones with integrated GPS are expected to come. External GPS receivers

    are usually connected via Bluetooth.

  • Location Based Mobile Game Market Analysis

    - - 21 -

    The current LB Mobile Game is the most well-known example is the treasure hunt game

    Geocaching, which can be played on any mobile device with integrated or external GPS

    receiver. Besides Geocaching, there existed several other location-based games which are

    rather in the stage of research prototypes than a commercial success.

    When attempting to build location into games, the complexity of location technologies,

    the difficulties involved with integrating spatial data, and the accuracy of consumers

    location that are needed in various game situations should be taken more consideration.

    In addition, positioning technologies, such as triangulation, GPS, and Cell-ID, each have

    their own complexities, accuracies and latencies. Finally, the choice of location

    technology that is implemented often varies by carrier and region of the world.

    The location-based game market faces other substantial hurdles. For example, GPS-

    enabled games often require expensive mapping data, and a server is required to provide

    location information, so games are typically more expensive than simpler titles. And most

    location-aware games to date require substantial mobility on the part of the user. They

    cant play indoors, for instance, or even near streets behind the tall buildings or in

    crowded areas.

    Along with the increasing inclusion of Bluetooth in devices enables the easier integration

    of GPS, the emergence of location platforms for mobile games offers additional

    opportunities. The whole mobile game markets are evolving rapidly and becoming a true

    business for the industry actors. Mobile games are one of the key mobile content areas

    and create profits for telecom operators as well as for their publishers and developers.

    The location-based games, which are as the new genre, of course also attract so many

    businessmen to invest. Its exciting future will bring more entertainment to the players and

    the world.

    3.3 Bomb Hunter Game Apply Google Earth Map

    After investigation, the project apply Google Earth map as the game background. Google

    earth is a powerful tool. There is a huge earth image database in Google server. If we can

  • Location Based Mobile Game Market Analysis

    - - 22 -

    make useful it in our game, it can make game more fun and also save a lot of work for us.

    After research, we found some hint about Google map address and retrieve method.

    3.4 Analysis the Future Market for Bomb Hunter

    Our project Bomb Hunter game design will give the players a new outlook and exciting

    playing experiences. It makes useful of the Google earth map, the players can get

    dynamic game environments based on where they are. The game environment comes

    from the real life and combines with the virtual game world. This game situation will be

    completely different from the normal mobile games. And also this game design take full

    advantage of the mobile aspect of what mobile phones are and utilize the functionality of

    what these handsets have. Based on this design, the project is divided into the research

    period and the commercial period.

    For the master thesis part, it stands on the research prototype.

  • - 23 -

    Chapter 4

    Location Technology

    In the project, the bomb hunter game system is developed by using the location

    technology doing the positioning. Based on this point, the related location-based

    technologies and services will be introduced and discussed in this chapter.

    The criterion of the positioning classification considers the type of the network in which

    it is implemented and operated. So it is including cellular, satellite, and indoor

    positioning infrastructures, technologies and services. Location-based Services (LBS) are

    the services for providing information that has been created, compiled, selected, or

    filtered taking into consideration the current locations of the users or those of other

    persons or mobile objects. [9]

    All the details will be talked about in the following paragraphs.

    4.1 Cellular Positioning

    Mobile telephone becomes very popular in the modern society. It is an important tool for

    the people to use every moment. It makes the way of the life more mobility and

    availability.

    Global System for Mobile (GSM) [10] communication technology is one of the most

    important technologies to be used for the mobile telephone networks. The functionality is

    to ensure acceptable quality of a call. The mobile phone is called handover. Handover

    transfers the call transparently from one stationary antenna to another during the call,

    when the quality of the transmitted data decreases. The primary goal of a mobile

    telephone network like GSM is that a subscriber having a mobile telephone can make and

    receive calls anywhere. To achieve this goal, some major functions are required, e.g. call

  • Location Technology

    - - 24 -

    management and call processing, radio management, mobility management, charging,

    and security.

    Cellular positioning refers to the mechanisms in cellular networks like GSM for obtaining

    the position of a subscriber. Basically, the procedures of the location management can be

    exploited for this. Actually, this is the principal way LBSs work in todays cellular

    networks. But using only location management for supporting location based services has

    some deficiencies, for example, insufficient accuracy and inappropriate location formats

    like cell and location-area identifiers. Thus, network operators have considerably

    extended their networks by introducing auxiliary components and protocols in order to

    perform positioning in a more appropriate, accurate, and efficient manner. Usually,

    operators of cellular networks tend to implement and run several positioning methods in

    parallel in order to improve availability and to deploy them adaptively depending on the

    user and service requirements, current network utilization, migration aspects, and other

    criteria.

    4.2 Indoor Positioning

    Indoor positioning focuses on a deployment in buildings, on university campuses and

    company premises. From its very beginning, it has been formed by activities in the area

    of ubiquitous computing and is often denoted by alternative terms like location sensing. It

    is based on radio, infrared, or ultrasound technologies with a very limited communication

    range. Indoor positioning is realized either by a stand-alone infrastructure, for example,

    as done in the Active Badge system, or in conjunction with Wireless Local Area

    Networks (WLANs) like IEEE 802.11. [11] In the former case, targets are equipped with

    proprietary tags or badges, which operate on the basis of infrared, ultrasound, or Radio

    Frequency Identification (RFID) technology, and which receive pilot signals from or

    transmit them to a nearby base station. If positioning is integrated into WLANs, standard

    components like PCMCIA cards and access points can be used. The benefits of indoor

    positioning are the low power consumption of the involved devices and the

    comparatively high accuracy because of the short range of underlying radio or ultrasound

    technologies. Unfortunately, there have been only proprietary systems so far, in most

  • Location Technology

    - - 25 -

    cases developed in the context of research activities or focusing on dedicated applications,

    and standardization issues have not advanced or even started yet. Thus, there is a lack of

    open, well-specified systems that can be universally applied like GPS or cellular

    positioning.

    4.3 Satellite Positioning

    The Global Positioning System is a satellite-based navigation system consisting of a

    network of 24 orbiting satellites in six different orbital paths. The satellites are constantly

    moving, making two complete orbits around the Earth in just less than 24 hours.

    Each satellite is expected to last approximately 10 years. Replacements are constantly

    being built and launched into orbit. The satellite orbits are roughly 25,000 kilometers

    from the earth's centre, or 20,000 kilometers above the earth's surface. The orbital paths

    of these satellites take them between roughly 60 degrees North and 60 degrees South

    latitudes. This means that users can receive satellite signals anywhere in the world, at any

    time. As you move closer to the poles (on your next North Pole or Antarctic expedition!),

    you will still pick up the GPS satellites. They just won't be directly overhead anymore.

    This may affect the satellite geometry and accuracy but only slightly. One of the biggest

    benefits over previous land-based navigation systems is GPS works in all weather

    conditions. No matter what your application is, when you need it the most, when you're

    most likely to get lost, your GPS receiver will keep right on working, showing right

    where you are!

    From May of 2000, Satellite Positioning started to be as civilian use, including car

    navigation, surveying, mapping and LBS etc.

    Our project applies for GPS technology to locate the game position. So this chapter will

    introduce the GPS fundamental technology: GPS infrastructure and devices, services,

    signals and Galileo Satellites.

  • Location Technology

    - - 26 -

    4.3.1 GPS

    Global Positioning System consists of three segments: the space segment, the control

    segment and the user segment.

    The space segment normally contains 24 satellites which circulate the Earth

    every 12 sidereal hours on six orbits.

    The control segment is responsible for monitoring and controlling the satellites

    of the space segment. It consists of five ground stations around the world. All the

    ground stations are Monitor Stations that are equipped with GPS receivers for

    monitoring and tracking the satellites. They control the health of each satellite,

    their orbits as well as the accuracy of their internal clocks. The data measured by

    these stations is then passed to the central Master Control Station. This station

    processes the received control data and calculates clock corrections and satellite

    ephemerid. Furthermore, it centrally coordinates all operations concerning the

    space segment, ranging from corrections of satellites orbits, clock keeping, and

    signal encryption. For each satellite a dedicated message with control data is

    assembled and returned to one of three Uplink Stations, which then transmits the

    control message to the respective satellite. These Uplink Stations are collocated at

    the Monitor Stations.

    The user segment is the part of the GPS system, which most of the users are

    familiar with this segment. It is often simply equated with a GPS receiver. Its

    configuration actually depends on the application it is used for. The areas of the

    deployment are land, sea, the air navigation, surveying, mapping, military

    applications and, most important Location Based Service. For LBSs, it is

    including mobile marketing, community services, health care, and navigation. A

    key prerequisite for the mass-market introduction is the availability of GPS

    receivers that can be integrated into or at least attached to mobile devices and that

    have only low power consumption.

  • Location Technology

    - - 27 -

    4.3.2 GPS Service

    There are two kinds of services by the GPS system: the Standard Positioning Service

    (SPS) and the Precise Positioning Service (PPS). The SPS is a positioning and timing

    service focusing on the civilian user. The PPS is a positioning, velocity and timing serice

    for military applications.

    Accuracy Standard 95% Vertical error 95% Horizontal error

    Global average < 22m < 13m

    Worst site < 77m < 36m

    Table 4.1 Positioning and Timing Accuracy Standard

    The drawbacks of the current GPS location technology are like: the high battery

    consumption of receivers, high TTFF (Time to First Fix) values, missing support indoors

    and in close proximity to huge buildings that shadow the signals emitted by the satellites.

    4.3.3 GPS Positioning

    GPS positioning comprises three steps: identification of satellites, range measurements

    and position calculation. [12]

    Identification of satellites

    The receiver must identify the satellites for the measurements. The usual number of

    satellites being in the visible horizon of the receiver is typically in the range of 5 to 10.

    The procedure used for identifying them depends on the state of the receiver. If it has no

    information about its last position and no almanac, it will take as much as a few minutes

    to acquire those data. This procedure is called cold start up. On the other hand, if almanac

    and last position are known, the receiver can perform a warm start-up. Having this

    information, it can roughly estimate the current satellite constellation, which helps to

    reduce the startup time. The most modern GPS receivers will give you a positional fix in

    10 - 20 seconds [13]. Finally, this time can be further reduced if the receiver holds the

  • Location Technology

    - - 28 -

    valid ephemeris, which allows for calculating the current satellite constellation very

    accurately, and hence in most cases the identification procedure can be avoided. This

    procedure is called hot start-up. From all satellites identified in this way, the receiver

    selects a subset of at least four satellites that are actually considered during the

    measurements.

    Range Measurements

    There are different methods for measuring ranges in GPS.

    The common procedure of conventional GPS receivers for SPS is to apply code phase

    ranging using the spread pilot signal on the L1 carrier (1575.42Hz). On the other hand,

    equipment designed for PPS uses code phase ranging on both carriers (dual-frequency

    ranging) and can thus adjust much better to ionospheric refraction, which significantly

    increases accuracy of the position fixes.

    Figure 4.1 Range Measurements

    Range measurements must be made to at least four satellites, three for obtaining the

    position in 3D and the other for time synchronization between the satellites and the

    receiver.

    GPS receivers are equipped with low-cost quartz-crystal clocks, which suffer from a

    considerable drift against the very precise atomic clocks of satellites. All measured

  • Location Technology

    - - 29 -

    distances between the receiver and the satellite appear to have a range of 0300 km, since

    the receiver cannot discriminate between different code cycles.

    Finally, it must be stressed that the main assumption for performing ranging in GPS is

    that there is a line of sight between the receiver and the satellites. This is due to the fact

    that the signals emitted by the satellites hardly penetrate obstacles. While it is sometimes

    difficult to derive position fixes even outdoors when staying under trees and surrounded

    by a number of large buildings, it is nearly impossible when staying inside a building.

    However, in recent times, receiver technology has progressed, and hence modern

    receivers with high sensitivity can even receive GPS signals with a sufficient strength

    inside buildings and interpret it. This method is also known as Indoor GPS.

    Position Calculation

    If a GPS receiver get the position informations of four satellites as figure 4.1. Then the

    receiver can use equations (4.1-4.4) [14] to calculate the position.

    Figure 4.2 GPS Calculation

    In the equation 4.1-4.4, there are four unknown parameters x, y, z, tc. The x, y, z is the

    position of the receiver. The other parmeters are known from the reveivered satellite data.

    There is also one constant value c is the speed of the light. To solve those equations, the

    receiver can get its position value (x, y, z).

  • Location Technology

    - - 30 -

    4.3.4 Galileo

    According to the latest announcement, the schedule of Galileo foresees to bring 30

    satellites into the orbit from 2006 to 2008 and to start the commercial operation of the

    system around 2009. Galileo will be the Europes own global navigation satellite system,

    providing a highly accurate, guaranteed global positioning service under civilian control.

    Figure4.3 Galileo Satellites

    The time plan for the Galileo is: [15]

    The first Satellite launch -2005 (GIOVE-A)

    The second Satellite launches -2007

    4 satellites operational -2008 (EGNOS)

    In-orbit validation -2009

    Full 30-satellite constellation by 2011 (PPP)

    (4.1)

    (4.2)

    (4.3)

    (4.4)

  • Location Technology

    - - 31 -

    4.3.6 BH Design Based on GPS

    After doing some researching about the location technologies, the Bomb Hunter game

    applies for the GPS location technology to locate the position for the game players. By

    making useful of GPS Technology and Google earth Map as the game background, the

    game will become more interesting and funny than the normal traditional game. The

    game environment can be also changed easily and according to what the players want.

    Between the players and the game, there is a game server to store some information,

    related data and control the game environment. After delivering the project report, we

    will continue to do the rest part of this game product until it enters the commercial market.

    Wish this product would attract more players and lead the location game marketing.

  • - 32 -

    Chapter 5

    Define the System Structure and the Transfer Protocol

    Last chapter, we have introduced some location technology. At this moment, we

    reconsider our original project design and make a choice in location technology used in

    project and. We also analyze the information exchanged between the game sever and the

    game client, then define a transfer protocol.

    5.1 Comparison and Choice

    This section, we will discuss and make the decisions in the location technology selection

    and the geographic map selection. Then we define the final system structure.

    5.1.1 How to Get the Location Information

    In chapter 2, we have mentioned that there are a number of ways to get the location

    information, such as GSM cellular network, GPS, WI-FI network and Bluetooth network,

    even with RFID technology (we have introduce in above chapter). Here, we simply make

    a conclusion.

    a) In case the coverage, GPS and GSM network is much large than WI-FI network,

    Bluetooth network.

    b) In case the accuracy, GPS has best performance. But the drawback is the extra

    cost of the GPS receiver. Furthermore, the GPS doesnt work indoor.

    c) The accuracy in the GSM network location technology is varied from hundred

    meters to several hundred meters.

    After investigation, we decided to use GPS instead of GSM which is our original choice.

    There are three reasons:

  • Define the system structure and theTransfer protocol

    - - 33 -

    1) It is difficult to get the GSM base station cell ID and install address list, which

    is a sensitive data for the mobile operator.

    2) In pys60 3rd version, function gsm_location ()4 cant be used, before the

    application verified by Nokia [16].

    3) Review our game idea; there is shooting scenarios in the game design. We think

    that the poor GSM position accuracy will make no sense in such game scenarios.

    So, the GPS location technology is our final choice in location found.

    5.1.2 Choose the Proper Geographic Map

    As location based game, it connects the real world and the virtual environment together.

    So, we want the game background to be reality. We researched some map providers. We

    noticed that there are lots of map providers in the market. The map types include the

    normal map; the navigation used routing map and the satellite map.

    Figure 5.1 a Normal Map and a Satellite Map 5

    Figure 5.1, we copy two different maps from map providers. You may notice that the two

    maps display the same area. Figure 5.1 a) is a normal map; b) is a satellite map. Compare

    4 Pys60 function, used to find GSM cell ID. 5 Map a) is copied from Krak. Map b) is copied from Google map.

    a) Normal map (stenloese) a) Satellite map (stenloese)

  • Define the system structure and theTransfer protocol

    - - 34 -

    those two maps, it is easy to figure out, the figure b) is much more interesting and vivid.

    It matches our game proposal very well. So we choose the satellite map in our project.

    Another choice is to select a map provider. We investigated KRAK, Google and Yahoo.

    KRAK is a Danish company, which provides the map service for the local area. Google

    has a product called Google map, which has global area maps in their map database.

    Yahoo map has the same principle as the Google map. Compare those three companies,

    we choose the Google map. The main reason is that Google map has larger area coverage

    than KRAK. Compare to Yahoo map, Google satellite map has higher resolution (at least

    in Denmark area). The figure 5.2 shows the resolution comparison between Google map

    and Yahoo map. The map position is in latitude 55.76 and longitude 12.20 area. The

    figure 5.2 a) is the highest zoom level Yahoo satellite map in this area. The figure 5.2 b)

    is the highest zoom level Google satellite map in the same area. Google satellite has

    better resolution.

    Note: The red rectangle marked area in map a) is same as the map b)

    Figure 5.2 Yahoo Map and Google Map

    a) Yahoo map in highest zoom level b) Google map in highest zoom level

  • Define the system structure and theTransfer protocol

    - - 35 -

    5.1.3 Modified the System Structure

    After the comparisons, we confirm our system structure as figure 5.3. In this figure, each

    block function is defined as following:

    (1) Game server: prepare the game script file, keep player score and history.

    (2) Google map: geographical map resource.

    (3) Smart-phone: game client application running environment.

    (4) GPS-receiver: get position information from satellite.

    (5) Bluetooth: the information exchange between the smart phone and the GPS

    receiver relay on Bluetooth connection.

    (6) GPRS: it is the manner, the smart access to the game server and Google map

    server.

    Figure 5.3 Modified System Structure

    5.2 The Transfer Protocol

    How to communicate between the game server and the mobile client is important issue.

    In the chapter 2, we havent decided the data format for the data transfer. The choice is

    the XML format or the plain text format. In the further reaserch, we found there are some

    third party XML parsers for Pys60. But, that plug-ins need around 1Mb memory in

    loading. So, we decide to write a parser, which do only a simple parsing job. In this way,

    the memory cost or the CPU process time cost shoudnt too much difference between

    using XML format and using plain text format. Then, we choose to use XML as data

    Game Server (1) Google map (2)

    Smartphone (3) GPS receiver (4)

    Bluetooth (5)

    Exchange information through GPRS (6)

  • Define the system structure and theTransfer protocol

    - - 36 -

    format. XML was designed to describe data and to focus on what data is [17]. It was

    created to structure, store and to send information. This is just what we want.

    This section, we will analyze the required exchange data and define some protocols. In

    the later chapter, the game server and the mobile client application will follow those

    defined protocols. In the system function division, we have mentioned that the game

    areas are based on the district of a city and the game scenarios are prepared in the game

    server. So, the available game area data and the game scenario data should be exchanged.

    Additional, we also mentioned puzzle bomb in the chapter 2. In order to make the

    puzzle changeable, all the puzzles should be retrieved from the game server. So, the

    puzzle data also need to be exchanged. As a normal game, the top score is a common

    feature. We also decide to add this feature in our game as well. No doubt, the top 10 score

    data also need to be exchanged.

    5.2.1 The Area List Data Scheme

    Mobile client ask the game server about available game areas. The game server returns an

    area list. The list scheme [18] is defined in table5.1

    Table 5.1 Area List Scheme

    5.2.2 The Game Scenario Data Scheme

    The mobile client uses the game scenario data to initialize the game field. So, the game

    scenario data should describe all required data. First, let us analyze the scenario data. As

    our design, there are two different type components in the game field (except player)

    the bombs and the watchers. The bomb is a position fixed object in the game. To describe

  • Define the system structure and theTransfer protocol

    - - 37 -

    a bomb, the required data is the geographic position data. The watcher is a moving object

    in the game. Generally, we define a moving track for each watcher. Simply, we set a start

    geographic position and an end geographic position. The watcher will follow the line

    between the two points to move. So, to describe a watcher, the required data are two

    geographic positions. Summarize the analysis; we define the game scenario scheme as

    table5.2.

    Table 5.2 Story File Scheme

    5.2.3 The Puzzle Data Scheme

    In the game, a player must answer some puzzles to remove a puzzle bomb. We design the

    puzzle bomb retrieve a puzzle from the game server, only when a player find or touch it.

    The puzzle data scheme is listed in the table 5.3.

  • Define the system structure and theTransfer protocol

    - - 38 -

    Table 5.3 Story File Scheme

    5.2.4 The Top Ten Score Data Scheme

    When a player want to see the top 10 score players in this game, the mobile client will

    retrieve the top 10 score players data from the game server. The table 5.4 specifies the top

    10 score data file scheme.

    Table 5.4 the Top Ten Score Scheme

    You may notice that, all defined schemes are about the data transferred from the game

    server to the mobile client. This doesnt mean there is no data transferred to the game

    server. In our design idea, we try to let the submitted data as simple as possible to

    simplify the design and save the client job load. So, the most client submitted data will

    just set in HTTP required link.

    About the detail specification, we will introduce in the game server design chapter.

  • - 39 -

    Chapter 6

    Mobile Client Application Design

    In this chapter we will start the mobile game client design. The design will focus on the three

    aspects:

    Design the mobile client structure;

    Construct the client application class structure;

    Google map usage analysis

    6.1 Application Flow

    6.1.1 The Game Scenario Analysis

    In the game scenario design chapter (chapter 2), we have mentioned that there are general three

    type sprites in the game the bomb, the watcher and the hunter. The game combines shootings

    and puzzles together. So, our game field appearance should be:

    The game field view is a top view.

    The background image is the real position satellite map.

    The hunter appearance is a top view of a real person.

    The watcher appearances are the top views of the real persons.

    The bombs displayed as dangerous signs.

    The game field is the camera following mode (the move of the game field follows

    the move of the hunter)

    6.1.2 Flow Design

    When we talk about the game programming based on the above game features, the first thing

    we may think how to manage all the sprites. At least, there are two choices - using the

  • Mobile Client Application Design

    - - 40 -

    multithread or using the game loop [19]. Then we choose to use the game loop, the reason is

    following:

    Simplify the implementation. If we use the multithread, we should take care about the

    thread schedule, the thread synchronization, the dead lock and so on. This will make

    the application more complex.

    All the sprites has the same priorities, the sprites positions and animations are based on

    each time slice, so it is better to use a game loop to drive all the sprites and the

    modules repeated.

    Below, we use a flow chart to show the basic running state of the mobile game client.

    Figure 6.1 Game Running Flows (Mobile Client Part)

    Get hunter position

    Check user keyboard action

    Draw sprites in the screen

    Game Loop

    Game Start

    Calculat other sprites position

    Check and set current status of all sprites

    Download game script

    from game server

    Create sprites and game scenario

  • Mobile Client Application Design

    - - 41 -

    6.2 Game Client Class Structure

    In the last section we construct the game client running structure. It is a dynamic state of the

    game client. In the OOP1, we also need to describe or define the program in a static state. From

    this section, we divide and encapsulate the game functions into classes. Figure 6.2 shows the

    game client class structure diagram.

    Figure 6.2 Game Class Structure

    In Figure 6.2, we use a tree structure diagram to describe the classes and relationships among

    the classes. The class Game Engine is in the root of the structure. This is to express that the

    game engine class drives all the other modules and pushes the whole system to go forward.

    There is an arrow, which points to the class sprite in the structure. This arrow indicates that the

    1 Object Oriented Programming.

    Game Engine (1)

    Class definition ..... ......

    Sprite (5)

    Class definition ..... ......

    AI Control (2)

    Class definition ..... ......

    Location (4)

    Class definition .....

    Hunter (6)

    Class definition .....

    Bomb (7)

    Class definition .....

    Watcher (8)

    Class definition .....

    Communication (3)

    Class definition ..... ......

    Bullet (9)

    Class definition .....

    Explosion (10)

    Class definition ..... ......

  • Mobile Client Application Design

    - - 42 -

    down layer classes are inherited from the sprite class. And we describe the functions below for

    each class.

    1) Game Engine

    Draws the game filed and all sprites

    Detects and handles the player events, which include the game role events and the

    game menu event.

    Collision detection, such as bullets hit the targets, hunters close to the bomb and so

    on.

    Drives all the other modules

    2) AI (Artificial Intelligence) (this module hasnt implemented in the current version)

    Let watchers avoid the bullet from hunters.

    Shoot the hunter, if the hunter is located in the range of one watcher vision.

    3) Communication

    Communicates with the game server to upload or download some game related

    information.

    Parses the data from the transferred XML file.

    4) Location Retrieving

    Searches Bluetooth devices and establish a connection with a GPS device

    Gets GPS positions value from the GPS receiver.

    5) Sprite

    This is a super class of all other sprites

    Define the basic properties of a sprite, such as the position, the image, the speed,

    and so on.

    Define the basic functions of a sprite, for example, how to draw itself, which frame

    should be displayed currently, and etc.

  • Mobile Client Application Design

    - - 43 -

    6) Hunter

    This is the game role of a player.

    It is also an actual handler of the game role events. The game engine catches the

    game role events and passes them here for handling.

    Define the hunter related special properties and functions

    7) Bomb

    A sub class of the sprite.

    Retrieves and prompts a puzzle to players

    Creates the explosion sprite

    8) Watcher

    A sub class of the sprite

    Moves along the specified track.

    Shoot in a random time

    9) Bullet

    A sub class of the sprite

    Moves in a specified speed

    Disappear after a range

    If it hits a target, then the target will disappear.

    10) Explosion

    A sub class of the sprite.

    Plays an explosion sound.

    Displays an explosion animation.

  • Mobile Client Application Design

    - - 44 -

    6.3 Interface design

    This section, we will analyze and design the game client interface. Generally, the screen size of

    a mobile phone is small. So, there are some limitations for setting buttons and menus. Figure

    6.3 shows the user interface flow.

    Figure 6.3 the User Interface Flow Diagram

    Main

    menu

    Login

    Screen

    User

    mode

    selection

    Game

    playing

    screen

    Select start item

    Select register user mode

    Game

    area

    selection

    Start

    Screen

    Press select button

    Login failure

    Select guest

    user mode

    Setting

    Screen

    Help

    Screen

    Top ten

    screen

    Select setting item

    Select help item

    Game

    Pause

    screen

    Set zoom

    level

    screen

    Login sucess

    Select

    an area

    Sub menu

    screen

    Press Select button

    Select

    pause item Select zoom item

    Pess cancel or

    Select button

    Pess cancel or

    Select button

    Select resume

    item

    Exit

    Screen

    Select exit item

    Select top10 item

    Confirm

    exit

    Select main menu item

  • Mobile Client Application Design

    - - 45 -

    6.3.1 Screen Design

    Start Page

    The start page is the first view of the game client. We design an image, which consists of the

    foreground - 3D word Bomb Hunter and the background - some pasted city photos. See

    Figure 6.4.

    Figure6.4 the Start Page

    Main Menu and User Mode Selection Screens

    The menu is used to guide players to enter or exit the game, set game features and get the help

    about the game. We design the game main menu with the following items: Start, Setting, Top

    10, Help and Exit. (Figure 6.5)

    Figure 6.5 Main Menu Screen Figure 6.6 User Mode Selection Screen

    Select Cancel

    Start

    Setting

    Top 10

    Help

    Exit

    select Cancel

    Guest user

    Register user

  • Mobile Client Application Design

    - - 46 -

    When players want to start the game playing, they should select the user mode. There are two

    choices Guest user and Register user. (Figure 6.6)

    Login and Game Area Selection Screen

    If a player is a registered user, he can play the game in the registered user mode. Figure 6.7 is

    the login page for a registered player.

    Figure 6.7 Login Screen Figure 6.8 Game Area Selection Screen

    The game list screen lists the current available game areas. User can select a game area to play

    the game. The screen is shown as Figure 6.8.

    Setting and Top 10 players screens

    In the setting screen, a player can change the game screen mode; turn on or off the sound effect

    and clear the login record to login as a new user. The setting items are listed in the checkbox

    style. A player can change more than one item at one time (Figure 6.9). The top ten players

    screen uses a list to display the top ten players (Figure 6.10).

    OK Cancel

    Please enter your user id:

    *****

    Please enter your pass:

    *****

    select Cancel

    Game Area 1

    Game Area 2

    Game Area 3

    Game Area 4

    Game Area 5

  • Mobile Client Application Design

    - - 47 -

    Figure 6.9 Setting Screen Figure 6.10 Top 10 Player Screen

    Playing filed and sub menu screens

    In the game playing state, there are only two soft buttons in the screen area; the rest area is the

    game play field (Figure 6.11). There are four items in the sub menu (Pause, Zoom map, Setting

    and To main menu).

    Figure 6.11 Game Playing Screen Figure 6.12 Sub Menu Screen

    Login as a new user

    Select Cancel

    Change screen mode

    Turn on/off sound effect

    Select Cancel

    Top 10 score 1. Player name score 2. Player name score 10. Player name score

    Option Exit

    Playing area

    Select Cancel

    Pause

    Zoom map

    Setting

    To main menu

  • Mobile Client Application Design

    - - 48 -

    Pause Menu and Zoom Level Setting Screen

    When the game is paused, the menu items are changed to those items (Resume, Setting and To

    main menu) in Figure 6.13. The zoom level setting is shown as Figure 6.14. A player can

    change the zoom level to overview larger area game field.

    Figure 6.13 Pause Menu Screen Figure 6.14 Zoom Level Setting Screen

    OK Cancel

    Please set your zoom level,

    value should in range (3- 18):

    3

    Select Cancel

    Resume

    Setting

    To main menu

  • Mobile Client Application Design

    - - 49 -

    6.4 The Game Background Map

    The problem is how to map GPS coordinates to an image by using a normal image as GPS map.

    We know the normal image formats are bmp, jpg, gif and so on. Those maps are different from

    GPS map. There is no GIS1 data included in such image data. So, if we want to use such maps

    in our game, we should find the way to map GPS coordinate in a normal map image.

    6.4.1 Map the GPS Coordinate to the Normal Images

    If a map image is in a right scale as the real geographic area, it is possible to use two samples

    points to regulate none GIS images and calculate GPS coordinates for any points in the given

    images.

    Version 1:

    Use GPS receiver to regulate a map image. For instance, take the GPS receiver to find the two

    GPS coordinates in two different points in the map. As Figure 6.15, find the GPS coordinate

    (longitude and latitude) in two yellow points. When we get those two point coordinates, we can

    easily calculate the other points GPS coordinates using the formula (1) and (2).

    xxx

    LonLonxLon

    =

    12

    12)( (1)

    yyy

    LatLatyLat

    =

    12

    12)( (2)

    In those two formulas, all the parameters are referenced to the marks in the Figure 6.15.

    1 Geographic Information Systems

  • Mobile Client Application Design

    - - 50 -

    Figure6.15 Regulate the Map

    Version 2:

    In further research, we found that it is possible to ignore the regulation process in the version

    one. Google map is latitude and longitude related map. By calculations, we can figure out the

    four corners latitude and longitude values of each piece of map (as Figure 6.16). Using the

    same manner and formulas described in the version one, it is easy to find out the coordinate

    values inside the map.

    Lat1

    Lat2

    Lon 1 Lon 2

    Map width: X

    Map h

    eight: Y

    x1

    y1

    y2

    x2

  • Mobile Client Application Design

    - - 51 -

    Figure6.16 Google Earth Map Coordinate

    6.4.2 Google Map

    Google map is a powerful tool. There is a huge earth image database in Google map server. If

    we can make use it in our game, it can make the game funnier and also save a lot of work for

    us. After research, we found some hints about Google map address and retrieve methods. Here

    we must say that this method is just used for research purpose. It isnt a licensed way to access

    Google map database.

    Google Satellite Map

    Google satellite map images are stored in the map database. Each piece of map is referenced

    by q, r,t ands sequence. Each character represents one part of image. At the same time,

    the sequence length decides zoom level of earth map. The maximum zoom level is 18. For

    instance, a single character t" represents whole image of the earth, zoom level is one. The web

    address of map is in the format http://kh.google.com/kh?n=404&v=15&t=.

    Latitude 1

    Latitude 2

    Longitude 1 Longitude 2

  • Mobile Client Application Design

    - - 52 -

    Figure6.17 Earth Satellite Map

    For instance, Figure 6.17 is a whole image of the earth. It can be retrieved by the web address

    http://kh.google.com/kh?n=404&v=15&t=t. Here, there is a sequence t, which is length one. It

    indicates the map is zoom level one. When we add q, r, s and t at the end of first t, we get

    below four image maps.

    (a) tq

    (b) tr

    (c) tt

    (d) ts

    a. http://kh.google.com/kh?n=404&v=15&t=tq b. http://kh.google.com/kh?n=404&v=15&t=tr c. http://kh.google.com/kh?n=404&v=15&t=tt d. http://kh.google.com/kh?n=404&v=15&t=ts

    Figure6.18 Google Earth Satellite Map

  • Mobile Client Application Design

    - - 53 -

    Further, we figure out the Google satellite map database is four fork tree structures. The

    structure can be presented as Figure 6.19. In the zoom level one, the earth is one map, which is

    represented by a single t. In the zoom level two, the earth map is divided into four pieces,

    which are represented by tq, tr, ts, and tt. The process go deeper, the earth are divided into

    more same size pieces. In the highest zoom levels, each piece of image only cover 170m *170

    m square area1 in the earth. In theoretical, we can map any point on the earth (a cross point of

    latitude line and longitude line) into a q, r, s and t sequence.

    Figure6.19 Google Satellite Map Structure

    Test and Problem Found

    Base on the last section analysis, we do a further testing. Table 6.1 is the pseudo structure,

    which converts the given latitude and longitude value pair to a Google map sequence address.

    We want to test whether the referenced map contains the given coordinate. Following the

    pseudo code, we also make a test module in python to test this mechanism. When we tried to

    find a predefined position (55.76443N, 12.19593E)2, we always get a wrong image map. After

    several days research, we found that the reason is about the latitude scale. In the Google map

    database, all the maps are Mercator projection [20] images of the earth. It means that the

    latitude line project in y direction isnt distributed as degree.

    1 This value is an approximately value, which calculated by ourselves. 2 The position around the Birkevej 47, Stenloese, Copenhagen

    q

    r

    t

    s

    t

    q

    t

    r

    s Map reference string is

    trs

  • Mobile Client Application Design

    - - 54 -

    Function conversion If latitude value >= center latitude value of the current map Then If longitude value >= center longitude value of the current map Then Sequence append with r Else sequence append with q Else If longitude value >= center longitude value of the current map Then Sequence append with t Else sequence append with s If reach required zoom level then Return Sequence Else Set new center latitude value Set new center longitude value Call conversion function (recursive call)

    Table 6.1 Pseudo Code for Converting Latitude and Longitude

    Pair Value to a RTSQ Sequence

    In order to calibrate the algorithm above, we look at Mercator projection first.

    Mercator projection

    Figure 6.20 is a Mercator projection map of the earth. In the Mercator projection equation, we

    get relations between latitude degree and y value as formula (3) and (4). From the equations,

    we can deduce that the same latitude span cover more earth area when the position more close

    to the two poles.

    Y = (3)

    = = (4)

  • Mobile Client Application Design

    - - 55 -

    Figure6.20 Mercator projection of World Map 1

    Method Refine and Test

    Refine the pseudo code in the table 6.1 by adding Mercator projection equation. Then we use

    the test python module to calculate the Google reference sequence for the predefined position

    (55.76443N, 12.19593E)2, we get the expected result as Figure 6.21.

    Figure 6.21 My Home Position Google Map

    1 Refer to http://janson1986.photo.hexun.com/6381153_d.html 2 The position around the Birkevej 47, Stenloese, Copenhagen

    The python module returned sequence is

    Trtqtrqqqrqrqrrttt

    Use this sequence, we retrieve left image

    successful.

  • - 56 -

    Chapter 7

    Mobile Client Implementation

    In the chapter 6, we have design the mobile game client structure, the interface prototype, and

    Google map access method. This chapter, we will explain the detail implementation process.

    The implementation includes the class module specifications, the relationships among the

    modules, the game components, the interfaces and some complement modules.

    7.1 Modules and Relationships

    Chapter 6, we have specified the functions for each class module. Here, we define each module

    properties and functions in detail. At the end of this section, we explain the relationships

    among the different modules.

    7.1.1 Modules Implementations 1) GPS Module

    GPS module is used to build the Bluetooth connection with the GPS receiver and retrieve the

    position information.

    UML Function description

    Con_BT_reader: discover Bluetooth devices and build a

    connection with a specified device.

    Close Connection: close Bluetooth connection.

    LocatePosition: read and parse the location data from GPS

    sentence.

  • Mobile Client Implementation

    - - 57 -

    2) Google Map Module

    The task of Google map module is to calculate Google map path for a given latitude/longitude

    coordinate. It returns a stitched map, which contains the given coordinate, and the relative

    position of the given coordinate in the returned map.

    UML Function description

    rad2degree: convert radian to degree

    degree2rad: convert degree to radian

    y2lat: convert y value to latitude value

    lat2y:convert latitude to latitude value

    latlon2googleSat: given latitude and longitude value,

    return a path to Google map.

    encodes: encode 0,1 sequence to q,r,s, and t sequence

    string

    verify: find whether it is necessary to the stitch map

    stitchMap: stitch four pieces of maps together and

    return the stitched map and the relative position value.

    3) Sprite Module

    Sprite module is a base class of the bomb, the watcher, the hunter, the bullet, and the explosion.

    As a base class, it defines the common properties of all the sprites, such as the sprite position,

    the image, the total frame numbers, the current frame, the moving speed and the visibility.

    UML Function description

    draw self: draw an image in a specified canvas. erase self: erase itself from canvas action: specify sprite action, may override in subclass. move: move sprite to next position, which is

  • Mobile Client Implementation

    - - 58 -

    determined by sprite current position and speed setframe: if there are more than one frame for a sprite, use this function to set current displayed frame. nextframe: set next displayed frame. getframe: get the frame number of the current displayed frame isOutofScreen: check whether this sprite is running out of the screen. setVisible: pass True or False value to this sprite to make the sprite appear or disappear. isVisible: check whether this sprite is visible. setSpeed: set the motion vector for this sprite. changeImag: change this sprite image. rotateSprite: rotate this sprite image

    4) Hunter Module

    Hunter is as players role in the game. As a subclass of the sprite, it inherits all methods and

    properties from the sprite class. Further, it also handles the most player key pressed events.

    UML Function description

    getName: get the player name.

    getScore: return the player current score.

    action: decide the hunter action

    commandExcute:handle the player key

    pressed event.

    addScore: increase the player score

    reduceScore: decrease the player score

  • Mobile Client Implementation

    - - 59 -

    shoot: create a bullet sprite, when the

    player fire.

    5) Watcher Module

    Watcher is a virtual enemy sprite, which take care of the bomb. It moves along the specified

    track and fires in a random time.

    UML Function description

    action: specify a watcher action

    move: move watcher to the next

    position

    fire: fire a bullet to a target

    6) Bomb

    The bomb is also a subclass of the sprite. It is an object, which players want to find and

    eliminate. Every bomb has its property: a puzzle. Players must answer the puzzle to remove a

    bomb.

    UML Function descrip