This commit is contained in:
2025-12-10 02:35:17 +08:00
parent fe4c3eddb8
commit 58d28366bb
19 changed files with 2117 additions and 0 deletions
+93
View File
@@ -0,0 +1,93 @@
# Mobile Update System
This document explains how the in-game update system works for mobile platforms (Android/iOS).
## How It Works
```
┌─────────────────────────────────────────────────────────────┐
│ BOOT SCREEN │
│ ┌─────────────────┐ │
│ │ Check for │──→ No update? ──→ Proceed to game │
│ │ updates │ │
│ └────────┬────────┘ │
│ │ │
│ ▼ Update available │
│ ┌─────────────────────────────────────┐ │
│ │ Can patch in-app? │ │
│ │ YES → Show "Update Now" button │ │
│ │ NO → Show "Open Store" button │ │
│ └─────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
```
## Platform Behavior
| Platform | Update Method | Notes |
|----------|---------------|-------|
| Windows | External launcher | Use TektonLauncher.exe |
| Linux | External launcher | Use TektonLauncher |
| macOS | External launcher | Use TektonLauncher.app |
| Android | In-game patching | Downloads PCK files |
| iOS | In-game patching | Downloads PCK files |
| Web | N/A | Always uses latest deployed version |
## Key Files
- `scripts/managers/game_update_manager.gd` - Core update logic
- `scripts/ui/boot_screen.gd` - Update UI controller
- `scenes/boot_screen.tscn` - Boot screen scene
## Setting Up
### 1. Set Boot Screen as Main Scene (for mobile builds)
For mobile exports, you may want to use `boot_screen.tscn` as the main scene:
- Go to Project > Project Settings > Application > Run
- Set `Main Scene` to `res://scenes/boot_screen.tscn`
Alternatively, keep your current main scene and call the update manager manually.
### 2. Configure URLs
Edit `scripts/managers/game_update_manager.gd`:
```gdscript
const VERSION_MANIFEST_URL := "https://your-server.com/version.json"
const ANDROID_STORE_URL := "https://play.google.com/store/apps/details?id=com.yourcompany.tekton"
const IOS_STORE_URL := "https://apps.apple.com/app/tekton/id123456789"
```
### 3. Using minimum_app_version
In `version.json`, set `minimum_app_version` to force store updates:
```json
{
"latest_version": "1.2.0",
"minimum_app_version": "1.1.0"
}
```
If a user has version 1.0.0, they'll be directed to the store since in-app patching can't upgrade from below the minimum.
## Creating Mobile Patches
1. Export your game changes as a PCK file from Godot
2. Upload to your hosting (same as desktop patches)
3. Update `version.json` with `pck_android` and `pck_ios` entries
```json
"pck_android": {
"url": "https://your-server.com/patches/tekton-1.2.0-android.pck",
"size": 5242880,
"checksum_md5": "abc123..."
}
```
## Limitations
- **Cannot update native code** - Engine/plugin changes require store update
- **Cannot update main executable** - Only assets and GDScript
- **Storage space** - Patches accumulate in user://patches/
- **iOS App Store rules** - Be careful about downloading executable content