DUAL Multiplayer Game

A multiplayer game using CC3200 microcontrollers, OLED displays, and AWS integration.

Project Description

This project is a multiplayer game inspired by the mobile game DUAL. It utilizes two CC3200 microcontrollers, each connected to an OLED display, allowing two players to battle in real-time. The game uses UART for inter-device communication, an accelerometer for motion-based controls, and AWS IoT for tracking scores.

Video Demonstration

System Architecture

Game States

How to Run

  1. Connect both boards and all components according to the following schematic:
  2. Circuit Schematic
  3. Run the provided Flask server and host the site using an ngrok tunnel.
  4. Ensure AWS IoT is correctly set up for cloud-based score updates.
  5. Connect AWS IoT to AWS Lambda and configure it with the following function:
  6. import sys
    import json
    import requests
    sys.path.append('/opt/python')
    
    def lambda_handler(event, context):
        if "message" not in event:
            return {
                "statusCode": 400,
                "body": json.dumps("Error: No 'message' key found in event.")
            }
    
        msg = event["message"]
        payload = {"iotMessage": msg}
    
        flask_url =  "(insert ngrok url here)"
    
        try:
            response = requests.post(flask_url, json=payload)
            return {
                "statusCode": response.status_code,
                "body": response.text
            }
        except Exception as e:
            return {
                "statusCode": 500,
                "body": json.dumps("Internal Server Error")
            }
                    
  7. Flash the CC3200 microcontrollers with your AWS keys and the following firmware.
  8. Open the Python terminal intialized from server.py for the score display.
  9. Connect both boards to power and start their programs.

How to Play

  1. Use an IR Remote to enter usernames on both boards prior to the game.
  2. Tilt the board to move the ship around the screen.
  3. Click or hold the SW3 button on the board to shoot projectiles. Holding the button shoots bigger projectiles.
  4. An ammo count is displayed on the sides of the ship. Running out of ammo limits new projectiles from being shot or charging projectiles to get any bigger. Wait for a cooldown for ammo to recharge.
  5. Target your projectiles at your opponent's ship. The round is over when someone is hit.
  6. Play rounds until someone reaches the winning score of 5.
  7. At the end screen, select either the restart or home button on both boards using the right/left buttons on the remote. Press OK to confirm.