diff --git a/Architecture-Server-check.md b/Architecture-Server-check.md deleted file mode 100644 index 2d76767..0000000 --- a/Architecture-Server-check.md +++ /dev/null @@ -1,78 +0,0 @@ - - -# Tekton Dash Armageddon - Server Architecture - -## Nakama Backend (`server/nakama/lua/`) - -[Back to top](#top) - - -The backend runs on Nakama, written in Lua. It provides authoritative server-side logic for the economy, anti-cheat, mail, and gacha pulls. - -Godot clients call these endpoints via `BackendService.api_rpc_async()`. - -### Key Lua Modules - -[Back to top](#top) - -- **`economy.lua`:** - - `buy_currency`: Validates mock/Google/Apple receipts and directly adds Gold or subtracts Gold for Stars via `nk.wallet_update`. - - `purchase_item`: Buys cosmetic items from the shop catalog. Validates wallet funds and writes to `inventory` storage. -- **`gacha.lua`:** - - `perform_gacha_pull`: Reads banner drop rates, rolls RNG on the server, manages pity counters, and deducts the pull cost from the wallet. Prevents client-side RNG manipulation. -- **`inbox.lua`:** - - `get_mail` / `claim_mail_reward`: Server-authoritative mail system. Rewards attached to mail are granted directly to the wallet on claim. -- **`user.lua` & `admin.lua`:** - - `admin_topup_gold`: Admin-only RPC to grant 999,999 gold. - - `admin_ban_player`: Banning tool. - - Profile and friend sync logic. - -## Client / Server Wallet Synchronization - -[Back to top](#top) - - -There is **only one authoritative wallet** per user stored on the Nakama backend. - -1. Lua calls `nk.wallet_update(changeset)` upon any transaction. -2. The Godot client calls `UserProfileManager._reload_wallet()`. -3. Godot fetches the new JSON string from `account.wallet`. -4. `UserProfileManager` emits `profile_updated`. -5. All connected UI components (Lobby Top Bar, Shop Panel, Gacha Panel) instantly update their text labels to reflect the unified `gold` and `star` balances. - -## CI/CD and Hot-Patching Pipeline (`.gitea/workflows/`) - -[Back to top](#top) - - -The game features two distinct automated deployment pipelines. - -### Full Releases (`ci.yml`) - -[Back to top](#top) - -- **Trigger:** Pushing a git tag (e.g. `v3.0.0`). -- **Purpose:** Compiling heavy native binaries (Windows `.exe`, Linux binaries, macOS `.app`). -- **Flow:** - 1. Clones repository. - 2. Pulls cached Godot 4.7 binary and export templates from `/cache/` on the runner to skip the 1.3GB download. - 3. Runs `godot --headless --export-release` for each platform. - 4. Zips outputs and uploads to Gitea's release asset API. -- **Player Experience:** Must download and replace their entire game folder/executable. - -### Hot-Patching (`deploy_patch.yml`) - -[Back to top](#top) - -- **Trigger:** Manual `workflow_dispatch` button from the Gitea UI. -- **Purpose:** Pushing lightweight Godot asset changes (Scripts, Scenes, VFX, Sounds) instantly. -- **Flow:** - 1. Python script `generate_version_json.py` consumes `CHANGELOG_DRAFT.md` and bumps `version.json`. - 2. Runs `godot --headless --export-pack` to build a single, shared `patch.pck` file. - 3. Force-pushes `patch.pck` and `version.json` to the orphan `patches` git branch. - 4. A `gitea-pages` Docker container serves this branch publicly at `https://raw.klud.top`. -- **Player Experience:** - 1. Game boots to `boot_screen.tscn`. - 2. Fetches `https://raw.klud.top/danchie/tekton/version.json`. - 3. Downloads `patch.pck` if the version is newer. - 4. Mounts it into `user://` to override the base `res://` filesystem seamlessly.