https://github.com/db0/cgf-stats
A basic REST API service running on python to use for storing Card Game Framework game stats.
https://github.com/db0/cgf-stats
Last synced: about 1 year ago
JSON representation
A basic REST API service running on python to use for storing Card Game Framework game stats.
- Host: GitHub
- URL: https://github.com/db0/cgf-stats
- Owner: db0
- License: agpl-3.0
- Created: 2021-03-05T20:54:31.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-03-09T17:09:00.000Z (about 5 years ago)
- Last Synced: 2025-01-23T09:33:19.027Z (over 1 year ago)
- Language: Python
- Size: 34.2 KB
- Stars: 1
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Card Game Framework Game Stats
A basic REST API service to record and retrieve game stats from [Godot Card Game Framework](https://github.com/db0/godot-card-game-framework) games
*Requires Python3*
## Setup
Clone this repository from your server and run it
```python cgf-stats.py "My Cool Card Game" -i "your.ip.address"```
It will bring the REST API in port 8000
## Usage
In the Card Game Framework, edit your CFConst and add your server address and port to STATS_URI and STATS_PORT.
Whenever you start a new game, initiate the stats with:
```var stats = GameStats.new(deck)```
Where `deck` should be a dictionary with the deck contents being used
Whenever the game ends, finalize the game with
```stats.complete_game({"state": state, "details": details})```
Where `state` should be something like "victory" or "defeat". `details` is a dictionary with any additional details about the game you want to store. It will be inserted as it is into your game stats.
## Game Stats
The game stats are stored after each modification in the `games` file in the same directory as simple json. You can parse this file to compile stats from all the games played for your game until this point