Skip to content

ivozilkenat/distributed-systems-io

Repository files navigation

Distributed-Systems-IO

A 2D multiplayer game with a dynamic lobby system. Lobbies are created on demand and dynamically spun up as new instances behind a Traefik reverse proxy. This architecture showcases core concepts of distributed systems and was built with scalability and modularity in mind.


🧱 Tech Stack

image

📦 Services

image

🚀 Deployment Overview

image image


🖥️ Server Setup

image


🔄 Service Communication

image


🔍 Server Browser Example

image


🚀 Deployment

🌐 Production – Automatic


🛠️ Full Setup – Manual

✅ Dependencies

Make sure you have the following installed:

  1. docker
  2. ansible
  3. python3-dotenv-cli
  4. git (pre-installed on most Linux distributions)
  5. make (pre-installed on most Linux distributions)

⚙️ Setup

  1. Clone the project.
  2. Configure environment variables:
    cp local.env ./deployment/.env
    (Set values like DOMAIN, etc.)
  3. Change into the deployment directory:
    cd ./deployment
  4. Join a Docker Swarm cluster:
    • If no cluster is present, initialize one and use the current machine as the master node:
      docker swarm init --advertise-addr 127.0.0.1

🚦 Actions

Deploy using local containers (e.g. for testing code changes in game_server or app_matchmaking_host):

  • Ensure image and domain variables are set in deployment/.env based on localhost.env
  • Run:
    make deploy-local

Deploy:

make deploy

Undeploy:

make rm-all

Scale (e.g. add a new lobby instance):

make lobby_id=your_name_here add-lobby

🧪 Minimal Testable Setup

Run the Database:

cd services/database
docker compose up

Run the Matchmaking Server:

cd services/app_matchmaking_host
source backend/venv/bin/activate  # Adjust path if necessary
python main.py

Run a Game Server:

cd services/game_server
source venv/bin/activate  # Adjust path if necessary

Optional environment variables:

  • DEPEND_ON_MATCHMAKING=0 – Start without matchmaking dependency
  • HOST=localhost – Host address (default: 0.0.0.0)
  • PORT=3001 – Port number
  • SERVER_NAME=Unbekannt – Lobby name
  • SERVER_URL=http://{HOST}:{PORT} – Lobby URL
  • SERVER_ID and SERVER_TOKEN – Credentials for reconnecting to matchmaking (optional)
  • CREDENTIALS_FILE=DATA_DIR/credentials.json – Where credentials are saved

Start the server:

python main.py

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors 5