royal institute of technology (kth) id 2216 – developing mobile applications by sun gang a p2p...

19
Royal Institute of Technology (KTH) Royal Institute of Technology (KTH) ID 2216 – Developing Mobile Applications ID 2216 – Developing Mobile Applications By Sun Gang By Sun Gang A P2P Bluetooth Game based on A P2P Bluetooth Game based on J2ME: J2ME: WordWar WordWar Sun Gang Sun Gang Zhang Gang Zhang Gang Wu Xiao Wu Xiao 11th March 2008 11th March 2008

Post on 21-Dec-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Royal Institute of Technology (KTH) ID 2216 – Developing Mobile Applications By Sun Gang A P2P Bluetooth Game based on J2ME: WordWar Sun Gang Zhang Gang

Royal Institute of Technology (KTH)Royal Institute of Technology (KTH)

ID 2216 – Developing Mobile ApplicationsID 2216 – Developing Mobile Applications By Sun GangBy Sun Gang

A P2P Bluetooth Game based on A P2P Bluetooth Game based on J2ME:J2ME:WordWarWordWar

Sun GangSun GangZhang GangZhang Gang

Wu XiaoWu Xiao

11th March 200811th March 2008

Page 2: Royal Institute of Technology (KTH) ID 2216 – Developing Mobile Applications By Sun Gang A P2P Bluetooth Game based on J2ME: WordWar Sun Gang Zhang Gang

Slide 2

By Sun GangBy Sun Gang

Royal Institute of Technology (KTH)Royal Institute of Technology (KTH)

ID 2216 – Developing Mobile ApplicationsID 2216 – Developing Mobile Applications

Outline

Project IntroductionGame Functionality Description using Flash DemoGame Design DescriptionGame Website Design Description References

Page 3: Royal Institute of Technology (KTH) ID 2216 – Developing Mobile Applications By Sun Gang A P2P Bluetooth Game based on J2ME: WordWar Sun Gang Zhang Gang

Slide 3

By Sun GangBy Sun Gang

Royal Institute of Technology (KTH)Royal Institute of Technology (KTH)

ID 2216 – Developing Mobile ApplicationsID 2216 – Developing Mobile Applications

Project Description

Our project is to develop a peer-to-peer word guessing game with J2ME that similar to "Hangman". Enjoy :) .The name of the game is “WordWar”.WordWar is run via Bluetooth. There are 2 players in a game, and their roles are equal. Player A chooses a word from a dictionary, and Player B tries to guess the word by suggesting letters (one letter at a time) or a whole word. The word to guess is represented by a row of dashes, giving the number of letters. If Player B suggests a letter which occurs in the word, the letter will appear in all its positions in the word; otherwise he/she loses a chance. The total chances for Player B is twice as many as the letters in the word. Player A also tries to guess the word chosen by Player B with the same condition. The game is over when: One player completes the word, or guesses the whole word correctly (He/She wins). One player fails too many times (The other player wins).

Page 4: Royal Institute of Technology (KTH) ID 2216 – Developing Mobile Applications By Sun Gang A P2P Bluetooth Game based on J2ME: WordWar Sun Gang Zhang Gang

Slide 4

By Sun GangBy Sun Gang

Royal Institute of Technology (KTH)Royal Institute of Technology (KTH)

ID 2216 – Developing Mobile ApplicationsID 2216 – Developing Mobile Applications

Project Description (2)

A B “door” _ _ _ _ 8 “door” _ o o _ 8 “o” “door” _ o o _ 7 “c” “door” d o o _ 7 “d” “door” d o o r 7 “r”

Win! But d o o _ 0 “z”

Lose

Page 5: Royal Institute of Technology (KTH) ID 2216 – Developing Mobile Applications By Sun Gang A P2P Bluetooth Game based on J2ME: WordWar Sun Gang Zhang Gang

Slide 5

By Sun GangBy Sun Gang

Royal Institute of Technology (KTH)Royal Institute of Technology (KTH)

ID 2216 – Developing Mobile ApplicationsID 2216 – Developing Mobile Applications

Project Description (3)

We have done the following four extra tasks: “The mobile application has to be enabled for download from

your project-web-site, ie OTA. “ “The application has to run seamlessly on a variety of

devices. ““Your project-web-site uses WURFL for content-adaption.” “You describe your mobile application/service with a FlashLite manual or a Flash Lite demo.”We have tested the Game successfully in the following of device:Nokia N93Nokia N95T-Mobile SDASony Ericsson W900iSony Ericsson Z750i You can download our game in the following link:http://people.dsv.su.se/~xiaowu/ProjectWebsite/Links.phpYou can visit our project via our project website:http://people.dsv.su.se/~xiaowu/ProjectWebsite/Index.php

