The goal is to let people across the country play against each other on separate boards. To make this work, we built a server-client infrastructure. The server relays requests between the clients, which include both the game and the ESP32.
We mapped out how the game, server, and ESP32 interact and made a diagram to show the communication flow:

Our system uses a server client architecture built on WebSockets. It has three main parts:
- Game Clients: Players use their web browsers to send move requests and receive updates.
- Python Server: This manages game sessions, connections, and device communication. It validates moves and syncs the game.
- ESP32: The board controller receives commands from the server to move the robotic arm.
How It Works
Player Connection Players enter an ORB code to link to a specific board. If a game is already running, they can continue or end it. If not, they start a new one.
Move Execution
- A player makes a move.
- The game sends a request to the server.
- The server checks if the board is ready and validates the move.
- If valid, the server updates all players and sends the command to the physical board.
This infrastructure took over 4000 lines of code. Once finished, we had a working online game with real time data flowing between the web client, server, and ESP32.

Code of the game can be found here : Github link
Code of the server can be found here : Github link
Code of the esp32 can be found here : Github link
Nasser
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.