VR Multiplayer Golf Game

Welcome to our VR multiplayer golf game project!

Intro Video Watch Video

About the Project

The VR Multiplayer Golf Game is designed to bring people closer, even if they're miles apart. Whether friends or family members are working in different countries or living far from home, our game offers a fun and immersive way to reconnect. With realistic golf mechanics and social interaction in a virtual environment, users can enjoy quality leisure time and foster meaningful communication — contributing to a healthy, balanced lifestyle.

This is a hardware-based project that includes custom-built components such as a smart golf stick ,VR head set and a wrist-worn sensor. These devices provide real-time motion tracking and haptic feedback, enhancing the realism and interactivity of the gameplay.

View User Manual

VR Golf Hardware

Implementation

Step 1 Step 2 Step 3 Step 4 Step 5 Step 6

The VR Multiplayer Golf Game is implemented using a combination of modern tools and platforms:

  • Unity (2022.3.62f1): The core game engine used to develop the VR environment, implement realistic golf physics, manage gameplay mechanics, and enable networked multiplayer features. Unity handles all in-game logic, user interface, and real-time synchronization of player actions.
  • Photon PUN & Photon Voice: Provides robust multiplayer networking and real-time voice chat. Photon PUN synchronizes game state, player positions, and interactions across devices, while Photon Voice enables secure, low-latency voice communication between players using AES-256 encryption.
  • Google Sign-In (Firebase Auth or Unity Social APIs): Used for secure user authentication. Players log in with their Google accounts, and their profile images are displayed as custom avatars within the game.
  • ESP32 Controllers: Custom-built golf stick and handwear controller use ESP32 microcontrollers to capture motion and button input. These devices communicate with the VR app via and Wi-Fi UDP, enabling real-time tracking and haptic feedback.
  • Google Cardboard Plugin: Integrates mobile VR support, allowing the game to run on standard Android smartphones mounted in VR headsets.
  • Programming Languages: C# for Unity scripts, C++ for ESP32 firmware, and Java for Unity native plugins.
  • Platform: Android-based mobile VR devices (using standard VR boxes).
  • Input APIs: Unity Input System processes motion data from the smartphone sensors and ESP32 devices, as well as button presses for in-game actions and menu navigation.
  • Build System: Gradle and Unity Build Pipeline are used for compiling and deploying the application to Android devices.

Circuit Diagram

The VR Golf hardware stack is designed for reliability, low latency, and ease of integration with the VR system. The main components and their technical details are:

  • ESP32 (30-pin):
    • Acts as the core microcontroller for sensor interfacing, input processing, and Wi-Fi communication.
    • Operating Voltage: 3.3V (logic), powered via two 3.7V Li-ion battery regulated down to 5V using Buck module.
    • Key Pins Used:
      • GPIO 21/22 - I2C communication with MPU6050 (SDA/SCL)
      • GPIO 14/27/26/25/33/32 - Digital input from push buttons
      • vin, GND - Power supply
    • Supports both Wi-Fi (UDP) and Bluetooth (BLE) for communication with the Unity VR app.
  • MPU6050 Gyroscope/Accelerometer:
    • Used for 6-axis motion tracking (acceleration + rotation) in the golf stick and handwear controller.
    • Operating Voltage: 3.3V to 5V (connected to ESP32's 3.3V supply)
    • I2C Pins: SDA (to ESP32 GPIO 21), SCL (to ESP32 GPIO 22)
    • Provides real-time orientation and swing data to the ESP32.
  • Push Buttons:
    • Used for swing detection and menu navigation.
    • Operating Voltage: 3.3V logic (pulled up internally or externally)
    • Pin Connections: Connected to ESP32 GPIOs (e.g., GPIO 14, 27, 26, 25, 33, 32) with one side to GND.
  • Lithium-ion Battery (18650):
    • Provides portable power for the entire hardware module.
    • Nominal Voltage: 3.7V
    • Voltage Regulation: Buck converter module steps down to 5V for ESP32 and peripherals.
    • Includes a battery holder for safety and easy replacement.
Integration Notes: All components are securely connected and managed by the ESP32, with careful PCB routing and enclosure design for durability, comfort, and safety during gameplay.

VR Golf Circuit Diagram
ESP32 ESP32
MPU6050 MPU6050
Push Button Buck Module
Vibrator Motor Vibrator Motor

Device Connectivity & Data Flow

Device Connectivity Diagram

System Communication:

  • Both the golf stick and handwear controller use ESP32 modules to collect sensor and button data.
  • Data is transmitted via Wi-Fi UDP to the smartphone running the VR app.
  • The mobile app (built with Unity) processes the incoming data to update the virtual environment in real time.
  • Multiplayer synchronization, voice chat, and cloud storage are managed via Photon PUN/Voice and Firebase.
Connectivity Flow:
  1. Player swings the golf stick; sensor and button data are read by the ESP32.
  2. ESP32 transmits data over Wi-Fi UDP to the smartphone.
  3. Unity app interprets the data for in-game actions and physics simulation.
  4. Game state and player actions are synchronized across all players via Photon Cloud servers.

Budget

Item Name Unit Price (LKR) Quantity Price (LKR)
ESP32 1,690 2 3,380
Adjustable Buck Module 430 2 860
Push Buttons 40 12 480
Vibrator 120 2 240
MPu 6050 740 2 1480
18650 Battery 470 4 1,880
Battery Holder 100 2 200
Total 7,220

Team Members

John Doe

Kavindu Methpura

Jane Smith

Binuri Senavirathna

Emily Johnson

Rashmika Sewmini

Michael Brown

Janith Wanasinghe