nomadro/apps/minigame/小游戏工程说明.md
Eric 58a845db32 Add WeChat minigame triple-engine scaffold with Godot Chiang Mai plaza SoT.
Unity and Cocos stay as parallel schemes; apps/minigame ships the Godot 4.7 WeChat pack for DevTools.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-06 20:17:14 +08:00

39 lines
1.4 KiB
Markdown
Raw Permalink 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.

## 4.7 小游戏工程目录说明
## 源码目录介绍
```
----godot-loader.js //引擎加载器
+---engine
| empty-tips.bin //Godot 分包插件导出的主包
| game.js //godot 引擎主程序
| godot-sdk.js //godot适配微信sdk
| godot.js //godot 引擎主程序
| godot.wasm.br //wasm文件
|
+---subpackages
| +---subpack
| subpack.bin //Godot 分包插件导出的分包,运行时由 godot_subpack_runtime 加载
| game.js //微信小游戏要求每个分包根目录必须有入口文件,空文件即可
|
+---images
background.jpg //游戏背景图片
logo.png //游戏logo图片
```
## 分包运行方式
Godot 工程里使用 `addons/godot_subpack_runtime/subpack_runtime.gd`:
```gdscript
var runtime := SubpackRuntime.new()
runtime.load_manifest()
await runtime.ensure_subpack_with_dependencies("subpack")
```
在微信小游戏中,运行时会调用 `GODOTSDK.load_pack()` 先加载 `game.json` 中声明的同名微信分包,再执行 `ProjectSettings.load_resource_pack()` 挂载 `.bin`。
`subpackages/<分包名>/game.js` 不需要手写,导出整理脚本会自动生成。
## 其它说明
ios运行请在小游戏后台开通高性能+模式, 操作方法: 功能->游戏能力地图->研发能力->生成提效包->高性能模式