Skip to content

Mini-Game Platforms

WeChat MiniGame is not a special case in Estella — it is one profile of a platform family. Mini-game hosts (WeChat’s wx, Douyin’s tt, and the rest) expose a near-identical API: no DOM, a packaged filesystem, subpackages, touch input, key-value storage. Estella implements that model once and describes each vendor as data.

This guide is for bringing up a vendor Estella does not ship. If you are shipping to WeChat, you want WeChat MiniGame instead.

Estella ships an opt-in OpenPaaS preset for 2D and 3D through the existing project platform mechanism. Copy pipeline/platforms/openpaas.mjs into your project as .esengine/platforms/openpaas.mjs. No custom editor layout is required. Review and trust that project profile through the normal project-code flow when using the editor.

From an Estella source checkout, build the compatibility mini-game runtime and export the project:

Terminal window
node build-tools/cli.js build -t quickgame --no-sync
node pipeline/bin/estella.mjs export <project> --platform openpaas --out output/my-sud-game

The preset selects the CommonJS compatibility runtime (without WASM SIMD or BigInt i64 at the JS boundary). It uses the shared cook, SDK and renderer, with sud canvas, input, lifecycle and audio; XHR, native WebSocket and localStorage are bridged to the same platform interfaces. WASM loads through WebAssembly.instantiateFromFile, with package-relative paths normalized. The loader accepts an instance without a compiled module, as documented for iOS.

In PinK → Project → Third-party generated, choose the exported directory containing main.js, game-bundle.js and wasm/. Select your platform game ID, configure orientation and version to match the project, then build and upload. PinK can produce the .sp package; Estella can also invoke its official packer directly using the CLI below. Users handle upload, review and publishing. Open the development version in OpenPaaS and scan its package QR code with Hello PinK. The supplied Unity and Laya guides use this same third-party directory workflow; their engine-specific converters are not required here.

The official web2sp 1.0.0 archive has been inspected and exercised. It detects Laya HTML, copies the Web directory, emits main.js and laya_adapter.js, and creates an empty manifest.json when none exists. It does not contain a binary .sp packer. Estella emits its own runtime entry and the same initial manifest directly. Final .sp generation uses the official packer bundled with PinK; uploading, review and publishing remain user-managed.

PinK 0.0.1.39 bundles the independently callable sud-package-sign-tool. After installing or extracting the official PinK package, its Windows path is resources/app/extensions/sud-pink-debug/tools/package-sign/win/sud-package-sign-tool.exe; macOS uses tools/package-sign/mac/sud-package-sign-tool under that extension. Estella does not redistribute this third-party executable. Configure its local path without launching the PinK UI.

Keep signing and encryption keys outside the exported directory. The Ed25519 private key may use raw, hex, base64 or PKCS8 encoding; the AES-128 key file must contain 32 hex characters. Paths in this local JSON resolve relative to the config:

{
"mode": "development",
"toolPath": "<PinK>/resources/app/extensions/sud-pink-debug/tools/package-sign/win/sud-package-sign-tool.exe",
"gameId": "estella-local-test",
"version": "0.1.0",
"privateKeyPath": "development-private.pem",
"encryptionKeyPath": "development-encryption.hex",
"orientation": "landscape"
}
Terminal window
node pipeline/bin/estella.mjs package-openpaas output/my-sud-game --config <local.json> --out output/my-sud-game.sp

Estella prepares the manifest in temporary staging, invokes the official tool for Deflate compression, AES-128-CTR encryption and Ed25519 signing, then verifies all package files. Only a verified result replaces the output; the source export remains untouched. Output and key files must be outside the input directory.

development means independent test keys, not an authorized OpenPaaS game or proof that Hello PinK accepts the package. For an existing platform game, use platform mode with the registered publicKeyHash, contextFile, contextSignatureFile and contextPublicKeyPath. The context signature and public-key hash are checked before packaging. Platform acceptance stays pending.

This preset uses WebGL2. WebGPU, EmscriptenGLX, login, ads and payment are not enabled. Assets are carried in the main directory; platform subpackage splitting and Brotli WASM loading are not enabled. Streaming-world exports remain subject to the existing mini-game restriction. PinK build success, upload, review and real-device acceptance must be recorded separately from Estella export success. The compatibility build supplies the core engine. Physics, Spine and other optional WASM modules need matching artifacts in the selected wasmDir; export fails if content requires one that is absent. Those modules have not been certified on OpenPaaS by this integration.

