Presentation is loading. Please wait.

Presentation is loading. Please wait.

Spong Bluetooth game Developed by: Erik Matzols Fredrik Lindberg.

Similar presentations


Presentation on theme: "Spong Bluetooth game Developed by: Erik Matzols Fredrik Lindberg."— Presentation transcript:

1 Spong Bluetooth game Developed by: Erik Matzols Fredrik Lindberg

2 Spong game Uses the J-82 API for bluetooth communication Uses J4ME library to eliminate some annoyances with the J2ME UI. Each player controls a paddle and need to prevent the ball from falling from the playing field The winner is the one who has managed to score most points. The point limit is decided by the one who host the game

3 Supported Devices Need MIDP-2.0 and CLDC-1.1 Screen resolution of 240x320. Game will run fine on other resolutions that support the other criterias but size of graphics content will affect gameplay.

4 J4ME Able to set a theme for the entire application. Have some basic ”form” capability and able to have custom backgrounds. Only uses a small fraction of the library for automatic button placement and automatic scrolling of text on the instruction page. Check it out on http://code.google.com/p/j4me/ http://code.google.com/p/j4me/

5 Spong game: Main menu The main menu has four selections. New game - will bring you to a new page for selection of hosting or joining a game. Options – Set your nickname,servername and the points limit when you act as server. Instruction – show a text with instruction how to play the game. Quit – Obvious.

6 Spong game: Instructions Scrollbar to the left if text is larger than the screen height. Back button to return to main menu

7 Spong game: Options Data is stored in a permanent record store Nickname is sent when establishing connection

8 Spong game: Host/Join

9 Spong Game: Selecting server Multiple servers to select from if multiple hosts exist

10 Spong Game: Game session Client commands are sent to server and processed Server sends new state to client that the client renders

11 The Code The game consists of 17 classes Spong, SpongModel, Menu, BluetoothClient, BluetoothServer, GameSession,Paddle, Ball.....

12 Spong,SpongModel Spong - A public class extends MIDlet. Spong creates an instance of the class SpongModel when the method startApp() is called. SpongModel - A public class that contains the BluetoothClient,BluetoothServer Menu and GameSession instances. Its responsibility is to contain and communicate with the various objects such as the Menu, Bluetoothserver, BluetoothClient and the GameSession.

13 Menu Menu – A public class that extends Dialog which is a J4ME class that implements some simple ”form” functionality. The Menu consists of several classes that implements the submenus. The buttons are a custom item that can change its color if it is selected. A variable in each menu keeps track of the current selected button.

14 BluetoothServer,BluetoothClient BluetoothServer – A public class that implements Runnable. It will wait in a blocking thread until a connection has been accepted or the user presses the cancel button which will call the stop() method for the BluetoothServer thread. BluetoothClient – A public class that implements DiscoveryListener and Runnable. Implements the DiscoveryListener interface to be able to query other Bluetoothdevices and return a list of connectable devices to the user. The user can at any time press the canel button and terminate the search. Both BluetoothClient and BluetoothServer communicates with the SpongModel via callbacks.

15 GameSession Implements Runnable and Canvas. Created after a connection has been made. Creates paddle and ball and draws all game graphics. Determines who act as server based on a variable sent to constructor. Reads keypresses into a keyState. Server has authority and simulates the ball and does collision detection. Client send its input to the server which in turn send a new state for the paddles and balls to the client so it can render the new state.

16 Paddle, Ball Paddle – Represents the paddle the user controls. Is a serializable object that can be sent over the bluetooth connection Ball – Represents the ball. Is a serializable object that can be sent over the bluetooth connection.

17 The homepage Adapts to different screen sizes. OTA support for the game Spong. Uses WURFL to check if device is capable of running the game. A Flash Lite demo of the game Check it out http://www.nada.kth.se/~matzols/ http://www.nada.kth.se/~matzols/

18 The End


Download ppt "Spong Bluetooth game Developed by: Erik Matzols Fredrik Lindberg."

Similar presentations


Ads by Google