Backend for chess rpg game
Go to file
2022-07-08 01:16:41 +03:00
chess_backend Added daphne support 2022-07-02 14:57:58 +03:00
common added game state base logic, minor changes 2022-07-02 00:05:05 +03:00
game updated hero placement for room create 2022-07-08 01:16:41 +03:00
media/dump_data updated hero model, add hero model fixture 2022-07-02 16:57:02 +03:00
room updated hero placement for room create 2022-07-08 01:16:41 +03:00
.gitignore updated hero model, add hero model fixture 2022-07-02 16:57:02 +03:00
docker-compose.yaml Added docker compose 2022-07-02 15:23:49 +03:00
manage.py Initial commit, added base User and Hero models 2022-06-04 16:01:23 +03:00
nginx.conf Added nginx conf 2022-07-02 15:35:45 +03:00
README.md added hero position on deck for initial deck 2022-07-07 23:54:03 +03:00
requirements.txt added channels basic room consumer, minor updates for base game logic 2022-06-21 11:36:55 +03:00

chess_rpg_backend

DEV branch for backend for chess rpg game


dev server for up to date endpoints(web socket not provided)

installation

$ python3 manage.py makemigrations & python3 manage.py migrate
$ python3 manage.py loaddata media/dump_data/hero_model_fixture.json
$ docker run -p 6379:6379 -d redis:5

dev run

$ python3 manage.py runserver 0.0.0.0:8000

prod run

$ daphne -b 0.0.0.0 -p 8000 chess_backend.asgi:application             

Описание команд сокетов

# подключиние к очереди(ws://room/)  
{
    "type": "connect",
    "deck_id": int
}

# коннект к комнате (сообщение от сервера)
{
    "type": "INFO",
    "opponent_score": int,
    "coordinates" : [(x: int, y: int, type: str, model_url: url, your: bool), ...],
    "opponent_online": true,
    "first": bool
}

# состояние оппонента в комнате(сообщение от сервера)
{
    "type": "INFO",
    "message": "opponent is online" / "opponent is offline"
}