Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

docs: desktop ships a runnable app, and Steam has a page

esengine7bce099bd66f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d52aa89c9..20c337adc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,37 @@ published separately; it ships inside the editor.
### Added
+- **Desktop is a real target: one export, an app per OS, and a Steam channel.**
+ The desktop build used to be an Electron source tree you were expected to `npm
+ install` and package yourself — the only target in the repository that handed
+ its toolchain to the user. It is now the same three-layer path the phones take:
+ a prebuilt runtime template (a native host on SDL3 with Dawn and QuickJS
+ embedded, no Chromium), a pure-Node assembler, and a runnable build out the
+ other side. Windows and macOS templates are published with each release, so an
+ installed editor can package a desktop game with nothing else on the machine.
+
+ One export assembles an app for *every* desktop template installed, not for the
+ OS doing the building: the assembler never cared which OS ran it, and a Steam
+ upload normally carries all of them at once. Signing a `.app` is the one thing
+ that genuinely needs a Mac, and that is a warning on that one output.
+
+ Steam rides the desktop target as a *channel*, not as a platform — it defines
+ no runtime, no renderer and no asset format, only where a build goes. Selecting
+ it writes the SteamPipe depot scripts and a `STEAM.md` carrying this build's own
+ values: the depot ids, the launch string, the Auto-Cloud paths the game really
+ writes to, and the achievement ids to create in the partner backend. The first
+ run is always a preview, and `steam_appid.txt` is absent by construction rather
+ than by an exclusion rule someone has to maintain.
+
+ `Achievements` is an engine service like `Ads` and `Leaderboard`: it works with
+ no store behind it (unlocks are recorded locally — the same data a game's own
+ achievements screen reads), `available` says whether a store will also hear
+ about it, and an id outside the project's declared set is refused where it
+ happens instead of being accepted and silently dropped. Steam is one provider
+ behind it, reached by loading the redistributable at run time and resolving the
+ flat C API, so the engine binary contains no Valve code and no Valve header —
+ the SDK is the developer's own download, named in Project Settings.
+
- **A lost GPU device is now a state the engine recovers from, not a black
screen.** Every backend can lose its device — the browser fires
`webglcontextlost` when the GPU resets or a tab is backgrounded too long,
@@ -166,6 +197,30 @@ published separately; it ships inside the editor.
### Fixed
+- **A macOS game could never have reached Steam.** The host loaded the
+ redistributable by its leaf name, and `dlopen` does not search the executable's
+ directory — it takes a leaf through the system paths and answers "no such file"
+ for a library sitting right next to the binary. The difference only shows once
+ the app is packaged: running the binary out of its build tree happens to work,
+ and a player double-clicking a `.app` does not. The platform now says where its
+ own libraries are and the loader is given a path, which it also names when it
+ fails, because "there is none" and "there is one and I looked elsewhere" read
+ identically otherwise.
+
+- **A Steam depot named an OS the build had not produced.** The desktop export
+ assembled for the machine's own OS and then wrote the depot script with macOS
+ hardcoded, so on Windows it mapped `<Name>.app/*` against a build that had
+ produced `<Name>/` — matching nothing, uploading an empty depot, reporting
+ success, and telling you to launch a bundle that does not exist. Depots now
+ follow what was actually assembled, and the default depot ids are a per-OS
+ table rather than a position in the build, so adding a second platform cannot
+ renumber a depot a project already uploaded to.
+
+- **A packaged desktop app weighed nothing, and everything twice.** The size
+ report treated the app as a file, and `stat` on a directory answers a few dozen
+ bytes of bookkeeping — so the deliverable passed every limit while its contents
+ were counted a second time as loose files beside it.
+
- **A collider switched off was still solid.** Every collider carries an `enabled`
flag — authored in the inspector, serialized, documented as "disable the shape"
— that nothing read. The shape attach re-added each present collider
diff --git a/docs/astro/astro.config.mjs b/docs/astro/astro.config.mjs
index af7b62b8e..e680e2831 100644
--- a/docs/astro/astro.config.mjs
+++ b/docs/astro/astro.config.mjs
@@ -290,6 +290,7 @@ export default defineConfig({
items: [
{ label: 'Overview', translations: { 'zh-CN': '总览' }, slug: 'publishing/overview' },
{ label: 'Android & iOS', translations: { 'zh-CN': 'Android 与 iOS' }, slug: 'publishing/android-ios' },
+ { label: 'Steam', translations: { 'zh-CN': 'Steam' }, slug: 'publishing/steam' },
{ label: 'WeChat MiniGame', translations: { 'zh-CN': '微信小游戏' }, slug: 'publishing/wechat' },
{ label: 'Mini-Game Platforms', translations: { 'zh-CN': '小游戏平台' }, slug: 'publishing/minigame-platforms' },
{ label: 'Hot Update', translations: { 'zh-CN': '热更新' }, slug: 'publishing/hot-update' },
diff --git a/docs/astro/src/content/docs/publishing/overview.mdx b/docs/astro/src/content/docs/publishing/overview.mdx
index 6eb9b314f..10215d269 100644
--- a/docs/astro/src/content/docs/publishing/overview.mdx
+++ b/docs/astro/src/content/docs/publishing/overview.mdx
@@ -68,15 +68,17 @@ and opens it in your browser.
| Target | What it produces | Output | Next step |
|---|---|---|---|
| **Web** | A static, self-contained web build. | `dist-web/` | **Preview over http**, or upload the folder to any static host. |
-| **Desktop** | An Electron app source tree. | `dist-desktop/` | `cd dist-desktop && npm install && npm start` — or `npm run dist` for a native `.dmg` / `.exe` / AppImage installer. |
+| **Desktop** | A runnable **native** app per installed desktop template — a `.app` on macOS, a `<Name>/` directory with `<Name>.exe` on Windows. No Chromium and no npm project. | `dist-desktop/` | Double-click it. Selecting the **Steam** channel also writes the depot scripts and a `STEAM.md` with this build's own values — see [Steam](/docs/publishing/steam/). |
| **WeChat** | A WeChat MiniGame package. | `dist-wechat/` | Open the folder in WeChat DevTools and set your AppID. See [WeChat MiniGame](/docs/publishing/wechat/). |
| **Playable** | One self-contained `index.html` with everything inlined — no external requests, as ad networks require. | `dist-playable/` | **Preview over http** (its real surface is an ad-network iframe). Pick the [ad network](#playable-ad-networks) so the CTA and the size check match where it ships. |
| **Android** | Content for a **native** arm64 app (Vulkan) — a real APK, not a WebView. | `dist-android/` | `node build-tools/cli.js native --package --content dist-android` wraps it in a signed APK. See [Android & iOS](/docs/publishing/android-ios/). |
| **iOS** | Content for a **native** arm64 app (Metal), plus the Xcode project when the engine is built for iOS here. | `dist-ios/` | Open the generated Xcode project, pick a signing team, Run. See [Android & iOS](/docs/publishing/android-ios/). |
-The mobile targets export app **content**, not a runnable payload: the engine, the
-SDK and the game runtime live in the app binary. That is also why they need a
-toolchain the other four do not — see [prerequisites](#runtime-prerequisites) below.
+Desktop, Android and iOS export app **content**, not a runnable payload: the
+engine, the SDK and the game runtime live in the app binary. Each is assembled
+from a runtime template the editor installs, so packaging needs no toolchain of
+its own — see [prerequisites](#runtime-prerequisites) below. Only iOS still needs
+Xcode, because only Apple can sign for a device.
## Playable ad networks
diff --git a/docs/astro/src/content/docs/publishing/steam.mdx b/docs/astro/src/content/docs/publishing/steam.mdx
new file mode 100644
index 000000000..c5c550379
--- /dev/null
+++ b/docs/astro/src/content/docs/publishing/steam.mdx
@@ -0,0 +1,137 @@
+---
+title: Steam
+description: Ship an Estella game on Steam — the native desktop build, the depot scripts the export writes, achievements, cloud saves, and the settings only the partner backend holds.
+---
+
+import { Aside, Steps } from '@astrojs/starlight/components';
+
+Steam is a **channel on the desktop target**, not a platform of its own. It defines
+no runtime, no renderer and no asset format — it defines where a desktop build
+goes. So there is no "Steam build": there is a desktop build, and a switch that
+also writes what SteamPipe needs.
+
+The desktop build is a **native app** — the engine's C++ core with an embedded
+[Dawn](https://dawn.googlesource.com/dawn) (Metal on macOS, D3D12 on Windows) and
+[QuickJS-ng](https://github.com/quickjs-ng/quickjs), on SDL3. There is no browser
+in the process, which is also why the Steam overlay, Steam Input and exclusive
+fullscreen behave the way players expect them to.
+
+<Aside type="note" title="One download per editor version">
+ The engine's compiled half is a **runtime template** you install once per editor
+ version (Package Project → the Desktop row). One per OS: install the Windows
+ template on a Mac and the same export produces the Windows build too — the
+ assembler is plain Node and does not care which OS runs it.
+</Aside>
+
+## What you need
+
+<Steps>
+
+1. **A Steamworks app.** An App ID from the partner backend — depots, launch
+ options and achievements live there and no build can write to them.
+
+2. **The Steamworks SDK**, downloaded from the partner site. Estella ships no copy
+ of it: its redistribution is licensed to Steamworks partners, and the runtime
+ template is one prebuilt binary shared by every game made with the engine.
+
+3. **`steamcmd`**, Valve's uploader. Log in with it once in a terminal so Steam
+ Guard is satisfied and cached — nothing in Estella stores a password.
+
+</Steps>
+
+## Setting it up
+
+**Project Settings → Packaging**:
+
+| Setting | What it is |
+|---|---|
+| **Desktop → Channel** | `Steam` — writes the depot scripts beside the build. |
+| **Steam App ID** | From the partner backend. Without it no scripts are written: a script built around a guessed id names someone else's game. |
+| **Steamworks SDK** | The SDK you downloaded. Its `redistributable_bin/<os>/` library ships inside the app. |
+| **Depot IDs** | Leave at 0 to use `App ID + 1`, … Valve *assigns* these; the generated checklist tells you to check them. |
+| **Achievements** | The ids your game unlocks (`packaging.achievements`), platform-neutral — every store has this same list under a different name. |
+
+Then **Package Project → Desktop**. Beside the app you get:
+
+```
+dist-desktop/
+ MyGame.app/ ← macOS, and/or
+ MyGame/ ← Windows: MyGame.exe + Content/
+ steam/
+ app_build_<appid>.vdf
+ depot_<id>_<os>.vdf
+ STEAM.md ← this build's own values
+```
+
+`STEAM.md` is the part worth reading. Generic instructions belong in docs like this
+one; what cannot be looked up is what **this** build needs pasted where — the launch
+executable per OS, the depot ids it used, the Auto-Cloud paths the game really
+writes to, and the achievement ids to create.
+
+## Uploading
+
+```bash
+steamcmd +login <your-account> +run_app_build "…/steam/app_build_<appid>.vdf" +quit
+```
+
+The script is written with `Preview "1"`, so **the first run uploads nothing** — it
+reports what it would do. Remove it to upload for real. `SetLive` is deliberately
+empty: publishing to a branch is a separate decision, made in the backend, and it
+is the one that cannot be undone by uploading again.
+
+<Aside type="caution" title="steam_appid.txt is never written">
+ That file lets a build run outside Steam, and shipping it in a depot disables the
+ check that the game was launched by Steam at all. The export never writes one —
+ it is absent by construction, not by an exclusion rule someone has to maintain.
+</Aside>
+
+## Achievements
+
+`Achievements` is an engine service like `Ads` and `Leaderboard`, so the game's code
+is the same with or without a store:
+
+```ts
+import { Achievements } from 'esengine';
+
+const achievements = world.getResource(Achievements);
+achievements.setStat('enemies_defeated', count);
+await achievements.unlock('FIRST_BLOOD');
+await achievements.store(); // pushes to Steam; stores batch behind this
+```
+
+It always works. With no store behind it the unlock is recorded locally — the same
+data your own achievements screen reads — and `available` tells you whether a store
+will *also* hear about it, which is what a UI reads to decide between the platform's
+toast and drawing its own.
+
+Two ways an achievement silently does nothing, and what the engine does about each:
+
+- **An id the backend does not have.** Steam accepts it and does nothing; a player
+ finds out months later. So ids are declared once in Project Settings, and an
+ unlock outside that set is refused where it happens, listing what *is* declared.
+- **A build with no Steam library.** Point the SDK setting at your download; if it
+ is missing, the export warns and `STEAM.md` says so at the top.
+
+## Cloud saves
+
+`Storage` writes where the OS says it should, which is a path Steam Auto-Cloud can
+sync with no code in the game. Under **Steam Cloud → Auto-Cloud**, use the roots
+`STEAM.md` prints — they are read off what the app actually does, not from a table
+in a document:
+
+| OS | Root | Subdirectory |
+|---|---|---|
+| Windows | `WinAppDataRoaming` | `Estella/<Name>` |
+| macOS | `MacHome` | `Library/Application Support/Estella/<Name>` |
+
+## Honest boundaries
+
+- **macOS builds are signed ad-hoc**, and only on a Mac. Notarize with your own
+ Developer ID before a public release.
+- **Linux is not supported yet** — the desktop host has no Linux surface.
+- **`steamcmd` is not driven from the editor.** The checklist gives you the exact
+ command instead; a feature that cannot be verified here is worse than a line you
+ can copy.
+- Workshop, DLC, microtransactions and Steam Input action sets are not covered.
+ They all hang off the same flat API and the same service surface, but each is its
+ own feature rather than something "Steam support" drags in.
diff --git a/docs/astro/src/content/docs/zh-cn/publishing/overview.mdx b/docs/astro/src/content/docs/zh-cn/publishing/overview.mdx
index f5e9ee092..3687f454c 100644
--- a/docs/astro/src/content/docs/zh-cn/publishing/overview.mdx
+++ b/docs/astro/src/content/docs/zh-cn/publishing/overview.mdx
@@ -58,14 +58,15 @@ import { Aside, Steps } from '@astrojs/starlight/components';
| 目标 | 产出什么 | 输出 | 下一步 |
|---|---|---|---|
| **Web** | 一个静态、自包含的 Web 构建。 | `dist-web/` | **Preview over http**,或把文件夹上传到任意静态托管。 |
-| **桌面** | 一棵 Electron 应用源码树。 | `dist-desktop/` | `cd dist-desktop && npm install && npm start`——或 `npm run dist` 出原生 `.dmg` / `.exe` / AppImage 安装包。 |
+| **桌面** | 每装了一个桌面运行时模板,就出一个可直接运行的**原生**应用——macOS 上是 `.app`,Windows 上是含 `<Name>.exe` 的 `<Name>/` 目录。没有 Chromium,也没有 npm 工程。 | `dist-desktop/` | 双击即可。选了 **Steam** 渠道还会写出 depot 脚本和一份带本次构建确切取值的 `STEAM.md`——见 [Steam](/docs/zh-cn/publishing/steam/)。 |
| **微信** | 一个微信小游戏包。 | `dist-wechat/` | 在微信开发者工具里打开该文件夹并设置你的 AppID。见 [微信小游戏](/docs/zh-cn/publishing/wechat/)。 |
| **Playable** | 一个自包含的 `index.html`,一切内联——无外部请求(广告平台的要求)。 | `dist-playable/` | **Preview over http**(它的真实宿主是广告平台的 iframe)。先选好[广告平台](#试玩广告平台),CTA 与体积检查才对得上投放目标。 |
| **Android** | **原生** arm64 应用(Vulkan)的内容——真 APK,不是 WebView。 | `dist-android/` | `node build-tools/cli.js native --package --content dist-android` 把它包成已签名的 APK。见 [Android 与 iOS](/docs/zh-cn/publishing/android-ios/)。 |
| **iOS** | **原生** arm64 应用(Metal)的内容;若本机已为 iOS 构建过引擎,还会附带 Xcode 工程。 | `dist-ios/` | 打开生成的 Xcode 工程,选签名 Team,Run。见 [Android 与 iOS](/docs/zh-cn/publishing/android-ios/)。 |
-移动目标导出的是应用**内容**而非可直接运行的载荷:引擎、SDK 和游戏运行时都住在应用二进制里。
-这也是它们需要另外四个目标不需要的工具链的原因——见下文的[前置条件](#运行时前置条件)。
+桌面、Android 与 iOS 导出的是应用**内容**而非可直接运行的载荷:引擎、SDK 和游戏运行时都住在
+应用二进制里。三者都由编辑器安装的运行时模板组装而成,所以打包本身不需要任何工具链——见下文的
+[前置条件](#运行时前置条件)。只有 iOS 仍然需要 Xcode,因为只有 Apple 能为真机签名。
## 试玩广告平台
diff --git a/docs/astro/src/content/docs/zh-cn/publishing/steam.mdx b/docs/astro/src/content/docs/zh-cn/publishing/steam.mdx
new file mode 100644
index 000000000..f085e848d
--- /dev/null
+++ b/docs/astro/src/content/docs/zh-cn/publishing/steam.mdx
@@ -0,0 +1,119 @@
+---
+title: Steam
+description: 把 Estella 游戏发到 Steam——原生桌面构建、导出自动写出的 depot 脚本、成就、云存档,以及只能在合作伙伴后台填的那些值。
+---
+
+import { Aside, Steps } from '@astrojs/starlight/components';
+
+Steam 是**桌面目标下的一个发行渠道**,不是一个单独的平台。它不定义运行时、不定义渲染器、
+不定义资源格式——它定义的是这份构建**去哪儿**。所以没有"Steam 构建"这回事:只有桌面构建,
+外加一个开关,让导出顺带写出 SteamPipe 需要的东西。
+
+桌面构建是**原生应用**——引擎的 C++ 核心,内嵌
+[Dawn](https://dawn.googlesource.com/dawn)(macOS 走 Metal,Windows 走 D3D12)与
+[QuickJS-ng](https://github.com/quickjs-ng/quickjs),窗口与输入来自 SDL3。进程里没有浏览器,
+这也是 Steam 覆盖层、Steam Input 和独占全屏能如玩家预期那样工作的原因。
+
+<Aside type="note" title="每个编辑器版本下载一次">
+ 引擎的已编译部分不在编辑器安装包里,而是一个**运行时模板**,每个编辑器版本装一次
+ (Package Project → Desktop 那一行)。每个 OS 一个:在 Mac 上装了 Windows 模板,
+ 同一次导出就会连 Windows 版一起出——组装器是纯 Node 的,不关心是哪个 OS 在跑它。
+</Aside>
+
+## 你需要什么
+
+<Steps>
+
+1. **一个 Steamworks 应用。** 合作伙伴后台给的 App ID——depot、启动选项和成就都住在那里,
+ 任何构建都写不到。
+
+2. **Steamworks SDK**,从合作伙伴站点自行下载。Estella 不随包携带:它的再分发只授权给
+ Steamworks 合作伙伴,而运行时模板是所有用这个引擎的游戏共用的同一个预编译二进制。
+
+3. **`steamcmd`**,Valve 的上传工具。先在终端里登录一次,让 Steam Guard 通过并缓存下来——
+ Estella 不保存任何密码。
+
+</Steps>
+
+## 怎么配
+
+**Project Settings → Packaging**:
+
+| 设置 | 含义 |
+|---|---|
+| **Desktop → Channel** | 选 `Steam`——构建旁边会写出 depot 脚本。 |
+| **Steam App ID** | 来自合作伙伴后台。不填就什么也不写:用猜出来的 id 生成的脚本指向的是别人的游戏。 |
+| **Steamworks SDK** | 你下载的那份 SDK。它 `redistributable_bin/<os>/` 下的库会被打进应用。 |
+| **Depot ID** | 留 0 则用 `App ID + 1`、+2…。这些由 Valve **分配**,生成的清单会提示你去核对。 |
+| **成就** | 你的游戏会解锁的 id(`packaging.achievements`),**平台中立**——每个商店都有这份同样的清单,只是名字不同。 |
+
+然后 **Package Project → Desktop**。应用旁边会得到:
+
+```
+dist-desktop/
+ MyGame.app/ ← macOS,以及/或者
+ MyGame/ ← Windows:MyGame.exe + Content/
+ steam/
+ app_build_<appid>.vdf
+ depot_<id>_<os>.vdf
+ STEAM.md ← 本次构建的确切取值
+```
+
+值得读的是 `STEAM.md`。通用说明属于本文这样的文档;查不到的是**这一个**构建需要把什么粘到哪里——
+每个 OS 的启动可执行文件、这次用的 depot id、游戏真正写入的 Auto-Cloud 路径,以及要去后台建的成就 id。
+
+## 上传
+
+```bash
+steamcmd +login <你的账号> +run_app_build "…/steam/app_build_<appid>.vdf" +quit
+```
+
+脚本里写着 `Preview "1"`,所以**第一次跑什么也不会上传**——它只报告它会做什么。要真上传就把它去掉。
+`SetLive` 是刻意留空的:发布到某个分支是另一个决定,在后台做,而且那正是无法靠"再传一次"撤销的那个。
+
+<Aside type="caution" title="steam_appid.txt 永远不会被写出">
+ 这个文件的用途是脱离 Steam 跑构建,把它混进 depot 就等于把"这个游戏是不是由 Steam 启动的"
+ 这道检查关掉发出去。导出从不写它——它是**按构造缺席**,而不是靠一条要人维护的排除规则。
+</Aside>
+
+## 成就
+
+`Achievements` 与 `Ads`、`Leaderboard` 一样是**引擎服务**,所以有没有商店,游戏代码都一样:
+
+```ts
+import { Achievements } from 'esengine';
+
+const achievements = world.getResource(Achievements);
+achievements.setStat('enemies_defeated', count);
+await achievements.unlock('FIRST_BLOOD');
+await achievements.store(); // 推到 Steam;商店在这一步后面做批量提交
+```
+
+它永远可用。背后没有商店时,解锁记在本地——那正是你自己的成就界面要读的同一份数据——
+而 `available` 告诉你商店**是否也会**收到,UI 据此决定是用平台的弹窗还是自己画。
+
+成就静默失效有两种方式,引擎各自的处理:
+
+- **后台没有这个 id。** Steam 会接受它然后什么也不做,最后是玩家在几个月后发现。所以 id
+ 在项目设置里声明一次,越界的 unlock 在发生处就被拒绝,并把已声明的清单一并报出来。
+- **包里没有 Steam 库。** 把 SDK 那一项指向你的下载;没有的话导出会警告,`STEAM.md` 开头也会写明。
+
+## 云存档
+
+`Storage` 写在操作系统指定的位置,而那正是 Steam Auto-Cloud 能同步的路径,游戏侧一行代码都不用写。
+在 **Steam Cloud → Auto-Cloud** 里填 `STEAM.md` 打印出来的根目录——它们是照应用**实际写到哪**得出的,
+不是抄自某份文档里的表:
+
+| OS | 根目录 | 子路径 |
+|---|---|---|
+| Windows | `WinAppDataRoaming` | `Estella/<名字>` |
+| macOS | `MacHome` | `Library/Application Support/Estella/<名字>` |
+
+## 诚实边界
+
+- **macOS 构建是 ad-hoc 签名的**,而且只能在 Mac 上签。公开发布前请用你自己的 Developer ID 公证。
+- **Linux 尚未支持**——桌面宿主还没有 Linux 的 surface。
+- **`steamcmd` 没有做进编辑器。** 清单里给出的是可以照抄的确切命令;一个在这里验证不了的功能,
+ 不如一行你能复制的命令诚实。
+- 创意工坊、DLC、内购、Steam Input 动作集不在覆盖范围内。它们都能挂在同一套 flat API 和同一个
+ 服务面上,但每一个都是自己的需求,不该由"支持 Steam 发布"一次性带出来。