ivans-csu / super-cow-powers

Class project to learn socket programming by creating a networked game.
0 stars 0 forks source link

Networked Othello

This is a simple Othello/Reversi game implemented using Python and sockets.

State of Implementation:

How to play:

  1. Start the server: Run python server.py -p <listen port>
  2. Connect clients: Run python client.py -i <server IP address> -p <server port> once for each client (each on their own terminal).
  3. Play the game: Players take turns entering their moves. When all squares contain pieces, the player with the most pieces on the board wins.
    • Use the format 'A1' to place a piece at that game coordinate

Technologies used:

Additional resources:

Super Cow Powers Othello Protocol Specification v0 (INDEV)

Preface

Potential future additions

Notation & Terminology

User

Game

Message

Session

Message Notation in This Document:

unsigned word

(field name) : (width in bits)

signed word

(field name) : s(width in bits)

arbitrary data

(field name) : d(width in bits)

conditional field

?(field name) : (prefix)(width in bits) : IF (condition)

Overview

Client Packets

Server Packets

Games

Matchmaking

Status Codes

0 - OK

1 - BAD_FORMAT

2 - ILLEGAL

3 - INVALID

4 - UNSUPPORTED

5 - UNAUTHORIZED

Actions & Action Responses

0 - HELLO

request

response

1 - JOIN

request

response

2 - MOVE

request

response

255 - UNSUPPORTED

State Pushes

0 - CONNECT

1 - DCONNECT

2 - GAMESTATE

3 - WIN

4 - LOSE

5 - TIE

Message Specification

Client Packet Structure:

action preamble : 8
message body data : undefined

Server Packet Structure:

state preamble : d16
message body data : undefined

response type 0 - action status

response type : 1
status : 7
action type : 8

response type 1 - state push

response type : 1
state message type : 15

Action / Action Response Messages

0 - HELLO

request

max version number : 16
user id : 32

response

?version number : 16 : status != INVALID
?user id : 32 : status = INVALID

1 - JOIN

request

game id : 32

response

?game id : 32 : IF status = OK
?GAMESTATE message : d136 : IF status = OK

2 - MOVE

request

to coordinate X : 4
to coordinate Y : 4

response

GAMESTATE message : d136

State Push Messages

0 - CONNECT

(empty)

1 - DCONNECT

(empty)

2 - GAMESTATE

color : 1
can move : 1
turn number : 6
board state : d128

3 - WIN

(empty)

4 - LOSE

(empty)

5 - TIE

(empty)