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.

test(golden): space-shooter is certified on WeChat by the pixels it claims

esenginef9d85db3d047
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1407a04e6..18a8b35ea 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -27,6 +27,8 @@ published separately; it ships inside the editor.
### Fixed
+- A WeChat or other mini-game package draws each sprite from a packed atlas as its own frame again, not as the whole atlas page shrunk into the sprite. The package's scenes now keep their `@uuid:` references as the web package does, and a reference by bare uuid finds its atlas frame too.
+- Sprite masks work in WeChat and other mini-game packages: the game's WebGL context was created without a stencil buffer, so every mask drew as if it were not there (space-shooter's hull bar read as empty). The web, playable and mini-game hosts now create the context with the same attributes.
- On a host that compresses the engine binary (most CDNs and static hosts), the web boot bar no longer runs to the end of the engine download a third of the way through and stands there for the rest of it: the page divided decompressed bytes by the compressed Content-Length. The export now records the binary's own size (`engineBytes` in `game.config.json`) and the bar measures against that.
- Project Settings says the start screen's logo is for web exports; a mini-game shows its host's own start screen and loading text.
- The Profiler no longer reports a connected build's debug-channel cost as 0 ms when the device's clock is too coarse to measure it — a browser that is not cross-origin isolated steps by 0.1 ms. The device reports its clock's step, the row reads "< 0.100 ms", and `profile_frames` returns it as `channelClockMs`.
diff --git a/tools/goldenProjects.mjs b/tools/goldenProjects.mjs
index 3719819da..76b0a83ee 100644
--- a/tools/goldenProjects.mjs
+++ b/tools/goldenProjects.mjs
@@ -679,7 +679,16 @@ export const GOLDEN = [
// rather than at the one its position would give it — so the draw order and the
// mask are both something a packaged game here actually does.
certifies: ['ecs', 'texture-atlas', 'sprite-sorting', 'sprite-mask', 'velocity-motion', 'sprite-draw-mode'],
- targets: ['web', 'desktop', 'android'],
+ // WeChat too: its package drew every packed sprite as the whole page and every
+ // mask as absent while the web one was right, and no target here could see it.
+ targets: ['web', 'wechat', 'desktop', 'android'],
+ // Parity averages the frame, and a ship drawn as its whole atlas page or a
+ // bar whose mask was ignored is one percent of it: a WeChat package did both
+ // at 0.014, inside the limit. These read the two things themselves.
+ packagePixels: [
+ { what: 'the ship samples its own frame of the atlas', x: 0.5, y: 0.885, rgb: [66, 177, 243], tol: 30 },
+ { what: 'the hull bar shows its fill through the mask', x: 0.40, y: 0.9625, rgb: [95, 239, 145], tol: 30 },
+ ],
tier: 'pr',
interact: { keys: ['ArrowLeft'], frames: 40 },
// Its small sprites live in a `<name>.atlas/` folder, so the cook packs them
@@ -700,7 +709,7 @@ export const GOLDEN = [
interactGap: 'a placed model has nothing to drive; the import chain is what this certifies',
// Both colours of the model's own texture: an import that lost the texture, or
// the model, leaves the clear colour here.
- webPixels: [
+ packagePixels: [
{ what: 'the model draws its texture', x: 0.19, y: 0.385, rgb: [212, 156, 75], tol: 24 },
{ what: 'and the texture\'s second colour', x: 0.40, y: 0.385, rgb: [58, 46, 40], tol: 24 },
],
@@ -724,7 +733,7 @@ export const GOLDEN = [
// The pose is HELD rather than played, so a point means one thing rather than
// one moment. Measured on the package; each was checked by breaking the
// feature it is about and watching it, and only it, go.
- webPixels: [
+ packagePixels: [
// Only the joints put the mesh here — with the skin gone it draws nowhere.
{ what: 'the skin places the mesh', x: 0.245, y: 0.31, rgb: [255, 255, 255], tol: 22 },
{ what: 'the mesh casts onto the panel', x: 0.515, y: 0.55, rgb: [64, 61, 61], tol: 22 },
@@ -745,7 +754,7 @@ export const GOLDEN = [
// The launcher moves no pointer, so the torch rests where the scene puts it.
// Two cells one distance from it, past a block and in the open, differ only by
// the shadow pass — whether it survives a package, not what a shadow looks like.
- webPixels: [
+ packagePixels: [
{ what: 'the torch lights the floor', x: 0.55, y: 0.42, rgb: [172, 165, 147], tol: 30 },
{ what: 'the open side is lit at that distance', x: 0.65, y: 0.42, rgb: [63, 61, 56], tol: 24 },
{ what: 'the block shadows its far side', x: 0.35, y: 0.42, rgb: [13, 14, 14], tol: 24 },
@@ -781,7 +790,7 @@ export const GOLDEN = [
// The hero left of centre only through its instance's override, the knight
// upright only through the retarget: without it the hero's clips lay the
// knight on its back, helmet and boots nowhere near these points.
- webPixels: [
+ packagePixels: [
{ what: 'the hero stands where its override puts it', x: 0.372, y: 0.406, rgb: [166, 81, 17], tol: 28 },
{ what: 'the knight\'s helmet is at the top of it', x: 0.610, y: 0.228, rgb: [123, 129, 123], tol: 24 },
{ what: 'its armour at the side', x: 0.659, y: 0.571, rgb: [59, 61, 59], tol: 24 },
@@ -838,7 +847,7 @@ export const GOLDEN = [
// key caused it. The keyboard is covered by platformer and input-actions.
interactGap: 'an autonomous enemy moves as much as the input does; the A/B cannot attribute it',
// Away from the patrol: the ground and the water are layers of their own.
- webPixels: [
+ packagePixels: [
{ what: 'the ground layer draws', x: 0.84, y: 0.93, rgb: [198, 124, 89], tol: 24 },
{ what: 'the water layer draws', x: 0.43, y: 0.83, rgb: [54, 192, 245], tol: 24 },
],
@@ -1157,13 +1166,12 @@ export function desktopPixels(g, host) {
}
/**
- * Points a packaged WEB frame must contain, or null. Parity only says the package
- * and the editor agree — a feature the PACKAGE lost that the editor never had
- * either passes it, and a launch check passes anything that is not one flat
- * colour. `x`/`y` are fractions of the surface, `y` from the top.
+ * Points a packaged frame must contain on every target sized to the editor's, or
+ * null. Parity is an average: a feature both lost, or one sprite drawn wrong in a
+ * frame of many, passes it. `x`/`y` are fractions of the surface, `y` from the top.
*/
-export function webPixels(g) {
- return g?.webPixels ?? null;
+export function packagePixels(g) {
+ return g?.packagePixels ?? null;
}
/**
diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjs
index 77005de09..710c55b22 100644
--- a/tools/releaseNotes.mjs
+++ b/tools/releaseNotes.mjs
@@ -1188,4 +1188,10 @@ export const NOTED = {
{ note: 'A connected development build says which graphics API it draws through — WebGL2, EmscriptenGLX or WebGPU — once its game has started: the Profiler shows it beside the device\'s controls, the Output Log notes it, and `device_targets` returns it as `graphics`. A WeChat build set to EmscriptenGLX reports WebGL2 on a host that does not offer it.' },
'feat(profiler): the Profiler shows which graphics API a device draws through':
{ note: 'A connected development build says which graphics API it draws through — WebGL2, EmscriptenGLX or WebGPU — once its game has started: the Profiler shows it beside the device\'s controls, the Output Log notes it, and `device_targets` returns it as `graphics`. A WeChat build set to EmscriptenGLX reports WebGL2 on a host that does not offer it.' },
+ 'fix(export): a mini-game package draws each atlas sprite as its own frame':
+ { note: 'A WeChat or other mini-game package draws each sprite from a packed atlas as its own frame again, not as the whole atlas page shrunk into the sprite. The package\'s scenes now keep their `@uuid:` references as the web package does, and a reference by bare uuid finds its atlas frame too.' },
+ 'fix(minigame): sprite masks draw in a mini-game package':
+ { note: 'Sprite masks work in WeChat and other mini-game packages: the game\'s WebGL context was created without a stencil buffer, so every mask drew as if it were not there (space-shooter\'s hull bar read as empty). The web, playable and mini-game hosts now create the context with the same attributes.' },
+ 'test(golden): space-shooter is certified on WeChat by the pixels it claims':
+ { internal: 'A repository golden check; no creator runs it.' },
};
diff --git a/tools/verify-golden.mjs b/tools/verify-golden.mjs
index ed5403762..391bf0404 100644
--- a/tools/verify-golden.mjs
+++ b/tools/verify-golden.mjs
@@ -25,7 +25,7 @@ import { spawn, spawnSync } from 'node:child_process';
import { fileURLToPath } from 'node:url';
import { mkdirSync, rmSync, readFileSync, existsSync, writeFileSync } from 'node:fs';
import path from 'node:path';
-import { atTier, sharesOf, projectDir, parityFor, interactFor, audioFor, suspendFor, safeAreaFor, atlasFor, subpackageFor, firstScreenFor, webPixels, launchTimeoutFor, ROOT } from './goldenProjects.mjs';
+import { atTier, sharesOf, projectDir, parityFor, interactFor, audioFor, suspendFor, safeAreaFor, atlasFor, subpackageFor, firstScreenFor, packagePixels, launchTimeoutFor, ROOT } from './goldenProjects.mjs';
import { frameDistance, frameCellMax, readPNG } from './frameCompare.mjs';
import { retryOnDeadGpu, deadGpuVerdict, launchNeverHappenedVerdict, failureLines } from './lib/deadGpu.mjs';
import { runElectron, ensureElectronBinary } from './lib/electronRun.mjs';
@@ -530,7 +530,7 @@ for (const { id, target } of pairs) {
// What the PACKAGE drew, before comparing it to anything. Parity is an A/B, so
// a capability the package lost and the editor never had passes it; the launch
// check passes any frame that is not one flat colour.
- const wanted = target === 'web' ? webPixels(golden) : null;
+ const wanted = COMPARABLE.has(target) ? packagePixels(golden) : null;
if (wanted) {
const missed = probePackagePixels(packagePng, wanted);
if (missed.length > 0) {