2022-06-04 15:52:26 +03:00
|
|
|
# chess_rpg_backend
|
2022-07-02 14:18:19 +03:00
|
|
|
DEV branch for backend for chess rpg game
|
|
|
|
<hr>
|
|
|
|
|
|
|
|
##### dev server for up to date endpoints(web socket not provided)
|
|
|
|
|
|
|
|
- https://dev.akarpov.ru
|
|
|
|
|
|
|
|
<hr>
|
2022-06-21 11:37:18 +03:00
|
|
|
|
|
|
|
### installation
|
|
|
|
```shell
|
|
|
|
$ python3 manage.py makemigrations & python3 manage.py migrate
|
2022-07-02 16:57:02 +03:00
|
|
|
$ python3 manage.py loaddata media/dump_data/hero_model_fixture.json
|
2022-06-21 11:37:18 +03:00
|
|
|
$ docker run -p 6379:6379 -d redis:5
|
|
|
|
```
|
|
|
|
|
2022-07-07 23:54:03 +03:00
|
|
|
### dev run
|
|
|
|
```shell
|
|
|
|
$ python3 manage.py runserver 0.0.0.0:8000
|
|
|
|
```
|
|
|
|
|
|
|
|
### prod run
|
2022-06-21 11:37:18 +03:00
|
|
|
```shell
|
2022-07-02 14:57:58 +03:00
|
|
|
$ daphne -b 0.0.0.0 -p 8000 chess_backend.asgi:application
|
2022-07-01 15:12:32 +03:00
|
|
|
```
|
|
|
|
|
|
|
|
### Описание команд сокетов
|
2022-07-01 15:13:28 +03:00
|
|
|
```python
|
2022-07-01 15:12:32 +03:00
|
|
|
# подключиние к очереди(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"
|
|
|
|
}
|
|
|
|
```
|