the_goth_cardgame_collection/README.md

209 lines
14 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# The Goth Cardgame Collection
[**Deutsch**](#-deutsch) | [**English**](#-english)
---
## Deutsch
### 1. Projektüberblick
**The Goth Cardgame Collection** ist eine modulare Desktop-Kartenspiel-Sammlung in dunkler Gothic-Ästhetik, entwickelt mit **Python 3.11+**, **Tkinter**, **Pillow (PIL)**, **Pygame (Audio)** und **SQLite3**.
Jedes Spiel arbeitet als vollständig gekapseltes Modul mit **eigener Erfahrungskurve (XP & Ränge)**, eigenen Statistiken und – bei Glücksspielen – einer komplett autarken Gold-Wirtschaft samt harten Konsequenzen.
---
### 2. Kern-Features & Systemarchitektur
* **Flache 4-Kategorien-Navigation (keine verschachtelten Unterkategorien):**
* **Glück (`luck`):** Spiele mit eigenen Goldbeuteln, Tischeinsätzen, *Divine Punishment* und *The Devil's Deal* (**Blackjack**, **Texas Hold'em**).
* **Solo (`solo`):** Klassische Patience-/Solitaire-Spiele ohne Gold-Zwang, mit eigenen Fortschritts- und Rückstufungsregeln (*Klondike*, *FreeCell*, *Spider Solitaire* – vorbereitet).
* **Gesellschaft - Offline (`party_offline`):** Lokale Gesellschaftsrunden gegen KI-Charaktere (in Vorbereitung).
* **Online (`online`):** Mehrspieler-Tische & entfesselte Bots auf *Gottheit*-Niveau ohne Welpenschutz (in Vorbereitung).
* **Spielgebundenes Prestige- & Rangsystem:**
* **260 Ränge** (0–258 in römischen Stufen `I–V`, ab Rang 259 unendliche **Gottheit**-Stufen).
* Jedes Spiel verwaltet seinen eigenen Level- und XP-Stand (`game_progress`), sodass Fortschritte zwischen einzelnen Spielen niemals vermischt werden.
* **Autarke Glücksspiel-Ökonomie, Divine Punishment & The Devil's Deal:**
* Bis zu **5 eigene Goldbeutel** pro Glücksspiel und Profil (je `1.000 Gold` Startkapital).
* **XP-gegen-Gold-Tausch:** Regulär `10.000 XP` für `+10 Gold` (ausschließlich aus dem XP-Pool des jeweiligen Spiels).
* **Divine Punishment:** Wer im jeweiligen Spiel einmal den Rang *Gottheit* erreicht hat, zahlt für Gold-Tausche das $10$-fache der Durchschnitts-XP des Vorlevels und kann maximal bis auf die Untergrenze von *Schöpfergeist V* zurückfallen.
* **The Devil's Deal:** Ist die Untergrenze von *Schöpfergeist V* erreicht, kann ein anderes Seelen-Profil geopfert werden (sofern dieses **im selben Spiel** mindestens den Rang **Stütze I** hält), um `+10 Gold` zu erhalten. Während eines aktiven Pakts sind alle anderen Menüs und Spiele gesperrt (*Auto-Save & Resume-Zwang*), bis die Runde entschieden ist.
* **7 KI-Schwierigkeitsgrade (Stufe 0 bis Stufe 6 „Gottheit“):**
* Frei konfigurierbare Gegner-Slots mit persistent gespeicherten Namen und KI-Stufen pro Spiel (`bot_configs`).
* **Gothic UI, Custom Fonts & Cross-Platform Integration:**
* Dynamischer Laufzeit-Font-Loader (`view/font_loader.py`) für mitgelieferte `.ttf`-Schriften (`OldLondon.ttf` & `OldLondonAlternate.ttf`) komplett ohne Systeminstallation unter **Windows**, **Linux**, **ChromeOS (Crostini)** und **macOS**.
* Plattformübergreifendes Anwendungs-Icon (`game_icon.ico` inkl. Windows-Taskbar-ID, Multi-Size X11/Wayland `WM_CLASS` & macOS-Dock-Unterstützung).
* Automatische Speicherung & Wiederherstellung von Fenstergröße, Bildschirmposition und Maximiert-/Vollbild-Status (`view/window_state.py`).
* Vollständige Zweisprachigkeit (**Deutsch / Englisch**) im Live-Wechsel sowie zweikanalige Audio-Steuerung (Ambiance/Hintergrundmusik & Soundeffekte).
---
### 3. Enthaltene & Geplante Spielmodule
| Kategorie | Spiel | Status | Varianten & Besonderheiten | Detail-Doku |
| :--- | :--- | :--- | :--- | :--- |
| **Glück** | **Blackjack** | Spielbar | *Klassisch* (2 Decks) & *Hoher Einsatz* (6 Decks), bis zu 3 Bots, Devil's Gambit Wettbaum, Split/Double, `7-7-7` Sofortsieg | [`games/blackjack/README.md`](games/blackjack/README.md) |
| **Glück** | **Texas Hold'em** | Spielbar | *Klassisch* & *Hoher Einsatz*, 6-Max Tisch (1–5 Bots), gleicher Start-Ante, Pre-Flop bis Showdown, All-In & Side-Pots, Info-Hilfesystem | [`games/poker/README.md`](games/poker/README.md) |
| **Solo** | **Klondike** | Geplant | *Draw 1* & *Draw 3* (Stammdaten & Varianten-IDs vorbereitet) | — |
| **Solo** | **FreeCell** | Geplant | *Standard* (Stammdaten & Varianten-IDs vorbereitet) | — |
| **Solo** | **Spider Solitaire** | Geplant | *1 Farbe*, *2 Farben*, *4 Farben* (Stammdaten & Varianten-IDs vorbereitet) | — |
---
### 4. Projektstruktur
~~~text
the_goth_cardgame_collection/
├── main.py # Einstiegspunkt, OS-Icon, Font-Registrierung & Window-Persistence
├── build.py # Build-Skript (aktuelles OS oder Cross-Platform-Paketierung)
├── user_data.db # Automatisch beim Start erzeugte lokale Spielstand- & Statistik-DB
├── controller/
│ ├── app_controller.py # Hauptsteuerung, Profil-Session & Devil's-Deal-Sperrlogik
│ ├── app_context.py # Schnittstelle zwischen Core-App und den Spielmodulen
│ └── game_loader.py # Dynamischer Discovery-Loader für games/**/start.py
├── models/
│ ├── card.py # Karten-Datenmodell
│ ├── deck.py # Deck- & Misch-Logik
│ ├── database.py # Kapselung aller SQLite-Zugriffe (ATTACH core + user_data.db)
│ ├── progression.py # XP-Kurve, Prestige-Ränge, Chip-Skalierung & Divine Punishment
│ ├── resource_manager.py # Dateipfad-Auflösung für Karten-Themes, Bilder & Sounds
│ └── sound_manager.py # Pygame-Mixer für Musik-Streams & SFX-Kanäle
├── resources/
│ ├── code_res/
│ │ ├── game_constants.py # Zentrale Konstanten, Farbpalette & Spiel-Konfigurationen
│ │ ├── i18n.py # Übersetzungs-Cache & Sprachumschaltung (DE/EN)
│ │ ├── sql_queries.py # Alle SQL-Statements & User-DB-DDL
│ │ ├── internal_base.sql # Vollständiger SQL-Seed (nur für manuelle DB-Neuerstellung)
│ │ └── internal_base.db # Fertig mitgelieferte Read-Only-Stammdatenbank
│ ├── cards/default/ # Spielkarten-Grafiken & Kartenrücken
│ ├── fonts/ # Lokale TTF-Schriften (OldLondon.ttf, OldLondonAlternate.ttf)
│ ├── images/ # UI-Grafiken, Banner (title.jpg), Pokertisch, GIFs & game_icon.ico
│ └── sounds/ # Musik (Beyond_The_Iron_Gate, The_Midnight_Hand) & SFX
├── view/
│ ├── main_window.py # Hauptfenster-Container & Hintergrund-Skalierung
│ ├── assets_manager.py # PIL/ImageTk-Cache für Karten, Banner, Buttons & GIF-Frames
│ ├── font_loader.py # Plattformübergreifender TTF-Loader & Georgia->OldLondon-Bridge
│ ├── window_state.py # Speicherung/Wiederherstellung von Fenstergröße & Position
│ ├── dialogs/ # Globale Overlays (z. B. AudioSettingsDialog)
│ ├── menus/ # LoginView, MainMenuView, StatisticsView
│ └── widgets/ # ImageButton, BotSetupWidget, StatsBoardWidget, InfoBadge
└── games/
├── blackjack/ # Eigenständiges Blackjack-Modul (MVC + eigene README.md)
└── poker/ # Eigenständiges 6-Max Texas Hold'em-Modul (MVC + eigene README.md)
~~~
---
### 5. Installation, Entwicklung & Build
#### A. Fertiges Spiel installieren (Empfohlen)
Für normale Spieler ist **keine** Python-Installation erforderlich:
1. Lade das passende Archiv für dein Betriebssystem (**Windows**, **Linux / ChromeOS** oder **macOS**) direkt unter [**Releases**](../../releases) herunter.
2. Entpacke das Archiv in einen beliebigen Ordner und starte die ausführbare Datei. Spielstände (`user_data.db`) werden automatisch lokal angelegt.
#### B. Direkt aus dem Quellcode starten (Entwicklung)
Voraussetzung ist **Python 3.11+** (inkl. `tkinter`):
~~~bash
pip install pillow pygame
python3 main.py
~~~
#### C. Lokales Build-Skript (Einzel-OS & Cross-Platform)
Über das mitgelieferte Build-Skript lassen sich eigenständige Pakete inkl. aller Ressourcen (`resources/`) erzeugen. Über Parameter kann gesteuert werden, ob nur für das aktuell laufende System oder für alle Zielplattformen gebaut wird:
~~~bash
# Nur für das aktuell genutzte Betriebssystem bauen:
python3 build.py --target current
# Für alle unterstützten Zielsysteme bauen (Windows, Linux/ChromeOS, macOS):
python3 build.py --target all
~~~
#### D. Hinweis zur Stammdatenbank (`internal_base.db`)
Die Datei `resources/code_res/internal_base.db` wird **komplett fertig und einsatzbereit mitgeliefert** – im normalen Betrieb oder beim Bauen muss nichts an der Datenbank gemacht werden.
Die Datei `internal_base.sql` enthält den gesamten Datenbestand als Voll-Backup und wird **ausschließlich dann** benötigt, wenn man die Stammdatenbank absichtlich von Hand modifiziert oder beschädigt hat und sie komplett frisch aufbauen möchte:
~~~bash
sqlite3 resources/code_res/internal_base.db < resources/code_res/internal_base.sql
~~~
---
### 6. Architektur-Richtlinien
1. **Striktes 1-Klasse-pro-Datei-Prinzip** für klare Zuständigkeiten.
2. **Keine Hardcodings:** Alle UI-Texte (`DE`/`EN`) liegen in `base_i18n`, SQL-Abfragen in `sql_queries.py`, Konstanten in `game_constants.py`.
3. **Plugin-Einstiegspunkt:** Jedes Spielmodul besitzt eine `start.py` mit `GAME_TITLE_KEY`, `GAME_FOLDER_ID`, `GAME_CATEGORY` und `start_game(context)` und wird automatisch vom `GameLoader` eingebunden.
---
---
## English
### 1. Project Overview
**The Goth Cardgame Collection** is a modular desktop card game suite crafted in a dark Gothic aesthetic using **Python 3.11+**, **Tkinter**, **Pillow (PIL)**, **Pygame (Audio)**, and **SQLite3**.
Every game runs as a self-contained module with **strictly isolated progression (XP & Prestige Ranks)**, dedicated statistics, and—for gambling titles—an independent Gold pouch economy with lasting consequences.
---
### 2. Core Features & Architecture
* **Flat 4-Category Navigation (no nested subcategories):**
* **Luck (`luck`):** High-consequence table games with dedicated Gold pouches, *Divine Punishment*, and *The Devil's Deal* (**Blackjack**, **Texas Hold'em**).
* **Solo (`solo`):** Skill-based solitaire classics without Gold requirements, governed by dedicated progression rules (*Klondike*, *FreeCell*, *Spider Solitaire* — prepared).
* **Party - Offline (`party_offline`):** Local parlor card games against AI personalities (planned).
* **Online (`online`):** Multiplayer rooms & unleashed *Deity*-tier bots without hand-holding (planned).
* **Per-Game Prestige System:**
* **260 Prestige Ranks** (0–258 across Roman tiers `I–V`, followed by uncapped **Deity** levels from rank 259 onward), tracked independently per game (`game_progress`).
* **Isolated Gold Economy, Divine Punishment & The Devil's Deal:**
* Up to **5 dedicated Gold Pouches** per gambling game and profile (`1,000 Gold` starting bankroll each).
* **XP-to-Gold Exchange:** Base rate of `10,000 XP` for `+10 Gold` drawn strictly from that specific game's XP pool.
* **Divine Punishment:** Once a profile has ever reached *Deity* in a game, exchanging XP costs $10\times$ the average XP of the previous level, dropping no lower than the floor of *Creator Spirit V*.
* **The Devil's Deal:** At the *Creator Spirit V* floor, players may permanently sacrifice another soul profile (holding at least **Support I** in that **exact same game**) for `+10 Gold`. Active pacts lock navigation and enforce auto-save/resume until the hand is resolved.
* **7 AI Difficulty Tiers (Level 0 to Level 6 "Deity"):**
* Configurable opponent seats with persistent names and AI levels per game (`bot_configs`).
* **Gothic UI, Bundled Fonts & Cross-Platform Integration:**
* Runtime `.ttf` font loader (`OldLondon.ttf`, `OldLondonAlternate.ttf`) requiring zero OS-level font installation on **Windows**, **Linux**, **ChromeOS (Crostini)**, and **macOS**.
* Cross-platform window & taskbar icon support (`game_icon.ico`) plus automatic window size, position, and maximized/fullscreen persistence (`WindowStatePersistence`).
* Live **DE / EN** localization and dual-channel audio controls (Ambiance/Music & SFX).
---
### 3. Included & Planned Modules
| Category | Game | Status | Variants & Highlights | Module Docs |
| :--- | :--- | :--- | :--- | :--- |
| **Luck** | **Blackjack** | Playable | *Classic* (2 Decks) & *High Stakes* (6 Decks), up to 3 Bots, Devil's Gambit betting tree, Split/Double, `7-7-7` instant win | [`games/blackjack/README.md`](games/blackjack/README.md) |
| **Luck** | **Texas Hold'em** | Playable | *Classic* & *High Stakes*, 6-Max Arena (1–5 Bots), equal entry ante, Pre-Flop to Showdown, All-In & Side Pots, info tooltips | [`games/poker/README.md`](games/poker/README.md) |
| **Solo** | **Klondike** | Planned | *Draw 1* & *Draw 3* (core DB variants seeded) | — |
| **Solo** | **FreeCell** | Planned | *Standard* (core DB variant seeded) | — |
| **Solo** | **Spider Solitaire** | Planned | *1 Suit*, *2 Suits*, *4 Suits* (core DB variants seeded) | — |
---
### 4. Installation, Development & Build
#### A. End-User Installation (Recommended)
No Python setup is required to play:
1. Download the pre-built release archive for your platform (**Windows**, **Linux / ChromeOS**, or **macOS**) from [**Releases**](../../releases).
2. Extract the archive and launch the executable. Save data (`user_data.db`) is created automatically in the local directory.
#### B. Running from Source (Development)
Requires **Python 3.11+** (with `tkinter`):
~~~bash
pip install pillow pygame
python3 main.py
~~~
#### C. Local & Cross-Platform Build Script
The repository includes a build script capable of packaging standalone builds either quickly for your active host OS or across all supported target platforms via CLI flags:
~~~bash
# Build only for the currently running OS:
python3 build.py --target current
# Build release packages for all target platforms:
python3 build.py --target all
~~~
#### D. Static Core Database (`internal_base.db`)
`resources/code_res/internal_base.db` is **shipped ready-to-use** out of the box—no database setup step is needed.
The full seed script `internal_base.sql` is only required if you intentionally edited the static core data yourself or manually corrupted `internal_base.db` and wish to rebuild it from scratch:
~~~bash
sqlite3 resources/code_res/internal_base.db < resources/code_res/internal_base.sql
~~~