From 73be9ae283c21dec4d310aafb0111b0b72262fbe Mon Sep 17 00:00:00 2001 From: Christoph Hagen Date: Thu, 24 Nov 2022 21:31:10 +0100 Subject: [PATCH] Update Readme.md --- Readme.md | 125 +++++++++++++++++------------------------------------- 1 file changed, 40 insertions(+), 85 deletions(-) diff --git a/Readme.md b/Readme.md index f4180d5..97728a9 100644 --- a/Readme.md +++ b/Readme.md @@ -1,100 +1,55 @@ -# Game process +# Schafkopf Server -1. Register user -- Store name, password -- Create session token -2. Create table -- Store name -- Create id -- Add player to table -3. Wait for all players -4. Deal first 4 cards -- Store all hand cards, show only 4 -5. Collect leger -- Consecutive choice for each player -6. Deal last 4 cards -- Start bidding -7. Bidding -- Choice for each player to match/increase bid -8. Select game -- Highest bidder selects game -- Move to playing -9. Play cards -- Allow shots until certain trick -- Collect completed tricks -- Determine winning card -- End game on last card -10. Finish game -- Count points -- Determine winner -- Back to 4 +This package provides a simple server to play the Bavarian game *Schafkopf* via a browser. -# Architecture +## Setup -## Messages to clients over the websocket +#### Configuration -### Table info +Create a `config.json` file in the `Resources` directory, and fill in all required information. You can have a look at the `config_example.json` file for the required fields. -Contains the general information about the table: -- Player names, Table name +```json +{ + "serverPort": 8000, + "production": false, + "mail": { + "serverDomain": "https://example.com/schafkopf", + "emailHostname": "example.com", + "email": "schafkopf@example.com", + "password": "some-secret-string", + "tokenExpiryDuration": 15, + } +} +``` -### ConnectionState +If `production` is set to `false´, then the database will only be created in memory, and deleted when the server is terminated. +The `mail` configuration is optional, and used to send the password recovery emails. -Indicates which players are currently online +You also need to set the API path in the `Public/api.js` file to the path where the server is run. +```js +const apiPath = "/schafkopf" +``` -### GameState - -- Current player (either to play a card, state game intention, ) -- First player in the round -- Game type (either game, or negotiation stage) - -# TODOs - -## Make UI for table -- Show players (+ connection state) -- Show played cards -- Show own cards -- Game negotiation - -## Updates from server -- Players at table (+ connection state, first/current player) -- Played cards -- Current player -- Game negotiation data -- Remaining cards -- Game results - -## API -- Leave table -- Start game -- Send negotiation input -- Send played card -- Send - -## Logic -- Shuffle cards -- Cards, Card sets -- Determine playable cards -- Determine win of round -- Rank game types, negotiation +The server can be then be run like any other executable swift package: +```bash +swift run +``` # Roadmap -Version 2: -- Configure game options -- Switch player positions -- Set first player -- Add game costs and player scores -- Introduce "legen" and "schießen" +There are a few features still missing from this implementation: -Version 3: -- Private tables -- Add simple computer player -- Global statistics for players -- Save data persistently -- Table administrator can remove players +- Global rankings of players by their points +- Point penalties for players leaving a running game +- Computer players +- Automatically playing a card after a timeout +- Table options to allow/disallow games and change other settings +- iOS App -# Bugs +## Improvements + +- Layout improvements for mobile devices in landscape mode +- Complete German/English localization +- Add last online date to user data -- Correctly show available games