Page 6: Royal Institute of Technology (KTH) ID 2216 – Developing Mobile Applications By Sun Gang A P2P Bluetooth Game based on J2ME: WordWar Sun Gang Zhang Gang

Slide 6

By Sun GangBy Sun Gang

Royal Institute of Technology (KTH)Royal Institute of Technology (KTH)

ID 2216 – Developing Mobile ApplicationsID 2216 – Developing Mobile Applications

Project Description (4)

Nokia N95

Page 7: Royal Institute of Technology (KTH) ID 2216 – Developing Mobile Applications By Sun Gang A P2P Bluetooth Game based on J2ME: WordWar Sun Gang Zhang Gang

Slide 7

By Sun GangBy Sun Gang

Royal Institute of Technology (KTH)Royal Institute of Technology (KTH)

ID 2216 – Developing Mobile ApplicationsID 2216 – Developing Mobile Applications

Project Description (5)

Nokia N95

Page 8: Royal Institute of Technology (KTH) ID 2216 – Developing Mobile Applications By Sun Gang A P2P Bluetooth Game based on J2ME: WordWar Sun Gang Zhang Gang

Slide 8

By Sun GangBy Sun Gang

Royal Institute of Technology (KTH)Royal Institute of Technology (KTH)

ID 2216 – Developing Mobile ApplicationsID 2216 – Developing Mobile Applications

Project Description (6)

Sony Ericsson Z750i

Page 9: Royal Institute of Technology (KTH) ID 2216 – Developing Mobile Applications By Sun Gang A P2P Bluetooth Game based on J2ME: WordWar Sun Gang Zhang Gang

Slide 9

By Sun GangBy Sun Gang

Royal Institute of Technology (KTH)Royal Institute of Technology (KTH)

ID 2216 – Developing Mobile ApplicationsID 2216 – Developing Mobile Applications

Project Description (7)

Sony Ericsson Z750i

Page 10: Royal Institute of Technology (KTH) ID 2216 – Developing Mobile Applications By Sun Gang A P2P Bluetooth Game based on J2ME: WordWar Sun Gang Zhang Gang

Slide 10

By Sun GangBy Sun Gang

Royal Institute of Technology (KTH)Royal Institute of Technology (KTH)

ID 2216 – Developing Mobile ApplicationsID 2216 – Developing Mobile Applications

Game Functionality Description using Flash Demo

We have used Adobe Flash to create a Flash Demo for our game.It is based Flash Lite 2.0 and Action Script 2.0.You can watch the demo via the following link:

http://people.dsv.su.se/~xiaowu/ProjectWebsite/Demo.phpNow Let my group members use the Flash Demo to demonstrate our game!

Page 11: Royal Institute of Technology (KTH) ID 2216 – Developing Mobile Applications By Sun Gang A P2P Bluetooth Game based on J2ME: WordWar Sun Gang Zhang Gang

Slide 11

By Sun GangBy Sun Gang

Royal Institute of Technology (KTH)Royal Institute of Technology (KTH)

ID 2216 – Developing Mobile ApplicationsID 2216 – Developing Mobile Applications

Game Design Description

Page 12: Royal Institute of Technology (KTH) ID 2216 – Developing Mobile Applications By Sun Gang A P2P Bluetooth Game based on J2ME: WordWar Sun Gang Zhang Gang

Slide 12

By Sun GangBy Sun Gang

Royal Institute of Technology (KTH)Royal Institute of Technology (KTH)

ID 2216 – Developing Mobile ApplicationsID 2216 – Developing Mobile Applications

Game Design Description (2)

WordWar consists of 5 Java classes: BTClient, BTServer, GameStatus, GameCommunicator and WordWarGUI. BTClient and BTServer are responsible for bluetooth discovery and connection setup. Generally, peer-to-peer bluetooth communication will require one mobile phone act as server and the other as client; but we decide to make WordWar "purelly peer-to-peer": each WordWar application will start both Client and Server session, it not only tries to discover other players but also makes itself discoverable. Therefore, if several mobile users want to play WordWar, they don't need to negotiate or let someone start WordWar server volunteerly, they can simply run WordWar and search all players nearby. This design makes WordWar much more convenient to play.

Page 13: Royal Institute of Technology (KTH) ID 2216 – Developing Mobile Applications By Sun Gang A P2P Bluetooth Game based on J2ME: WordWar Sun Gang Zhang Gang

Slide 13

By Sun GangBy Sun Gang

Royal Institute of Technology (KTH)Royal Institute of Technology (KTH)

ID 2216 – Developing Mobile ApplicationsID 2216 – Developing Mobile Applications

Game Design Description (3)

