This is a two-player action game designed for AR/VR, built using a Unity-based application and enhanced with several Arduino-powered hardware peripherals and sensors.
Players use a glove and wand to perform actions, which are captured by sensors and processed by an AI model that classifies each action. The results are displayed in real time through the players’ VR goggles, creating an immersive and responsive experience.
This repoistory includes the external communication system for the capstone project, which runs primarily on a remote Ultra 96 server.
This system includes 4 major hardware components. The beetles, the laptop, the U96 and the android visualizer.
The following commands are run from the /external-comms directory.
- Add a .env file to the root of the external-comms folder
MQTT_USERNAME
MQTT_PASSWORD- Create a venv and pip install requirements.txt
pip install -r requirements.txt- Open a new terminal and change directories into /server
cd src/core/eval_server/server- Run the evaluation server
bash run_server.sh-
Copy full path of src/core/eval_server/index.html and run in web browser
-
Enter
127.0.0.1as the IP and 16aas the password. -
Press Login. You should see the eval web client and a connection on the evaluation server's terminal.
- On a seperate terminal run the game.
python3 1_player_game.py-
Enter the port number as shown on the web client.
-
Now, the game engine should have started. 4 TCP servers should have opened for listening and the game engine should have connected to the MQTT broker.
- Ensure the visualizer is connected to the MQTT broker as well.
- To test clients locally, open a new terminal and run
python3 -m test.action.test_action-
Enter
127.0.0.1and8002for player 1's server receiver address and port and127.0.0.1and8003for player 1's server sender address and port. -
If you want to initiate player 2 clients, follow the same steps and open port
8004and8005. -
Press next on the web client to start the game. To send a packet from the test client, follow the instructions on the client's terminal (eg. "s" and Enter to send shoot packet)
-
After a packet is sent, the visualizer has to send a visiblity response to complete the event.
- Open a new terminal and change directories into /server
cd src/core/eval_server/server- Run the evaluation server
bash run_server.sh-
Copy full path of src/core/eval_server/index.html and run in web browser
-
Enter
127.0.0.1as the IP and 16aas the password. -
Enter 1 or 2 player game.
-
Press Login. You should see the eval web client and a connection on the evaluation server's terminal.
-
Ensure that FortiClient is running
-
Run this command and replace 'xxxxx' with the port you see on the evaluation web browser.
ssh -R 8888:127.0.0.1:xxxxx xilinx@makerslab-fpga-21.d2.comp.nus.edu.sg-
Ensure that FortiClient is running
-
SSH into U96
ssh xilinx@makerslab-fpga-21.d2.comp.nus.edu.sg- Activate the pyenv
source /etc/profile.d/pynq_venv.sh- CD into 'external-comms' folder and start the game.
sudo -E python3 2_player_game.py-
Enter port 8888 when prompted.
-
If you are running the game WITHOUT Eval server for testing purposes, just ignore the "Eval Server Timeout" message in the console.
While the game is running, if the SSH closes unexpected, be it timeout or VPN issues, the game will not shut down gracefully and the relay ports (8002-8005) will be left dangling. To solve this:
- Run
sudo lsof -i :PORT_NUMBERfor 8002 - 8005 - Run
kill -9 PROCESS_IDfor all the respective processes - Run
ps auxto see the dangling running game (It should say like python 2_player_game.py) - Run
kill -9 PROCESS_IDfor the game


