viperscape/rust-chess

networking: server

Opened this issue · 0 comments

server will run in a threaded 1:1 design using tcp sockets and making use of Wire for encoding

server will house a list of active games by gameid (as u64 unique ids), these can be loaded from a file encoded as json/text or loaded from a local sqlite db.

the server may simple contain the last move made (player), or it may also contain the current board state, and last move made. board state requires that the server perform logic to validate moves, otherwise this could be forced onto the clients, since they validate all moves.

currently chat is not planned, but this could be extended; it would require a vec of chat posts, which gets drained over time: simple buffer

to handle frequent disconnects, the client reconnects with a game id specified to rejoin the game-- then the game is pulled up from memory/file and the last move is sent to the player. the rendering thread or main thread on client will have to keep track of last player move as well-- so as to not repeat animations.