Skip to content

Instantly share code, notes, and snippets.

@TrueBrain
Last active July 17, 2021 17:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TrueBrain/e407d01b1f3bed6cf78daf8405de2df8 to your computer and use it in GitHub Desktop.
Save TrueBrain/e407d01b1f3bed6cf78daf8405de2df8 to your computer and use it in GitHub Desktop.
Quick how-to guide in setting up development setup for game coordinator

This guide is build for WSL2 / Linux. For Windows it is also possible, but I can never remember Powershell syntax.

The beginning (one-time effort)

Get Python3.8+. Create a venv (for Debian, install python3-virtualenv package first):

python3 -m venv venv

Checkout the repos we will be needing:

git clone https://github.com/OpenTTD/py-protocol
git clone https://github.com/OpenTTD/game-coordinator

Next, we install all the dependencies:

venv/bin/pip install -r game-coordinator/requirements.txt
cd py-protocol
../venv/bin/pip install -e .
cd ..

Starting up

We need several components running:

  1. redis
  2. Game Coordinator

(you do NOT need the STUN/TURN server as long as the server/client runs on the same network segment as the Game Coordinator is running, which is highly advised for development! This means the server will be marked Public).

Redis

docker run --name redis --rm -p 6379:6379 redis

Game Coordinator

cd game-coordinator
../venv/bin/python -m game_coordinator --db redis --app coordinator --shared-secret test --web-port 12345

Starting a server/client

Start OpenTTD with:

OTTD_COORDINATOR_CS="localhost" ./openttd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment