L0laapk3 / ChainReaction-server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Server protocol

TL;DR

Example of typical websocket traffic:

> create
< GAME_ID
> join GAME_ID PLAYER_NAME
< PLAYER_INDEX PLAYER_KEY PLAYER_COUNT WIDTH HEIGHT
... (wait for game start)
# state format: PLY CURRENT_TURN_PLAYER BOMB_COUNTS CELL_OWNERS
< 0 1 000000000000000000000000000000 000000000000000000000000000000
> move GAME_ID PLAYER_KEY CELL_INDEX
< 1 2 000000000000000000000000000010 000000000000000000000000000010
... (wait for opponent move)
< 2 1 000000000000000000000000000011 000000000000000000000000000012
> move GAME_ID PLAYER_KEY 1
< 3 2 000000000000000000000000000021 000000000000000000000000000012
... (play until game is finished)
# game end state format: has WINNER_PLAYER_INDEX at the end
< 4 2 000000000000000000000011000101 000000000000000000000022000202 2

Error messages

All error messages start with the keyword error .

Running the server

npm i npm run start

About


Languages

Language:TypeScript 100.0%