Run the reproducible local contract check without opening an editor:

Terminal window
node tools/tests/openpaas-runtime.e2e.mjs --wasm build/wasm/quickgame --out output/openpaas-runtime

To check the complete package chain with real authored examples:

Terminal window
node tools/tests/openpaas-runtime.e2e.mjs --packer <official-tool-path> --project-2d examples/sprite-rendering --project-3d examples/device-quality --out output/openpaas-package-check

This generates temporary test keys, exports both examples, creates encrypted and signed .sp files, verifies and decrypts every file, compares payload hashes, then renders the recovered games in the headless contract host. Temporary keys are removed afterwards. Reports and frames do not constitute SUD device acceptance.

It writes 2D/3D frames and a report explicitly marking device acceptance pending. Android Hello PinK exposes vConsole; the supplied guide also names device logs under /storage/emulated/0/Android/data/global.sud.hellopink/files/SUD/SUDLogs/SUDGI/. The guide states that iOS has no vConsole.

References: engine adaptation, adapter, WASM API.

A profile is three facts and, at most, one method:

import { installMiniGamePlatform } from 'esengine/minigame';
declare const myHost: any; // the host global, e.g. `tt`
installMiniGamePlatform({
id: 'myvendor',
hostLabel: 'MyVendor',
get global() { return myHost; },
});

That is a complete platform. Filesystem, fetch, canvas, image decode, touch and key input, storage, subpackages, memory-pressure signals, device pixel ratio and language all come from the normalized host global. So do audio (createInnerAudioContext) and sockets (connectSocket). Video uses the engine’s own wasm MPEG-1 decoder, which is portable to every host.

Read global through a getter, as above: the host global is ambient at runtime, and a getter means importing your profile in a bundler or a test never touches an undefined binding.

WASM instantiation. WeChat routes it through WXWebAssembly.instantiate(path) rather than the standard WebAssembly, so its profile overrides one method:

{
id: 'wechat',
hostLabel: 'WeChat',
get global() { return wx as unknown as MiniGameGlobal; },
instantiateWasm(pathOrBuffer, imports) { /* WXWebAssembly */ },
}

If your host uses standard WebAssembly, omit it — the family reads the binary through the packaged filesystem and instantiates it.

createAudioBackend, createVideoBackend and createSocket are optional the same way. Override one only where the host genuinely differs; the defaults are MiniGameAudioBackend, the wasm video decoder, and MiniGameSocket, all exported from esengine/minigame so you can wrap rather than rewrite.

The optional methods are not only for host differences — they are the seam for replacing an implementation you don’t want. Writing your own video decoding, for example, is one method:

import type { MiniGameProfile, PlatformVideoBackend, VideoBackendContext } from 'esengine/minigame';
class SoftwareVideoBackend implements PlatformVideoBackend {
readonly name = 'my-software-decoder';
constructor(private ctx: VideoBackendContext) {}
createStream(url: string, options) { /* your decode → VideoStreamHandle */ }
dispose() {}
}
export default {
id: 'myvendor',
hostLabel: 'MyVendor',
get global() { return myHost; },
createVideoBackend: (ctx) => new SoftwareVideoBackend(ctx),
} satisfies MiniGameProfile;

VideoPlugin asks the platform for a backend once at build; whatever you return is what every VideoPlayer in the game drives. The contract to satisfy is PlatformVideoBackend — createStream(url, options) returning a VideoStreamHandle whose pump(module) uploads the current frame to textureHandle once per frame. Audio (PlatformAudioBackend) and sockets (PlatformSocket) work the same way.

To keep most of a host and change one thing, spread its profile:

import { wechatProfile } from 'esengine/wechat';
export default { ...wechatProfile, createVideoBackend: (ctx) => new SoftwareVideoBackend(ctx) };

Your global has to satisfy MiniGameGlobal. Required:

Member Used for
createCanvas() display surface (first call) + offscreen 2D
createImage() image decode
getFileSystemManager() readFileSync / readFile / access / accessSync / writeFile
request(opts) the fetch polyfill
createInnerAudioContext() audio playback
connectSocket(opts) GameSocket / replication
getSystemInfoSync() viewport size, pixel ratio, language
onTouchStart/Move/End + off* pointer input
getStorageSync / setStorageSync / removeStorageSync / getStorageInfoSync save data, hot-update bookkeeping

