Multiplayer client/server for CSD BattleShip
Project description
This package provides a simple client and server for the Battleship game. It tries to be roughly compatible with the Collaborative Software Design implementation. Behind the scenes, it uses WebSocket for communication between client and server.
Client Usage
The entire client functionality is encapsulated by battleship_mp.client.GameSession. This allows to join a game, transmit a board of set ships, and exchange shots. Note that the server does not perform any notable game state evaluation; multiplayer peers must exchange their game state (notably, their entire game board) to locally check the game progress. See the class’ description on how to use it.
Set the environment variable BMP_SERVER_URL to the server’s websocket URL. For example, if the server runs locally on port 8765 then use BMP_SERVER_URL="ws://localhost:8765" before starting the program. Alternatively, this can also be set inside Python by using os.environ["BMP_SERVER_URL"] = "ws://localhost:8765".
Server Usage
The server is self-contained and does not need to be embedded in a program. It can be run directly from the command line, requiring a port and optionally the addresses/hostnames to bind to. For testing, it is suitable to bind to localhost:
~ $ python3 -m battleship_mp.server 8765 localhost
See the --help flag for options.
Installation
You can install the package directly via pip; only Python >= 3.8 is required.
~ $ python3 -m pip install kcsd-battleship-mp
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kcsd-battleship-mp-1.1.0.tar.gz.
File metadata
- Download URL: kcsd-battleship-mp-1.1.0.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0fcfb153b09a117c4b2ea5f03e884fdb8eb03f6c1002e337dd9600f6f16a4435
|
|
| MD5 |
bc1afce2771e5bf2c72addf2d230f00b
|
|
| BLAKE2b-256 |
6506946720bbaa784131589d484508d7074042cfa1c7a78d4ebf9b0c3e5cb71b
|
File details
Details for the file kcsd_battleship_mp-1.1.0-py3-none-any.whl.
File metadata
- Download URL: kcsd_battleship_mp-1.1.0-py3-none-any.whl
- Upload date:
- Size: 9.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b052cb1b9672ec0a16c2e9623919d71bca9a381d82c3e24b067287992366fd0
|
|
| MD5 |
f4e6758deb122b758cadfe04777632ce
|
|
| BLAKE2b-256 |
e57472f86d1f576ba154ef2f7fd0c921a9337ce11dca6689590b1e7e0f89fe1e
|