├── README.md ├── docker-compose.yml └── mqtt └── config ├── mosquitto.conf ├── traze.acl └── users.conf /README.md: -------------------------------------------------------------------------------- 1 | # Traze 2 | Traze is a multi client online tronlike game with MQTT based protocol. It aims to provide a playground for various game clients, AI game bots, and showcase of a reasonable secure MQTT application, and it’s fun! You can write your own game client and participate in the game using the specified protocol. 3 | 4 | ## Hosted by iteratec 5 | You can join a hosted instance at [traze.iteratec.de](https://traze.iteratec.de). 6 | 7 | ## Run a Game locally 8 | You can start a local game using the docker-compose stack provided in this repository. 9 | ``` 10 | git clone https://github.com/iteratec/traze.git 11 | cd traze 12 | sudo docker-compose up 13 | ``` 14 | 15 | This will start a local gameserver, mqtt broker, webui, as well as a couple of bots, binding the following local host ports: 16 | 17 | | Service | Port | 18 | | -------------- | ---- | 19 | | webgrid | 80 | 20 | | documentation | 8080 | 21 | | mqtt broker | 1883 | 22 | | mqtt websocket | 9001 | 23 | 24 | You can watch the local game in your browser at http://localhost:80 25 | 26 | Bots can be scaled using docker-compose. 27 | ``` 28 | sudo docker-compose scale random-bot=5 29 | ``` 30 | 31 | ## Protocol 32 | The game protocol facilitates multiple MQTT topics with JSON payload. An extensive documentation of the protocol details is provided on [traze.iteratec.de](https://traze.iteratec.de). 33 | 34 | ## Components 35 | The traze project consists of multiple components. Each component has their own repository and lifecycle. You can find all traze related code under the [traze topic](https://github.com/topics/traze) on github. Some important examples are: 36 | 37 | ### Core 38 | 39 | These are the core components of the traze game 40 | 41 | [traze-docs](https://github.com/iteratec/traze-docs) web documentation of the traze protocol. 42 | 43 | [traze-gamserver](https://github.com/iteratec/traze-gameserver) haskell game server implementation for the traze protocol. 44 | 45 | [traze-web-grid](https://github.com/iteratec/traze-web-grid) web view that renders the game state as a grid with players on a canvas 46 | 47 | ### Client Libraries 48 | 49 | These are some client libraries that can be used to interact with the traze game server. 50 | 51 | [traze-client-python](https://github.com/iteratec/traze-client-python) a client library based on Python 3.6. 52 | 53 | [traze-goclient](https://github.com/iteratec/traze-client-go) a client library for golang 54 | 55 | ### Human Interface Clients 56 | 57 | Game clients for human players 58 | 59 | [traze-client-java](https://github.com/iteratec/traze-client-java) a client based on Java. 60 | 61 | [traze-javascript-vanilla](https://github.com/iteratec/traze-javascript-vanilla) a client based on (vanilla) ES6 JavaScript which is both for steering a player and rendering the grid ([demo](https://iteratec.github.io/traze-javascript-vanilla/)) 62 | 63 | ### Bot Implementations 64 | 65 | [traze-golang-bot](https://github.com/iteratec/traze-golang-bot) a traze bot written in go. 66 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3.3" 2 | services: 3 | broker: 4 | image: eclipse-mosquitto 5 | ports: 6 | - "1883:1883" 7 | - "9001:9001" 8 | volumes: 9 | - ./mqtt/config:/mosquitto/config:ro 10 | 11 | gameserver: 12 | image: iteratec/traze-gameserver 13 | environment: 14 | - TRAZE_BROKER_HOST=broker 15 | - TRAZE_BROKER_USER=trazeGameserver 16 | - TRAZE_BROKER_PASSWORD=uGh7ASu6paezaeveiY8i 17 | 18 | web: 19 | image: iteratec/traze-web-grid 20 | ports: 21 | - "80:80" 22 | environment: 23 | - APP_CONFIG='{"brokerUrl":"http://localhost:9001", "instanceName":"1"}' 24 | docs: 25 | image: iteratec/traze-docs:latest 26 | ports: 27 | - "8080:80" 28 | 29 | go-bot: 30 | image: iteratec/traze-golang-bot:latest 31 | environment: 32 | - MQTT_BROKER_ADDRESS=tcp://broker:1883 33 | - GAME_INSTANCE=1 34 | - NICK_NAME=bot1 35 | 36 | random-bot: 37 | image: iteratec/traze-random-bot:latest 38 | environment: 39 | - TRAZE_BROKER_URL=tcp://broker:1883 40 | 41 | -------------------------------------------------------------------------------- /mqtt/config/mosquitto.conf: -------------------------------------------------------------------------------- 1 | autosave_interval 1800 2 | persistence false 3 | persistence_file m2.db 4 | persistence_location /mosquitto/data 5 | connection_messages true 6 | log_timestamp true 7 | 8 | # 9 | # Just for testing! Allow Anonymous 10 | # 11 | allow_anonymous true 12 | #acl_file /mqtt/config/traze.acl 13 | password_file /mosquitto/config/users.conf 14 | 15 | # Default unencrypted (no SSL) MQTT Port 16 | listener 1883 17 | 18 | # WebSocket Port (MQTT over WebSocket) 19 | listener 9001 20 | protocol websockets 21 | #certfile /etc/letsencrypt/live/mqtt.example.com/cert.pem 22 | #cafile /etc/letsencrypt/live/mqtt.example.com/chain.pem 23 | #keyfile /etc/letsencrypt/live/mqtt.example.com/privkey.pem 24 | 25 | # Encrypted (SSL) MQTT Port 26 | #listener 8883 27 | #certfile /etc/letsencrypt/live/mqtt.example.com/cert.pem 28 | #cafile /etc/letsencrypt/live/mqtt.example.com/chain.pem 29 | #keyfile /etc/letsencrypt/live/mqtt.example.com/privkey.pem 30 | -------------------------------------------------------------------------------- /mqtt/config/traze.acl: -------------------------------------------------------------------------------- 1 | 2 | topic read traze/games 3 | topic read traze/+/grid 4 | topic read traze/+/players 5 | topic read traze/+/ticker 6 | pattern read traze/+/player/%c 7 | 8 | topic write traze/+/join 9 | topic write traze/+/+/steer 10 | topic write traze/+/+/bail 11 | 12 | user trazeGameserver 13 | 14 | topic read traze/+/join 15 | topic read traze/+/+/steer 16 | topic read traze/+/+/bail 17 | 18 | topic write traze/games 19 | topic write traze/+/grid 20 | topic write traze/+/players 21 | topic write traze/+/ticker 22 | topic write traze/+/player/+ 23 | 24 | -------------------------------------------------------------------------------- /mqtt/config/users.conf: -------------------------------------------------------------------------------- 1 | trazeGameserver:$6$jiM+o165IDLif+Cv$a9MUkpW+BISibdZt5R0Dt/MQytTta0wNb3GNJqk6xKbMmjHKLk3JH9c+9NN0DBFSHVtQCEUPBHtiDGe1hB7dRg== 2 | --------------------------------------------------------------------------------