Close

Building the Backbone: Our Server & Network Infrastructure

A project log for Mat@ir

A spherical chessboard where a robotic arm plays moves from an online game.

nasserNasser 02/26/2025 at 02:230 Comments

Since the goal of the project is to allow people from different parts of the country to play against each other on their devices and on separate spherical chessboards, we needed to design a server-client infrastructure where the server relays requests between clients—the clients being both the game and the ESP32 microcontroller.

After analyzing how all the components (game, server, ESP32) should interact, we created a diagram to illustrate how communication will take place.

Our system is built around a server-client architecture using WebSockets for real-time communication. It consists of three main components:

  1. Game Clients (Web-based Chess Game) – Players interact with the game through their web browsers, sending move requests and receiving game updates from the server. Spectators can also connect to watch ongoing games.

  2. Server (Python WebSocket Backend) – The central hub that manages all game sessions, player connections, and communication between devices. It validates moves, relays commands, and synchronizes game states.

  3. ESP32 (Robotic Chessboard Controller) – The ESP32 microcontroller controls the robotic arm and executes chess moves on the physical spherical chessboard based on commands from the server.

How It Works

After implementing this Infrastructure (4000+ lines of code), we had a fully functional online game, with data being sent between the game, server, and ESP32 in real time.

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

Discussions