GameStatus is a helper class used to record players' game status. GameCommunicator is used for peer-to-peer communication and game logic handling. Several protocl messages (START_MESSAGE, QUIT_MESSAGE, WIN_MESSAGE, etc) are defined to control game progress. At the beginning of each round of the game, each player will select a challenge word for his/her opponent, this word will be checked against the dictionary file included in WordWar.jar, and make sure it is not a randomly makeup. The opponent will receive the challenge word as a row of dashes, for example: if Player A choose the word "mobile", then it will appear as "------" to Player B. Some words are rather complex while some others may be easy to guess, to make the game fair and more fun, we decide that each player will allow twice as many guesses as the letters in the word. In the example above, Player B will have 12 chances to complete the word. The first player finishes his/her challenge word wins, and the first player used all his/her chances loses. At the end of each round, players can choose whether to continue play next round or quit.

Page 14: Royal Institute of Technology (KTH) ID 2216 – Developing Mobile Applications By Sun Gang A P2P Bluetooth Game based on J2ME: WordWar Sun Gang Zhang Gang

Slide 14

By Sun GangBy Sun Gang

Royal Institute of Technology (KTH)Royal Institute of Technology (KTH)

ID 2216 – Developing Mobile ApplicationsID 2216 – Developing Mobile Applications

Game Design Description (4)

WordWarGUI is the main class that controls the GUI and game progress, it is also responsible to handle all the failures and exceptions. Because all the communication classes (GameCommunicator, BTClient and BTServer) run in separate threads, WordWarGUI will not block during transmission, it always responds to user immediately. In each bluetooth neighbor discovery, WordWarGUI will start a timer for 25 seconds, and display a progress bar to inform the searching progress. If no neighbors are found within the timeout, WordWarGUI will cancel the searching thread automatically, avoide making user impatient. Users are allowed to configure their player names, which will be seen by other players in the game and neighbor discovery. WordWarGUI will inform the status (challenge word, remaining guesses) of player and his/her opponent during the game, and total score at the end of the game.

Page 15: Royal Institute of Technology (KTH) ID 2216 – Developing Mobile Applications By Sun Gang A P2P Bluetooth Game based on J2ME: WordWar Sun Gang Zhang Gang

Slide 15

By Sun GangBy Sun Gang

Royal Institute of Technology (KTH)Royal Institute of Technology (KTH)

ID 2216 – Developing Mobile ApplicationsID 2216 – Developing Mobile Applications

Design Web Site Design Description

Aim: content-adaption WURFL WURFL PHP Library wurfl_parser.php wurfl_class.php wurfl_config.php GetDeviceCapabilitiesFromAgent($_SERVER["HTT

P_USER_AGENT"])getDeviceCapability('is_wireless_device'))getDeviceCapability('resolution_height')getDeviceCapability('resolution_width')

Web-site with WURFL

Page 16: Royal Institute of Technology (KTH) ID 2216 – Developing Mobile Applications By Sun Gang A P2P Bluetooth Game based on J2ME: WordWar Sun Gang Zhang Gang

Slide 16

By Sun GangBy Sun Gang

Royal Institute of Technology (KTH)Royal Institute of Technology (KTH)

ID 2216 – Developing Mobile ApplicationsID 2216 – Developing Mobile Applications

Design Web Site Design Description (2)

Page 17: Royal Institute of Technology (KTH) ID 2216 – Developing Mobile Applications By Sun Gang A P2P Bluetooth Game based on J2ME: WordWar Sun Gang Zhang Gang

Slide 17

By Sun GangBy Sun Gang

Royal Institute of Technology (KTH)Royal Institute of Technology (KTH)

ID 2216 – Developing Mobile ApplicationsID 2216 – Developing Mobile Applications

References

Tera-WURFL Libraryhttp://wurfl.sourceforge.net/utilities/terawurfl.php, Last Visited – March 2008PHP http://www.php.net/ ,Last Visited – March 2008Hangmanhttp://en.wikipedia.org/wiki/Hangman_(game), last visted – March 2008

Page 18: Royal Institute of Technology (KTH) ID 2216 – Developing Mobile Applications By Sun Gang A P2P Bluetooth Game based on J2ME: WordWar Sun Gang Zhang Gang

Royal Institute of Technology (KTH)Royal Institute of Technology (KTH)

ID 2216 – Developing Mobile ApplicationsID 2216 – Developing Mobile Applications By Sun GangBy Sun Gang

Questions ???

Page 19: Royal Institute of Technology (KTH) ID 2216 – Developing Mobile Applications By Sun Gang A P2P Bluetooth Game based on J2ME: WordWar Sun Gang Zhang Gang

Royal Institute of Technology (KTH)Royal Institute of Technology (KTH)

ID 2216 – Developing Mobile ApplicationsID 2216 – Developing Mobile Applications By Sun GangBy Sun Gang

Thank You