Skip to content

dominikjalowiecki/Online-Games

Repository files navigation

Preview project

Online-Games

Web application with online games for two players. Click here to preview.

Table of content


Technologies

  • Flask
  • PyGame
  • Phaser
  • Bootstrap
  • Socket.IO
  • JQuery
  • Celery
  • Redis
    • RedisJSON
    • RediSearch
    • Redis Pub/Sub
  • Redis-OM
  • Docker

Features

  • Turn-based game - Tic Tac Toe
  • Fast-paced game - Pong
    • Client-side prediction
    • Server state reconciliation
    • Linear move interpolation
  • Creating new room
  • Room chat
  • Spectating room
  • Searching for rooms
  • Paggination

Default config for Pong: 40 ticks server / 15 ticks client input


Setup

Clone repository

git clone https://github.com/dominikjalowiecki/Online-Games.git

Change directory

cd ./Online-Games

Initialize environment

make

Setup .env file

FLASK_APP=app
FLASK_DEBUG=True

SECRET_KEY=secret_phrase
SERVER_PORT=5000

SESSION_REDIS=<redis-url>
SOCKETIO_REDIS_CHANNEL='online-games-socketio'
REDIS_MESSAGE_QUEUE_URL=<redis-url>
REDIS_OM_URL=<redis-url>

LOG_FILE=logs/record.log

Setup tasks/.env file

REDIS_CELERY_URL=<redis-url>
SOCKETIO_REDIS_CHANNEL='online-games-socketio'
REDIS_MESSAGE_QUEUE_URL=<redis-url>

(Optional step) If used in production mode, you should compress static files manually

python -m whitenoise.compress ./app/static

Run development environment

make run
Use make clean to delete development environment.

OR

Run "production" environment

make start
Use make stop to stop docker-compose services.

Application available on http://localhost:5000


Projects hosting infrastructure

Projects hosting infrastructure