Optional — the adapter probes for these and degrades gracefully when a host lacks one: onTouchCancel/offTouchCancel, onKeyDown/onKeyUp (+ off*), loadSubpackage, onMemoryWarning/offMemoryWarning, onShow/onHide.

The shipped package’s entry calls the family runtime:

// game.js — the host runs this
const engineFactory = require('./wasm/esengine.js');
const bundle = require('./game-bundle.js');
bundle.boot(engineFactory, { /* side module factories */ });
// bundled with your game
import { installMiniGamePlatform, initMiniGameRuntime } from 'esengine/minigame';
import { myProfile } from './myProfile';
export function boot(engineFactory, sideModuleFactories) {
installMiniGamePlatform(myProfile);
return initMiniGameRuntime({
engineFactory,
engineWasmPath: 'wasm/esengine.wasm',
sceneNames: ['Main'],
firstScene: 'Main',
sideModuleFactories,
});
}

initMiniGameRuntime takes the display canvas from the adapter, registers its GL context with the engine module, loads the addressable manifest, and runs the app — the same sequence WeChat boots through. initWeChatRuntime is this function with WeChat’s staged wasm name filled in, and nothing else.

In Package Project, hover the Project group in the platform list and hit +. Give it an id and a name, and the editor writes both halves of the vendor — already joined — then selects the new platform so you can package it as soon as you have described your host.

The files it writes are ordinary project files; nothing is registered anywhere else. This is the packaging half:

.esengine/platforms/acme-play.mjs
export default {
id: 'acme-play',
label: 'ACME Play',
blurb: 'ACME mini-game package.',
defaultOut: 'dist-acme',
emitConfigFiles(ctx) {
return [{
file: 'game.json',
content: JSON.stringify({
orientation: ctx.orientation,
appName: ctx.title,
...(ctx.subPackages.length > 0 ? { subPackages: ctx.subPackages } : {}),
}, null, 2) + '\n',
}];
},
};

That is the whole file. Three facts and one emitter — the rest defaults to a standard mini-game host: the vendor-neutral SDK entry (index.minigame.js), initMiniGameRuntime, the standard WebAssembly engine glue, and the generic CommonJS game.js. Everything else — cook, manifest, scene transform, side-module scan, bundling, runtime copy — is the same pipeline WeChat uses.

The file above is the packaging half (scaffolded for you by +). The runtime half is the MiniGameProfile from the first part of this guide — the host global, and any capability you replace. Point at it with runtimeProfile and the generated entry installs it before booting:

.esengine/platforms/acme-play.mjs
export default {
id: 'acme-play',
label: 'ACME Play',
runtimeProfile: 'src/acme-runtime.ts', // ← the other half
emitConfigFiles(ctx) { /* … */ },
};
// src/acme-runtime.ts — default-exports the runtime MiniGameProfile
export default {
id: 'acme-play',
hostLabel: 'ACME Play',
get global() { return acme; },
createVideoBackend: (ctx) => new SoftwareVideoBackend(ctx),
};

This link matters because esengine/minigame installs no platform until the game names a host. Without it the package builds cleanly and then throws on the device. Omit runtimeProfile only if your game calls installMiniGamePlatform itself; the editor checks the path exists and refuses to call the platform ready otherwise.

The id must be lowercase letters/digits/dashes and must not shadow a built-in. It is also the cook’s Import Settings key, so per-texture compression overrides can target your platform by name.

Everything you can override, and what the pipeline uses it for:

Field What it says
id vendor identity — also the Import Settings key the cook reads per texture
sdkEntryFile SDK dist entry esengine is aliased to
runtimeInit the boot function the generated entry imports
engineGlueCandidates engine glue filenames to look for, in preference order
esTarget syntax floor for the bundle and the down-leveled glue
wasmBuildHint / sideModuleBuildTargets the build -t … names in error guidance
nativeSuffixes / binRestageExts the packer’s suffix policy
subpackageDir where lazy groups stage
emitConfigFiles / emitEntry the vendor’s config files and game.js
wasmDir project-relative engine runtime dir (default: the editor’s web runtime)
runtimeProfile project-relative module default-exporting the runtime MiniGameProfile

Only if it cannot load the web engine’s wasm. WeChat needs one (-t wechat, ES_BUILD_WXGAME) because of WXWebAssembly and because it has no WebGPU. A host with standard WebAssembly and WebGL2 can ship the web build’s glue — engineGlueCandidates already falls back to esengine.js for exactly this case.