Go Server is a 2-Player Websockets Go Judging Server. This project is made for the Spring 2020 Machine Intelligence Course (CMPN402) in Computer Engineering Program at Cairo University Faculty of Engineering.
The server uses Websockets protocol version 13 as defined by RFC6455 (https://tools.ietf.org/html/rfc6455)
Communication Details can found in this document.
You can download a binary version for Windows from Releases.
WARNING: When running the server, place it in a folder where it has permission to create folders and write files. This permission is needed to save logs and checkpoints.
- To install the dependencies, run:
yarn install
. - To build the main and rendering threads, run:
yarn production
(See Parceljs for more options).
- To run the server, run:
yarn start
. - To run the console client, run:
yarn console:client [name] [address=ws://localhost:8080]
.
- To run the server on the console, run:
yarn console:server
. - To run a silly greedy agent, run:
yarn console:silly-agent
. - To play go-game only (offline), run:
yarn console:go
. - To package the server for distribution, run:
yarn dist
. - To run tests, run:
yarn test
. - To build the main and rendering threads in watch mode, run:
yarn watch:main
andyarn watch:renderer
each in a separate terminal.
Server configuration is found in server.config.json
, which contains the following configurations:
host
: can be127.0.0.1
if the server and the client are on the same machine (useful for debugging) and must be0.0.0.0
if the clients will run on a seperate machine (NOTE: you can get your machine's ip on the local network usingipconfig
).port
: defines the port to which the server will listen.ping interval
: defines the time interval for the ping/pong handshake in the heartbeat system (Format:MM:ss.s
).
Game configuration is found in game.config.json
, which contains the configuration described in the Communication Protocol Document. You can edit the game configuration file and the server will automatically detect the changes without restarting.
After running the server, run 2 clients then choose the clients to join the game from the requests list. After picking the players, press Play. If there is a saved checkpoint, you can press Clear to clear the checkpoint and return to the configuration found in game.config.json
. If you press Pause, you can continue the game later.
Run: yarn console:client [name] [address=ws://localhost:8080] [protocol]
. If the client and server are on the same device, you can use the default host (localhost
). Otherwise, you need to find the Server IP by running ipconfig
on the host machine. protocol
is an optional argument to determine the protocol version requested by the client. The supported protocols are: v1
(default) and v2
.
The client can play their turn using on of the following commands:
pass
resign
place <point>
where:point
is written in the form:column
androw
.column
can be a letter from A to Z except I androw
can be a number from 1 to 25.- For example, the upper left point in the board will always be A1.
- Other commands:
help
andexit
.
Run: yarn console:server
.
The server can manage the game using on of the following commands:
view <state | clients>
to view the game state or the clients list.state
will display the game board, scores, time, and turn.clients
will display the connected clients with their names, addresses and automatically assigned IDs. A list of selected players will also be shown.
join <client-id> <color>
to add a client to the game as a player wherecolor
is eitherB
orW
.leave <client-id>
to remove the client from the players' list.disconnect <client-id>
to forcefully disconnect a client from the server.swap
to swap the colors of the players.start
to start a game from the current state.stop
to pause the game.clear
to discard the checkpoint and set the current state to matchgame.config.json
.- Other commands:
help
andexit
.
The project is available as open source under the terms of the MIT License.