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: add v0.3.0 documentation for canvas, spine plugin, embedded assets and changelog

esengine780b733dba2a
diff --git a/docs/astro/astro.config.mjs b/docs/astro/astro.config.mjs
index cb547ead2..7cf5b4162 100644
--- a/docs/astro/astro.config.mjs
+++ b/docs/astro/astro.config.mjs
@@ -65,6 +65,7 @@ export default defineConfig({
translations: { 'zh-CN': '渲染' },
items: [
{ label: 'Overview', translations: { 'zh-CN': '概览' }, slug: 'guides/rendering' },
+ { label: 'Canvas & Resolution', translations: { 'zh-CN': 'Canvas 与分辨率' }, slug: 'guides/canvas' },
{ label: 'Sprite', translations: { 'zh-CN': '精灵' }, slug: 'guides/sprite' },
{ label: 'Spine Animation', translations: { 'zh-CN': 'Spine 动画' }, slug: 'guides/spine' },
{ label: 'Custom Draw', translations: { 'zh-CN': '自定义绘制' }, slug: 'guides/custom-draw' },
@@ -79,6 +80,13 @@ export default defineConfig({
{ label: 'Editor Extensions', translations: { 'zh-CN': '编辑器扩展' }, slug: 'guides/editor-extensions' },
],
},
+ {
+ label: 'Changelog',
+ translations: { 'zh-CN': '更新日志' },
+ items: [
+ { label: 'v0.3.0', slug: 'changelog' },
+ ],
+ },
],
head: [
{
diff --git a/docs/astro/src/content/docs/changelog.mdx b/docs/astro/src/content/docs/changelog.mdx
new file mode 100644
index 000000000..7991bce09
--- /dev/null
+++ b/docs/astro/src/content/docs/changelog.mdx
@@ -0,0 +1,46 @@
+---
+title: v0.3.0
+description: ESEngine v0.3.0 release notes
+---
+
+import { Aside } from '@astrojs/starlight/components';
+
+## Canvas & Camera Scaling
+
+- Added `Canvas` component with 5 scale modes: FixedWidth, FixedHeight, Expand, Shrink, Match
+- `designResolution` and `pixelsPerUnit` for pixel-perfect 2D layout
+- `matchWidthOrHeight` blending factor for the Match scale mode
+- `backgroundColor` for letterbox / pillarbox fill
+- Added `Camera.showFrustum` property to visualize the camera frustum in the editor
+
+## Fixed Timestep
+
+- Fixed schedules (`FixedPreUpdate`, `FixedUpdate`, `FixedPostUpdate`) now execute with a 1/60s accumulator
+- A single frame may trigger zero or multiple fixed steps, ensuring deterministic physics regardless of frame rate
+
+## Modular Spine Runtime
+
+- Spine runtime is no longer bundled in the engine core
+- Standalone WASM modules `spine38` and `spine42` are loaded on demand via `SpinePlugin`
+- Choose the runtime version matching your Spine editor export (`3.8` or `4.2`)
+
+## Embedded Assets (Playable Builds)
+
+- Added `registerEmbeddedAssets()` API to inline assets as data URIs
+- The editor's Playable build pipeline uses this automatically to produce single-file output
+
+## Unified Settings Dialog
+
+- Merged Project Settings and Preferences into a single settings dialog
+
+## Help Menu & Updates
+
+- Improved Help menu with links to documentation and issue tracker
+- Toast notification when a new editor version is available
+
+## Bug Fixes
+
+- Fixed Spine rendering on WeChat MiniGame platform
+- Fixed texture packer omitting certain sprites
+- Fixed default camera not being created in new scenes
+- Fixed F5 preview not launching in some configurations
diff --git a/docs/astro/src/content/docs/core-concepts/systems.mdx b/docs/astro/src/content/docs/core-concepts/systems.mdx
index d2f7ca98f..d63f31527 100644
--- a/docs/astro/src/content/docs/core-concepts/systems.mdx
+++ b/docs/astro/src/content/docs/core-concepts/systems.mdx
@@ -3,6 +3,8 @@ title: Systems
description: Defining systems and scheduling them in ESEngine
---
+import { Aside } from '@astrojs/starlight/components';
+
Systems contain game logic. They declare what data they need via parameters, and ESEngine injects the data automatically. Systems operate on **all entities in the scene** that match the query.
## Defining Systems
@@ -54,6 +56,10 @@ addSystemToSchedule(Schedule.FixedUpdate, physicsSystem);
| `FixedUpdate` | At fixed intervals (physics) |
| `FixedPostUpdate` | At fixed intervals, after FixedUpdate |
+<Aside type="note">
+ The Fixed schedules (`FixedPreUpdate`, `FixedUpdate`, `FixedPostUpdate`) run at a fixed timestep of 1/60s using an accumulator. In a single frame they may execute zero or multiple times depending on the frame duration. Use them for physics and other deterministic logic that requires consistent time steps.
+</Aside>
+
## System Parameters
### Commands
diff --git a/docs/astro/src/content/docs/guides/assets.mdx b/docs/astro/src/content/docs/guides/assets.mdx
index adca7416c..87cdee593 100644
--- a/docs/astro/src/content/docs/guides/assets.mdx
+++ b/docs/astro/src/content/docs/guides/assets.mdx
@@ -164,6 +164,25 @@ const tex = await assets.loadTexture('sprites/player.png');
Absolute paths and full URLs are not affected by `baseUrl`.
+## Embedded Assets
+
+For Playable Ad builds, assets can be embedded directly into the output bundle using `registerEmbeddedAssets`. This eliminates network requests at runtime:
+
+```typescript
+import { registerEmbeddedAssets } from 'esengine';
+
+registerEmbeddedAssets({
+ 'assets/player.png': 'data:image/png;base64,iVBOR...',
+ 'assets/config.json': '{"level":1}',
+});
+```
+
+Once registered, all `assets.loadTexture()` / `assets.loadJson()` calls resolve from the embedded data instead of fetching over the network.
+
+<Aside type="tip">
+ The editor's Playable build pipeline calls `registerEmbeddedAssets` automatically. You only need to call it manually in custom build workflows.
+</Aside>
+
## Next Steps
- [Materials & Shaders](/microes/guides/materials/) — custom shaders and blend modes
diff --git a/docs/astro/src/content/docs/guides/canvas.mdx b/docs/astro/src/content/docs/guides/canvas.mdx
new file mode 100644
index 000000000..a4ea4858d
--- /dev/null
+++ b/docs/astro/src/content/docs/guides/canvas.mdx
@@ -0,0 +1,86 @@
+---
+title: Canvas & Resolution
+description: Screen adaptation with Canvas component in ESEngine
+---
+
+import { Aside } from '@astrojs/starlight/components';
+
+The `Canvas` component controls how your game adapts to different screen sizes. It defines a **design resolution** and a **scale mode** that determines how content scales when the actual screen doesn't match.
+
+## Setup
+
+In the editor, use **Edit → Create Canvas** to add a Canvas entity to your scene. This creates an entity with a `Canvas` component and attaches the active camera.
+
+You can also add the `Canvas` component manually to any entity that has a `Camera`.
+
+## Properties
+
+| Property | Type | Default | Description |
+|----------|------|---------|-------------|
+| `designResolution` | Vec2 | `{x: 1280, y: 720}` | The reference resolution you design your game for |
+| `pixelsPerUnit` | number | `100` | How many pixels equal one world unit |
+| `scaleMode` | number | `0` | Scale strategy (see below) |
+| `matchWidthOrHeight` | number | `0.5` | Blend factor for Match mode (0 = width, 1 = height) |
+| `backgroundColor` | Vec4 | `{x: 0, y: 0, z: 0, w: 1}` | Letterbox/pillarbox fill color |
+
+## Pixels Per Unit
+
+`pixelsPerUnit` defines the mapping between pixel coordinates and world units. With the default value of `100`, a 200×200 pixel sprite occupies 2×2 world units.
+
+Changing this value affects how all pixel-based sizes translate to the world. A higher value means sprites appear smaller in world space.
+
+## Scale Modes
+
+### FixedWidth (0)
+
+Keeps the design width fixed. The visible height adjusts based on aspect ratio.
+
+- Wider screens see more vertical content
+- Good for horizontal scrolling games
+
+### FixedHeight (1)
+
+Keeps the design height fixed. The visible width adjusts based on aspect ratio.
+
+- Wider screens see more horizontal content
+- Good for vertical scrolling games
+
+### Expand (2)
+
+Expands the viewport so both design width and height are always fully visible. May show extra content beyond the design area.
+
+- No content is cropped
+- Players on wider screens see more of the world
+
+### Shrink (3)
+
+Shrinks the viewport so neither dimension exceeds the design resolution. Content outside the design area is cropped.
+
+- All players see the same area at most
+- May crop on non-matching aspect ratios
+
+### Match (4)
+
+Blends between FixedWidth and FixedHeight based on `matchWidthOrHeight`. A value of `0` behaves like FixedWidth, `1` like FixedHeight, and `0.5` balances both.
+
+## TypeScript Access
+
+Query the `Canvas` component in a system:
+
+```typescript
+import { defineSystem, addSystem, Query, Mut, Canvas } from 'esengine';
+
+addSystem(defineSystem(
+ [Query(Mut(Canvas))],
+ (query) => {
+ for (const [entity, canvas] of query) {
+ canvas.scaleMode = 4;
+ canvas.matchWidthOrHeight = 0.5;
+ }
+ }
+));
+```
+
+<Aside type="tip">
+ For most 2D games, start with **FixedHeight** (landscape) or **FixedWidth** (portrait), then switch to **Match** if you need finer control over both axes.
+</Aside>
diff --git a/docs/astro/src/content/docs/guides/rendering.mdx b/docs/astro/src/content/docs/guides/rendering.mdx
index af75dc646..4ee44501b 100644
--- a/docs/astro/src/content/docs/guides/rendering.mdx
+++ b/docs/astro/src/content/docs/guides/rendering.mdx
@@ -24,11 +24,16 @@ A `Camera` component is required to see anything. The editor's default scene alr
| `farPlane` | number | Far clipping plane |
| `isActive` | boolean | Whether this camera is used for rendering |
| `priority` | number | Higher priority camera takes precedence |
+| `showFrustum` | boolean | Draw the camera frustum wireframe in the editor |
### Orthographic Camera
Best for 2D games. The `orthoSize` determines how much of the world is visible. Set `projectionType` to `1` in the inspector.
+### Canvas Integration
+
+For screen adaptation and resolution scaling, attach a `Canvas` component to the camera entity. See [Canvas & Resolution](/microes/guides/canvas/) for setup and scale modes.
+
### Moving the Camera
Query the camera entity and modify its transform:
@@ -101,6 +106,7 @@ Set these values in the inspector when placing entities, or modify them at runti
## Next Steps
+- [Canvas & Resolution](/microes/guides/canvas/) — screen adaptation and scale modes
- [Sprite](/microes/guides/sprite/) — sprite rendering and animation
- [Spine Animation](/microes/guides/spine/) — skeletal animation
- [Custom Draw](/microes/guides/custom-draw/) — immediate-mode drawing for debug visualization and dynamic graphics
diff --git a/docs/astro/src/content/docs/guides/spine.mdx b/docs/astro/src/content/docs/guides/spine.mdx
index ae0aaad49..c1fc23cf8 100644
--- a/docs/astro/src/content/docs/guides/spine.mdx
+++ b/docs/astro/src/content/docs/guides/spine.mdx
@@ -7,6 +7,22 @@ import { Aside } from '@astrojs/starlight/components';
The `SpineAnimation` component plays [Spine](http://esotericsoftware.com/) skeletal animations. Add it to an entity in the scene editor along with `LocalTransform`.
+<Aside type="note">
+ Since v0.3.0, Spine uses standalone WASM modules (`spine38` / `spine42`) instead of being bundled into the engine core. You must register a Spine plugin before using Spine components.
+</Aside>
+
+## Spine Plugin Setup
+
+Initialize the Spine plugin at startup to load the appropriate runtime version:
+
+```typescript
+import { addPlugin, SpinePlugin } from 'esengine';
+
+addPlugin(SpinePlugin({ version: '4.2' }));
+```
+
+`SpinePlugin` accepts `'3.8'` or `'4.2'` to match your Spine editor export version. The plugin downloads the corresponding WASM module on first use.
+
## Properties
| Property | Type | Default | Description |
diff --git a/docs/astro/src/content/docs/zh/changelog.mdx b/docs/astro/src/content/docs/zh/changelog.mdx
new file mode 100644
index 000000000..087fb6ebc
--- /dev/null
+++ b/docs/astro/src/content/docs/zh/changelog.mdx
@@ -0,0 +1,46 @@
+---
+title: v0.3.0
+description: ESEngine v0.3.0 更新日志
+---
+
+import { Aside } from '@astrojs/starlight/components';
+
+## Canvas 与相机缩放
+
+- 新增 `Canvas` 组件,支持 5 种缩放模式:FixedWidth、FixedHeight、Expand、Shrink、Match
+- `designResolution` 和 `pixelsPerUnit` 实现像素级 2D 布局
+- `matchWidthOrHeight` 混合系数用于 Match 缩放模式
+- `backgroundColor` 用于黑边填充颜色
+- 新增 `Camera.showFrustum` 属性,在编辑器中可视化相机视锥
+
+## 固定时间步
+
+- Fixed 系列调度(`FixedPreUpdate`、`FixedUpdate`、`FixedPostUpdate`)现在以 1/60s 累加器执行
+- 单帧内可能触发零次或多次固定步,确保物理模拟不受帧率影响
+
+## 模块化 Spine 运行时
+
+- Spine 运行时不再内置于引擎核心
+- 独立 WASM 模块 `spine38` 和 `spine42` 通过 `SpinePlugin` 按需加载
+- 选择与 Spine 编辑器导出版本匹配的运行时(`3.8` 或 `4.2`)
+
+## 嵌入式资源(Playable 构建)
+
+- 新增 `registerEmbeddedAssets()` API,将资源内联为 data URI
+- 编辑器的 Playable 构建流程自动使用此功能生成单文件输出
+
+## 统一设置对话框
+
+- 合并 Project Settings 和 Preferences 为单一设置对话框
+
+## Help 菜单与更新
+
+- 改进 Help 菜单,包含文档和问题跟踪链接
+- 新版本可用时显示 toast 通知
+
+## Bug 修复
+
+- 修复微信小游戏平台 Spine 渲染问题
+- 修复纹理打包遗漏部分精灵
+- 修复新场景未创建默认相机
+- 修复部分配置下 F5 预览无法启动
diff --git a/docs/astro/src/content/docs/zh/core-concepts/systems.mdx b/docs/astro/src/content/docs/zh/core-concepts/systems.mdx
index b3664b591..69d8069e1 100644
--- a/docs/astro/src/content/docs/zh/core-concepts/systems.mdx
+++ b/docs/astro/src/content/docs/zh/core-concepts/systems.mdx
@@ -3,6 +3,8 @@ title: 系统
description: 在 ESEngine 中定义和调度系统
---
+import { Aside } from '@astrojs/starlight/components';
+
系统包含游戏逻辑。它们通过参数声明需要的数据,ESEngine 自动注入。系统自动操作**场景中所有匹配的实体**。
## 定义系统
@@ -54,6 +56,10 @@ addSystemToSchedule(Schedule.FixedUpdate, physicsSystem);
| `FixedUpdate` | 固定间隔(物理) |
| `FixedPostUpdate` | 固定间隔,FixedUpdate 之后 |
+<Aside type="note">
+ Fixed 系列调度(`FixedPreUpdate`、`FixedUpdate`、`FixedPostUpdate`)以 1/60s 固定步长运行,使用累加器驱动。一帧内可能执行零次或多次,取决于帧时长。适用于物理等需要一致时间步的确定性逻辑。
+</Aside>
+
## 系统参数
### Commands
diff --git a/docs/astro/src/content/docs/zh/guides/assets.mdx b/docs/astro/src/content/docs/zh/guides/assets.mdx
index cc07e425f..1e438b9fd 100644
--- a/docs/astro/src/content/docs/zh/guides/assets.mdx
+++ b/docs/astro/src/content/docs/zh/guides/assets.mdx
@@ -164,6 +164,25 @@ const tex = await assets.loadTexture('sprites/player.png');
绝对路径和完整 URL 不受 `baseUrl` 影响。
+## 嵌入式资源
+
+对于 Playable Ad 构建,可以使用 `registerEmbeddedAssets` 将资源直接嵌入输出包中,避免运行时网络请求:
+
+```typescript
+import { registerEmbeddedAssets } from 'esengine';
+
+registerEmbeddedAssets({
+ 'assets/player.png': 'data:image/png;base64,iVBOR...',
+ 'assets/config.json': '{"level":1}',
+});
+```
+
+注册后,所有 `assets.loadTexture()` / `assets.loadJson()` 调用将从嵌入数据解析,不再发起网络请求。
+
+<Aside type="tip">
+ 编辑器的 Playable 构建流程会自动调用 `registerEmbeddedAssets`。仅在自定义构建流程中才需要手动调用。
+</Aside>
+
## 下一步
- [材质与着色器](/microes/zh/guides/materials/) — 自定义着色器和混合模式
diff --git a/docs/astro/src/content/docs/zh/guides/canvas.mdx b/docs/astro/src/content/docs/zh/guides/canvas.mdx
new file mode 100644
index 000000000..7eaee75b4
--- /dev/null
+++ b/docs/astro/src/content/docs/zh/guides/canvas.mdx
@@ -0,0 +1,86 @@
+---
+title: Canvas 与分辨率
+description: ESEngine 中使用 Canvas 组件进行屏幕适配
+---
+
+import { Aside } from '@astrojs/starlight/components';
+
+`Canvas` 组件控制游戏如何适配不同屏幕尺寸。它定义了一个**设计分辨率**和一个**缩放模式**,决定实际屏幕尺寸不匹配时内容如何缩放。
+
+## 设置
+
+在编辑器中,使用 **Edit → Create Canvas** 向场景添加 Canvas 实体。这会创建一个带有 `Canvas` 组件的实体并关联当前激活的相机。
+
+也可以手动将 `Canvas` 组件添加到任何拥有 `Camera` 的实体上。
+
+## 属性
+
+| 属性 | 类型 | 默认值 | 说明 |
+|------|------|--------|------|
+| `designResolution` | Vec2 | `{x: 1280, y: 720}` | 游戏设计基准分辨率 |
+| `pixelsPerUnit` | number | `100` | 多少像素等于一个世界单位 |
+| `scaleMode` | number | `0` | 缩放策略(见下文) |
+| `matchWidthOrHeight` | number | `0.5` | Match 模式的混合系数(0 = 宽度,1 = 高度) |
+| `backgroundColor` | Vec4 | `{x: 0, y: 0, z: 0, w: 1}` | 黑边填充颜色 |
+
+## Pixels Per Unit
+
+`pixelsPerUnit` 定义像素坐标与世界单位的映射关系。默认值 `100` 时,一个 200×200 像素的精灵占据 2×2 世界单位。
+
+改变此值会影响所有基于像素的尺寸到世界坐标的转换。值越大,精灵在世界空间中越小。
+
+## 缩放模式
+
+### FixedWidth (0)
+
+保持设计宽度不变,可见高度根据屏幕宽高比调整。
+
+- 更宽的屏幕能看到更多垂直内容
+- 适合横向滚动游戏
+
+### FixedHeight (1)
+
+保持设计高度不变,可见宽度根据屏幕宽高比调整。
+
+- 更宽的屏幕能看到更多水平内容
+- 适合纵向滚动游戏
+
+### Expand (2)
+
+扩展视口使设计宽高都完全可见。可能会在设计区域外显示额外内容。
+
+- 不会裁剪任何内容
+- 宽屏玩家能看到更多世界
+
+### Shrink (3)
+
+收缩视口使两个维度都不超过设计分辨率。设计区域外的内容被裁剪。
+
+- 所有玩家最多看到相同的区域
+- 非匹配宽高比时可能裁剪
+
+### Match (4)
+
+根据 `matchWidthOrHeight` 混合 FixedWidth 和 FixedHeight。`0` 表现如 FixedWidth,`1` 如 FixedHeight,`0.5` 则平衡两者。
+
+## TypeScript 访问
+
+在系统中查询 `Canvas` 组件:
+
+```typescript
+import { defineSystem, addSystem, Query, Mut, Canvas } from 'esengine';
+
+addSystem(defineSystem(
+ [Query(Mut(Canvas))],
+ (query) => {
+ for (const [entity, canvas] of query) {
+ canvas.scaleMode = 4;
+ canvas.matchWidthOrHeight = 0.5;
+ }
+ }
+));
+```
+
+<Aside type="tip">
+ 对于大多数 2D 游戏,横屏从 **FixedHeight** 开始,竖屏从 **FixedWidth** 开始,需要更精细的双轴控制时切换到 **Match**。
+</Aside>
diff --git a/docs/astro/src/content/docs/zh/guides/rendering.mdx b/docs/astro/src/content/docs/zh/guides/rendering.mdx
index a5774512f..e0bbd2dd7 100644
--- a/docs/astro/src/content/docs/zh/guides/rendering.mdx
+++ b/docs/astro/src/content/docs/zh/guides/rendering.mdx
@@ -24,11 +24,16 @@ ESEngine 使用基于组件的渲染系统。在场景编辑器中为实体添
| `farPlane` | number | 远裁剪面 |
| `isActive` | boolean | 是否用于渲染 |
| `priority` | number | 高优先级相机优先 |
+| `showFrustum` | boolean | 在编辑器中显示相机视锥线框 |
### 正交相机
2D 游戏最佳选择。`orthoSize` 决定可见的世界范围。在检查器中将 `projectionType` 设为 `1`。
+### Canvas 集成
+
+要进行屏幕适配和分辨率缩放,在相机实体上附加 `Canvas` 组件。详见 [Canvas 与分辨率](/microes/zh/guides/canvas/)。
+
### 移动相机
查询相机实体并修改其 transform:
@@ -101,6 +106,7 @@ transform.scale = { x: -1, y: 1, z: 1 }; // 水平翻转
## 下一步
+- [Canvas 与分辨率](/microes/zh/guides/canvas/) — 屏幕适配与缩放模式
- [精灵](/microes/zh/guides/sprite/) — 精灵渲染和动画
- [Spine 动画](/microes/zh/guides/spine/) — 骨骼动画
- [自定义绘制](/microes/zh/guides/custom-draw/) — 即时模式绘图,用于调试可视化和动态图形
diff --git a/docs/astro/src/content/docs/zh/guides/spine.mdx b/docs/astro/src/content/docs/zh/guides/spine.mdx
index df6f82758..ae26dc03b 100644
--- a/docs/astro/src/content/docs/zh/guides/spine.mdx
+++ b/docs/astro/src/content/docs/zh/guides/spine.mdx
@@ -7,6 +7,22 @@ import { Aside } from '@astrojs/starlight/components';
`SpineAnimation` 组件播放 [Spine](http://esotericsoftware.com/) 骨骼动画。在场景编辑器中将它和 `LocalTransform` 一起添加到实体上。
+<Aside type="note">
+ 从 v0.3.0 起,Spine 使用独立的 WASM 模块(`spine38` / `spine42`),不再内置于引擎核心。使用 Spine 组件前必须注册 Spine 插件。
+</Aside>
+
+## Spine 插件设置
+
+在启动时初始化 Spine 插件以加载对应的运行时版本:
+
+```typescript
+import { addPlugin, SpinePlugin } from 'esengine';
+
+addPlugin(SpinePlugin({ version: '4.2' }));
+```
+
+`SpinePlugin` 接受 `'3.8'` 或 `'4.2'`,需与 Spine 编辑器导出版本匹配。插件会在首次使用时下载对应的 WASM 模块。
+
## 属性
| 属性 | 类型 | 默认值 | 说明 |