project 2 mobile game: hexagon zhong zou, joseph ferrara ee194 wir

9
Project 2 Project 2 Mobile Game: Mobile Game: Hexagon Hexagon Zhong Zou, Joseph Ferrara Zhong Zou, Joseph Ferrara EE194 WIR EE194 WIR

Upload: sarah-rogers

Post on 13-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Project 2 Mobile Game: Hexagon Zhong Zou, Joseph Ferrara EE194 WIR

Project 2Project 2Mobile Game: HexagonMobile Game: Hexagon

Zhong Zou, Joseph Ferrara Zhong Zou, Joseph Ferrara

EE194 WIREE194 WIR

Page 2: Project 2 Mobile Game: Hexagon Zhong Zou, Joseph Ferrara EE194 WIR

HexagonHexagonHexagon is a popular animated Hexagon is a popular animated

strategy board game.strategy board game.Rules for Hexagon:Rules for Hexagon: Two types of moves: a jump or Two types of moves: a jump or

double jump, indicated when double jump, indicated when player’s piece is selected.player’s piece is selected.

Entering into a hexagon occupied Entering into a hexagon occupied by an opponent’s piece will by an opponent’s piece will transform them into yours.transform them into yours.

To take over the world, the player To take over the world, the player who occupied more cells wins.who occupied more cells wins.

Page 3: Project 2 Mobile Game: Hexagon Zhong Zou, Joseph Ferrara EE194 WIR

Communication SchemeCommunication Scheme

Two games talk to each other over Two games talk to each other over the TCP sockets.the TCP sockets.

At start up, the game will act as a At start up, the game will act as a client and search for a server to client and search for a server to connect to.connect to.

After 2 Seconds, if no server is found, After 2 Seconds, if no server is found, client connection times out. The client connection times out. The game switches to server mode and game switches to server mode and waits for an incoming connection.waits for an incoming connection.

After the connection is established, After the connection is established, the server will have the option to pick the server will have the option to pick a color to play, the client will play the a color to play, the client will play the opposite color.opposite color.

Page 4: Project 2 Mobile Game: Hexagon Zhong Zou, Joseph Ferrara EE194 WIR

Three Types of CommandsThree Types of Commands

After the server picks a color to play, it will send a After the server picks a color to play, it will send a command with the message, “PLAYERcommand with the message, “PLAYER color color”, ”, so client can be setup to play opposite color.so client can be setup to play opposite color.

During game playing, when a player presses a During game playing, when a player presses a key, it will send out a command with message key, it will send out a command with message “KEYCODE “KEYCODE numnum”, where ”, where numnum represented represented integer value of key pressed.integer value of key pressed.

After two players finish a round, any player can After two players finish a round, any player can press restart command, it sends out “RESTART” press restart command, it sends out “RESTART” message to reset game board to initial state for message to reset game board to initial state for both players.both players.

Page 5: Project 2 Mobile Game: Hexagon Zhong Zou, Joseph Ferrara EE194 WIR

Other Features:Other Features: At the bottom of the screen, At the bottom of the screen,

game displayed how many cells game displayed how many cells are occupied by each player and are occupied by each player and whose turn is it now.whose turn is it now.

After the game board is all filled After the game board is all filled up, the player with more cells will up, the player with more cells will win.win.

The game also gives the player The game also gives the player an option to play music during an option to play music during game playing.game playing.

After one player exits the After one player exits the application, other player switches application, other player switches back to client mode to search for back to client mode to search for connection.connection.

Page 6: Project 2 Mobile Game: Hexagon Zhong Zou, Joseph Ferrara EE194 WIR

Project 3Project 3Sensor NetworkSensor Network

Zhong Zou, Joseph Ferrara Zhong Zou, Joseph Ferrara

EE194 WIREE194 WIR

Page 7: Project 2 Mobile Game: Hexagon Zhong Zou, Joseph Ferrara EE194 WIR

Network SetupNetwork Setup

Two types of motes:Two types of motes: Base Mote: Base Mote:

Connect to PC directly, Connect to PC directly, acts as gateway acts as gateway between PC and sensor between PC and sensor network.network.

Sensor Mote: Sensor Mote: Motes equipped with Motes equipped with sensor board, connect to sensor board, connect to each other and base each other and base mote via Radio mote via Radio Frequency.Frequency.

RadioInput/Output

Main Controller

Temperature Sensor

LED

Buzzer

Antenna

BLOCK DIAGRAMFor Sensor Mote

Page 8: Project 2 Mobile Game: Hexagon Zhong Zou, Joseph Ferrara EE194 WIR

Routing SchemeRouting Scheme The base mote initiates the route discovery The base mote initiates the route discovery

algorithm by broadcasting out “Route Setup” algorithm by broadcasting out “Route Setup” message.message.

A sensor mote after receiving first “Route Setup” A sensor mote after receiving first “Route Setup” message, it sets the sender of that message as message, it sets the sender of that message as its parent, and broadcasts out “Route Setup”.its parent, and broadcasts out “Route Setup”.

After “Route Setup” message flooded through After “Route Setup” message flooded through the network, each sensor mote can be able to the network, each sensor mote can be able to send its measured value to the base mote by send its measured value to the base mote by first transmitting it to its parent. Its parent in turn first transmitting it to its parent. Its parent in turn will forward data to parent of its own and data will forward data to parent of its own and data will eventually reach the base mote and be will eventually reach the base mote and be displayed on PC.displayed on PC.

Page 9: Project 2 Mobile Game: Hexagon Zhong Zou, Joseph Ferrara EE194 WIR

Sensor MotesSensor Motes Each sensor mote will sample current Each sensor mote will sample current

temperature of its surrounding environment every temperature of its surrounding environment every second.second.

If the temperature is below 35If the temperature is below 35°C, sensor mote will °C, sensor mote will blink its green led once every 2 seconds.blink its green led once every 2 seconds.

If the temperature is above 35 but below 40°C, If the temperature is above 35 but below 40°C, sensor mote will blink its yellow led once every sensor mote will blink its yellow led once every second, and sends out a warning message to second, and sends out a warning message to base mote.base mote.

If the temperature is above 40°C, sensor mote will If the temperature is above 40°C, sensor mote will blink its red led once every half second and turn blink its red led once every half second and turn on its buzzer. It also broadcasts out a critical on its buzzer. It also broadcasts out a critical warning message to all of its neighbor sensor warning message to all of its neighbor sensor motes, so all of them will turn on their buzzers.motes, so all of them will turn on their buzzers.