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.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
feat(mcp): a connect dialog for AI tools, with the permission decided by the editor (desktop ac014832)
yhh7d70d7c03d3c
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 993fe02cc..c4c168f1e 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -52,7 +52,7 @@ published separately; it ships inside the editor.- **Shaders that compile without stopping the frame.** `quality.asyncShaderCompile` (off unless a game turns it on): a draw whose shader the browser is still compiling is left out until it is ready, and every shader asked for in the meantime compiles at once, where before each was waited for in turn. On a first visit the Terrain & Water example's shaders took 43 seconds of a frozen page on Chrome and D3D11 (the heavy lit ones 3 to 10 seconds each, the worst frame 10 seconds); with this on the page was blocked for about a second in all and the whole scene was drawn at 20 seconds, not 56. The same scene, once everything has compiled, is the same picture. `renderer_getPendingShaders()` says how many are still compiling, for a loading screen. Off, nothing changes. WebGL2 only (a WebGPU pipeline is not compiled this way). With `quality.prewarmShaders` (and `prewarmTimeoutMs`, default 30 s) a packaged game draws its first scene out of sight behind the loading screen until nothing is compiling, and opens complete; `warmShaders(app)` does the same from code, `shadersCompiled(module)` waits for the queue, and a scene prepared ahead (`readyRenderPrograms`) now claims its programs ready only once they have compiled. The lit shaders also link about 23% faster on a first visit: a light that comes from the tiles no longer carries a second copy of the shadow lookup in the program.- **A depth prepass for the opaque scene.** A quality level can draw the opaque meshes twice, depth alone first, so a pixel is shaded for the surface that is in front of it and not for every one drawn there on the way: `QualityProfile.depthPrepass` (on for `high` and `medium`, off for `low` and with the quality system off), and `renderer_setDepthPrepass` for a host without one. Cut-out leaves take part, with the coverage their own shader writes. A surface whose material bends its vertices with a hook takes part too, unless it is also a cut-out. On the Terrain & Water example, on an RTX 3060, a frame is 4 to 39 ms shorter, most where trees stand thick.- **A third mesh for a plant.** A part of a world's plants can name `lod2Mesh` and its kind `lod2Distance`: past that distance the third mesh stands in for the cheaper one, until the kind stops being drawn as itself. The Terrain & Water example's trees have one (a tenth of the triangles, made by `tools/plant-lod2.mjs`) from 80 m, which takes 9 to 15 ms off a frame on an RTX 3060 where trees stand between 60 and 170 m. `tools/terrain-water-cost.mjs` measures what each part of that example costs a frame headless, and `docs/TERRAIN_WATER_GPU_COST.md` has the numbers.-- **The editor adds itself to the AI tools on the machine.** Settings → External Agents has an "Add to …" switch for each installed Claude Code, Cursor and Claude Desktop: it writes only `mcpServers.estella` into that tool's config (the rest of the file is kept, an unparseable file is refused rather than overwritten), opens the agent endpoint, and its value is read off the file, so removing the entry by hand turns it off. The entry runs the bundled front on the editor's own executable, so no Node.js install or path lookup is needed, and "Let AI agents change the project" decides whether it carries write permission.+- **Connect AI tools to the editor from one dialog.** Window → Connect AI Tools… (also the status-bar mark and Settings) lists the Claude Code, Cursor, Claude Desktop and VS Code on the machine with a Connect / Disconnect button each. Connecting writes only the `estella` entry (the rest of the file is kept, an unparseable file is refused); Claude Code is written by its own CLI so a running session does not lose edits, and the others by merging their JSON in their own shape. The entry runs the bundled front on the editor's own executable, so no Node.js install or path lookup is needed. What an agent may do is the editor's to grant live: Read only / Can edit is asked of the editor over `/policy` and a change reaches every connected tool at once, with no entry rewritten and no restart. The dialog reports the last call that landed and which tool made it, and tools the editor cannot write for get the same entry as text to copy (JSON, TOML, command).- **A generated world on worker threads.** A planet provider can give the engine its generator as `workerSource` (the text of a self-contained module), and the world's placements and the planet's pages (heights, normals, and the paint by the biomes) are then worked out by a pool of workers (`runtime/jobs.ts`), byte for byte what the main thread works out, while the main thread only puts each answer in the world as it arrives. Laying out a planet's world no longer costs the frame: 2 to 8 frames a second while it was laid out became 60.- **A flat world's generation on worker threads too.** Laying out a `WorldGen` over a `Terrain` (a field or noise ground, with its baked water) is worked out by the same pool of workers, from the ground and the water handed over as data, byte for byte what the main thread works out. Stopping the terrain-water example no longer leaves the editor at 2 frames a second: it is back at 60.- **A planet's sea and sky.** `Planet.sea` draws a translucent, lit sphere at `seaLevel` in which the ground that dips below it stands, and `skyAtmosphere` takes the planet's radius and centre (`u_planetRadius`, `u_planetX/Y/Z`, as `heightFog` does) to work the sky out in the frame of the ground the camera stands on, so the horizon, the sun and the haze follow it round.diff --git a/desktop b/desktopindex b2cb78f33..ac014832e 160000--- a/desktop+++ b/desktop@@ -1 +1 @@-Subproject commit b2cb78f33cb887c4f671bf92089c34311f7f2a68+Subproject commit ac014832ebc9ab0088f978c661855502911798f0diff --git a/docs/astro/src/content/docs/agents/mcp.mdx b/docs/astro/src/content/docs/agents/mcp.mdxindex 2ebff8158..a0d7d4d03 100644--- a/docs/astro/src/content/docs/agents/mcp.mdx+++ b/docs/astro/src/content/docs/agents/mcp.mdx@@ -22,16 +22,24 @@ Save. You can watch it work in the editor window, and take over at any time.### One-click add-Under **Settings → Editor → Tools & AI → External Agents** there is an "Add to …" switch-for each of Claude Code, Cursor and Claude Desktop that is installed on the machine.-Turning it on writes the editor into that tool's MCP config (only `mcpServers.estella`;-everything else in the file is kept) and opens "Allow AI agents to connect". Turning it-off removes just that entry. The switch shows what the file actually holds, so deleting-the entry by hand turns it off.--The entry runs the bundled script on the editor's own executable, so **no Node.js install-is needed** and there is no path to look up. "Let AI agents change the project" is off by-default: an agent can only look until you turn it on, and entries already added follow it.+**Window → Connect AI Tools…** (also the "AI agent" mark in the status bar, and the+"Connect an AI tool…" button in Settings) opens the connect dialog. It lists the+Claude Code, Cursor, Claude Desktop and VS Code installed on the machine, each with a+Connect / Disconnect button: connecting writes the editor into that tool's own MCP+config (only the `estella` entry; everything else in the file is kept) and opens+"Allow AI agents to connect". The state is read off the config, so deleting the entry+by hand shows it as not connected. A config file it cannot parse is refused, never+overwritten.++- **No Node.js install needed** — the entry runs the bundled script on the editor's+ own executable.+- **What an agent may do** is switched in the dialog: Read only / Can edit. The editor+ decides it live and the entries carry no permission, so a change reaches every+ connected tool at once, with no restart and no config rewritten.+- **Whether it really connected** is the line at the bottom: "Last call: Claude Code,+ 12 s ago". An entry being written does not mean the tool uses it; that line does.+- Tools the editor cannot write for (Windsurf, Zed, Codex…) get the same entry as text+ under "Other tools" — JSON, TOML or a command, paths filled in — to copy.The manual setup below is for tools the switches do not cover.diff --git a/docs/astro/src/content/docs/zh-cn/agents/mcp.mdx b/docs/astro/src/content/docs/zh-cn/agents/mcp.mdxindex e8629dcb5..68f0563b3 100644--- a/docs/astro/src/content/docs/zh-cn/agents/mcp.mdx+++ b/docs/astro/src/content/docs/zh-cn/agents/mcp.mdx@@ -20,14 +20,22 @@ Claude Code、Cursor,或你自己写的代理——都能驱动真实的编辑### 一键加入-打开**设置 → 编辑器 → 工具与 AI → 外部代理**,对本机已安装的 Claude Code、Cursor、-Claude Desktop 各有一个"加入 …"开关。打开它,编辑器就把自己写进那个工具的 MCP 配置-(只动 `mcpServers.estella` 这一条,其余内容原样保留),并同时开启"允许 AI 代理连接"。-关掉开关只移除这一条。开关反映的是配置文件里的实际内容,所以手动删掉条目后它会自己变回关闭。--写入的条目用编辑器自己的可执行文件运行内置脚本,**不需要另装 Node.js**,也不用找路径。-"允许 AI 代理修改项目"默认关闭:不开时代理只能查看;开启后已加入的条目会自动更新。-+菜单**窗口 → 连接 AI 工具…**(或状态栏上的"AI 代理"标记、设置里"连接 AI 工具…"按钮)+打开连接对话框。它会列出本机已安装的 Claude Code、Cursor、Claude Desktop、VS Code,+每个一个"连接 / 断开"按钮:连接就是把编辑器写进那个工具自己的 MCP 配置(只动+`estella` 这一条,其余内容原样保留),并同时开启"允许 AI 代理连接"。状态读的是配置文件+里的实际内容,所以手动删掉条目后它会自己变回"未连接"。配置文件读不懂时,编辑器会拒绝写入,+不会覆盖你的文件。++- **不需要另装 Node.js**:写进去的条目用编辑器自己的可执行文件运行内置脚本。+- **代理权限**在对话框里切换:只读 / 可修改。它由编辑器实时决定,条目里不带权限,+ 所以切换立即对所有已连接的工具生效,不需要重启它们,也不会改写它们的配置。+- **是否真的连上了**看对话框底部:"最近一次调用:Claude Code,12 秒前"。条目写进去不等于+ 工具在用它,这一行才是证据。+- Windsurf、Zed、Codex 等编辑器不能替你写的工具,在"其它工具"里给出同一条配置的现成文本+ (JSON、TOML 或命令),路径已填好,复制即可。++下面是手动配置,用于一键加入覆盖不到的情况。下面是手动配置,用于一键加入覆盖不到的工具。MCP 服务器是随编辑器一起分发的一个小 node 脚本。它对你的 AI 工具讲 stdio MCP,