BattleShip
.
Summary
An ECE 4180 final project that implements multiplayer battleship on the mbed connected to a computer through a serial port that is then connected to a server. Created by:
Brandon Donohue
Soham Gadgil
Alex Le
Eric Yan
Quick Video:
Long Demonstration:
Users can battle with other users in 1 vs 1 battleship using their mbeds. Battleship is a guessing game for two players. Players alternate turns calling "shots" at the other player's ships, and the objective of the game is to destroy the opposing player's fleet. The first to get 17 hits on the enemy fleet is the victor.
Supplies
1. mbed (x2) 2. Adafruit Bluefruit LE UART Friend (bluetooth) (x2) 3. uLCD-144-G2 (LCD screen) (x2) 4. Raspberry Pi 3 with appropriate cables 5. Computer for forwarding data (x2) 6. Phones to connect to Bluetooth
mbed Pinout
mbed
The mbed is first connected to the computer and the phone. A computer is used to connect the player to other players on the network and the a blue module allows the player to give commands to the mbed. The mbed displays the game on the LCD screen and controls the game state.
Game Logic State Diagram
Block Diagram
Server
The Raspberry Pi acts as a hub/sever for players to get connected to each other and passes packets to their appropriate destination with TCP connections. A 4 char packet is sent from the clients through the server to determine the Cartesian coordinate, hit, and game state. The server also determines which player goes first.
Extra Features
- The server can handle multiple games at once because the server creates a new thread to handle each individual game.
- We also made a simpler pc version of the game that prints to command line and battle ships are place by changing the matrix in the file.
- Pc players and mbeds players can be connected to a game together.
Code
Import programIoTBattleship
Battleship using serial connections and wifi.
- This is the github repository to the server code: https://github.com/lealex262/IoTBattleShip
Please log in to post comments.