Skip to content

pacman128/oh_hell_client_server

Repository files navigation

Oh Hell Client Server

Introduction

This repository holds the files for my Python implementation of a Oh Hell card game network server and a TUI client.

There is also a Java-based GUI Client repo.

File Descriptions

server.py

This is the main Python server program.

$ ./server.py -h
usage: server.py [-h] [--num-players NUM_PLAYERS] [--save-file SAVE_FILE]

Oh Hell game server

options:
  -h, --help            show this help message and exit
  --num-players NUM_PLAYERS, -n NUM_PLAYERS
                        Number of players (default: 3
  --save-file SAVE_FILE, -f SAVE_FILE
                        Path to game save file

It can be started in two different ways.

Launch New Game

This is the default for the game, it will start a whole new file. After each hand of the game, it will save the state of the game into a date-stamped file XML file. By default, the game will wait for 3 player clients to connect before the game starts, but this can be changed with the -n option.

Restore a Game from a Save File

It's possible to restore the state of a game from the saved XML file after a server crash. Crashes can occur do to network issues (such as a client disconnection). This will restore the server to a state of the last played hand and start a new hand. The hand being played during the crash is lost and will be replayed with a fresh set of dealt hands. This mode is activated by using the -f option to specify the save file to use.

When started in restore mode, do not specify the -n option. The number of players will be read from the save file. The server will wait for all the players to reconnect before starting the next hand.

client.py

This is a Python TUI program that allows one to connect to the server.

$ ./client.py -h
usage: client.py [-h] [--server-addr SERVER-ADDRESS] [PLAYER-NAME]

Oh Hell Player client

positional arguments:
  PLAYER-NAME           Name of player

options:
  -h, --help            show this help message and exit
  --server-addr SERVER-ADDRESS, -s SERVER-ADDRESS
                        Game server address (default: 127.0.0.1)

registerGame.py

This program registers a game into a SQLite database.

~/projects/git/oh_hell$ ./registerGame.py -h
usage: registerGame.py [-h] [-d DATABASE] xml_files [xml_files ...]

Register Oh Hell game in db

positional arguments:
  xml_files

options:
  -h, --help            show this help message and exit
  -d DATABASE, --database DATABASE
                        Path to SQLLite database file (default: oh_hell.db)

The init_db.sh can be used to initialize a SQLite database file to use.

About

Oh Hell python-based Client Server

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors