feat : update readme
This commit is contained in:
@@ -3,61 +3,106 @@
|
|||||||
|
|
||||||
## 🛠️ Developer Workflows
|
## 🛠️ Developer Workflows
|
||||||
|
|
||||||
### 1. Creating a Skin Material
|
### Creating a Skin Material
|
||||||
To create dynamic, color-maskable 3D materials for new character skins:
|
To create dynamic, color-maskable 3D materials for new character skins:
|
||||||
1. Open the **Skin Shader Generator** tool in the editor: `res://scenes/tools/skin_shader_generator.tscn`
|
- Open the **Skin Shader Generator** tool in the editor: `res://scenes/tools/skin_shader_generator.tscn`
|
||||||
2. Run the scene.
|
- Run the scene.
|
||||||
3. Import your base albedo and mask textures.
|
- Import your base albedo and mask textures.
|
||||||
4. Use the UI to visualize UV overlays and adjust color channels (Red, Green, Blue, Alpha masks).
|
- Use the UI to visualize UV overlays and adjust color channels (Red, Green, Blue, Alpha masks).
|
||||||
5. Export the configured material as a `.tres` file into the `assets/materials/skins/` directory.
|
- Export the configured material as a `.tres` file into the `assets/materials/skins/` directory.
|
||||||
|
|
||||||
### 2. Adding a Skin to the Shop
|
### Adding a Skin to the Shop
|
||||||
Once your material is ready, you need to add it to the game's economy so players can buy and equip it. This is done by updating the Nakama backend module.
|
Once your material is ready, you need to update the game's catalog and deploy the changes to the Nakama server.
|
||||||
|
|
||||||
1. **Copy the latest script:** Open `server/nakama/tekton_admin.js` locally and copy its updated contents (including your new skin).
|
#### Using the Catalog Editor Tool
|
||||||
2. **Connect to your VPS** via SSH.
|
- Open the **Skin Catalog Editor** tool in the Godot Editor: `res://scenes/tools/skin_catalog_editor.tscn`
|
||||||
3. **Create/Edit the file on the remote server:**
|
- Press **F6** (or Right-click -> Run Current Scene).
|
||||||
|
- **Manage Skins:**
|
||||||
|
- Click **"+ New Skin"** to create a new entry.
|
||||||
|
- Fill in the **ID**, **Name**, **Category**, and **Price** (Gold/Stars).
|
||||||
|
- Assign the `.tres` material path generated in Step 1.
|
||||||
|
- Click **"💾 Save & Generate"**. This automatically rewrites:
|
||||||
|
- `res://scripts/managers/skin_manager.gd` (Local catalog)
|
||||||
|
- `res://server/nakama/tekton_admin.js` (Server-side shop logic)
|
||||||
|
|
||||||
|
#### Nakama VPS Deployment
|
||||||
|
After generating the updated `tekton_admin.js` locally, you must sync it with your remote server.
|
||||||
|
|
||||||
|
- **Copy the latest script:** Open `server/nakama/tekton_admin.js` locally and copy its updated contents (including your new skin).
|
||||||
|
- **Connect to your VPS** via SSH.
|
||||||
|
- **Create/Edit the file on the remote server:**
|
||||||
```bash
|
```bash
|
||||||
nano ~/tekton_admin.js
|
nano ~/tekton_admin.js
|
||||||
# Or use micro (recommended): micro ~/tekton_admin.js
|
# Or use micro (recommended): micro ~/tekton_admin.js
|
||||||
```
|
```
|
||||||
Paste the copied contents and save the file.
|
Paste the copied contents and save the file.
|
||||||
4. **Find your Nakama Container ID:**
|
- **Find your Nakama Container ID:**
|
||||||
It is highly recommended to use **lazydocker** to manage containers.
|
It is highly recommended to use **lazydocker** to manage containers.
|
||||||
*(To install on Ubuntu: `curl https://raw.githubusercontent.com/jesseduffield/lazydocker/master/scripts/install_update_linux.sh | bash`)*
|
*(To install on Ubuntu: `curl https://raw.githubusercontent.com/jesseduffield/lazydocker/master/scripts/install_update_linux.sh | bash`)*
|
||||||
Open lazydocker or run `docker ps` to find the Container ID for your Nakama server.
|
Open lazydocker or run `docker ps` to find the Container ID for your Nakama server.
|
||||||
5. **Copy the file into the Nakama container:**
|
- **Copy the file into the Nakama container:**
|
||||||
```bash
|
```bash
|
||||||
# Replace ed21ac5d442a with your actual Container ID
|
# Replace ed21ac5d442a with your actual Container ID
|
||||||
docker cp ~/tekton_admin.js ed21ac5d442a:/nakama/data/modules/tekton_admin.js
|
docker cp ~/tekton_admin.js ed21ac5d442a:/nakama/data/modules/tekton_admin.js
|
||||||
```
|
```
|
||||||
6. **Restart the container** (via lazydocker or `docker restart <Container ID>`) for Nakama to load the new modules. Live game clients will fetch this new catalog automatically upon booting.
|
- **Restart the container** (via lazydocker or `docker restart <Container ID>`) for Nakama to load the new modules. Live game clients will fetch this new catalog automatically upon booting.
|
||||||
|
|
||||||
### 3. Pushing a New Version (Automated Patching)
|
#### 🎨 Skin Creation & Deployment Flow
|
||||||
|
```mermaid
|
||||||
|
flowchart TD
|
||||||
|
%% Creation Phase
|
||||||
|
subgraph phase1 [Skin Material Creation]
|
||||||
|
A[Albedo & Mask Textures] --> B{Skin Shader Generator}
|
||||||
|
B -->|Export| C[material.tres]
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Catalog Phase
|
||||||
|
subgraph phase2 [Catalog Definition]
|
||||||
|
C --> D{Skin Catalog Editor}
|
||||||
|
D -->|Save & Generate| E[tekton_admin.js]
|
||||||
|
D -->|Save & Generate| F[skin_manager.gd]
|
||||||
|
end
|
||||||
|
|
||||||
|
%% Deployment Phase (Dual Path)
|
||||||
|
subgraph phase3 [Shop Backend (VPS)]
|
||||||
|
E -->|SSH & nano| G[VPS: ~/tekton_admin.js]
|
||||||
|
G -->|docker cp| H[Nakama Container]
|
||||||
|
H -->|Restart| I[Live Shop Logic Sync]
|
||||||
|
end
|
||||||
|
|
||||||
|
subgraph phase4 [Asset Delivery (CI/CD)]
|
||||||
|
C --> J[Git Push]
|
||||||
|
F --> J
|
||||||
|
J -->|GitHub Actions| K[patch.pck]
|
||||||
|
K -->|Automatic Download| L[Player Client Assets Sync]
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
|
### Pushing a New Version (Automated Patching)
|
||||||
When you're ready to deploy new features or assets to players:
|
When you're ready to deploy new features or assets to players:
|
||||||
1. Document your changes in `CHANGELOG_DRAFT.md` using player-friendly language.
|
- Document your changes in `CHANGELOG_DRAFT.md` using player-friendly language.
|
||||||
2. Run the version generation script from the terminal:
|
- Run the version generation script from the terminal:
|
||||||
```bash
|
```bash
|
||||||
python generate_version_json.py --bump patch
|
python generate_version_json.py --bump patch
|
||||||
```
|
```
|
||||||
*(Use `--bump minor` or `--bump major` for larger updates.)*
|
*(Use `--bump minor` or `--bump major` for larger updates.)*
|
||||||
3. Commit and push your changes to the `main` branch on GitHub:
|
- Commit and push your changes to the `main` branch on GitHub:
|
||||||
```bash
|
```bash
|
||||||
git add .
|
git add .
|
||||||
git commit -m "Release version X.Y.Z"
|
git commit -m "Release version X.Y.Z"
|
||||||
git push origin main
|
git push origin main
|
||||||
```
|
```
|
||||||
4. The **GitHub Actions Workflow** (`deploy_patch.yml`) will automatically detect the push, build the patch manifest (`version.json`), and deploy it to the public `gh-pages` branch.
|
- The **GitHub Actions Workflow** (`deploy_patch.yml`) will automatically detect the push, build the patch manifest (`version.json`), and deploy it to the public `gh-pages` branch.
|
||||||
5. Live game clients will detect the new version on boot, download the updated files, and apply the patch seamlessly.
|
- Live game clients will detect the new version on boot, download the updated files, and apply the patch seamlessly.
|
||||||
|
|
||||||
### 4. Local Testing & Understanding the Patch System
|
### Local Testing & Understanding the Patch System
|
||||||
When a player (or you) downloads an in-game patch, Godot downloads a `patch.pck` file to the system's `user://` directory.
|
When a player (or you) downloads an in-game patch, Godot downloads a `patch.pck` file to the system's `user://` directory.
|
||||||
- **Virtual File System:** Godot mounts this `.pck` file over the `res://` directory purely in memory. **It does not physically overwrite your local source files** (like `assets/data/version.json`).
|
- **Virtual File System:** Godot mounts this `.pck` file over the `res://` directory purely in memory. **It does not physically overwrite your local source files** (like `assets/data/version.json`).
|
||||||
- **Editor Bypass:** When testing locally in the Godot Editor, the `BootScreen` is configured to skip the remote network download and instead automatically parse your *local* `assets/data/version.json`.
|
- **Editor Bypass:** When testing locally in the Godot Editor, the `BootScreen` is configured to skip the remote network download and instead automatically parse your *local* `assets/data/version.json`.
|
||||||
- **Previewing Changelogs:** To preview how your changelog will look before pushing to GitHub:
|
- **Previewing Changelogs:** To preview how your changelog will look before pushing to GitHub:
|
||||||
1. Add your notes under the `## [NEXT]` section in `CHANGELOG_DRAFT.md`.
|
- Add your notes under the `## [NEXT]` section in `CHANGELOG_DRAFT.md`.
|
||||||
2. Run `py tools/generate_version_json.py` from the terminal.
|
- Run `py tools/generate_version_json.py` from the terminal.
|
||||||
3. Run the `BootScreen` scene in the Godot Editor. It will instantly display the updated local UI!
|
- Run the `BootScreen` scene in the Godot Editor. It will instantly display the updated local UI!
|
||||||
- **Syncing:** After the GitHub Actions CI builds a release online, remember to run `git pull origin main` to sync your local project files with the CI-generated files.
|
- **Syncing:** After the GitHub Actions CI builds a release online, remember to run `git pull origin main` to sync your local project files with the CI-generated files.
|
||||||
|
|
||||||
#### 🗺️ Architecture Flowchart
|
#### 🗺️ Architecture Flowchart
|
||||||
|
|||||||
Reference in New Issue
Block a user