@bitmagic/asset-core 0.2.7-dev.9 → 0.2.8-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/generators/background.d.ts +37 -0
- package/dist/generators/background.d.ts.map +1 -0
- package/dist/generators/background.js +80 -0
- package/dist/generators/background.js.map +1 -0
- package/dist/generators/block-type.d.ts +34 -0
- package/dist/generators/block-type.d.ts.map +1 -0
- package/dist/generators/block-type.js +166 -0
- package/dist/generators/block-type.js.map +1 -0
- package/dist/generators/character.d.ts +2 -2
- package/dist/generators/image.d.ts +5 -5
- package/dist/generators/prop-voxel.d.ts +2 -2
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/judge-prompt.d.ts +19 -1
- package/dist/judge-prompt.d.ts.map +1 -1
- package/dist/judge-prompt.js +33 -1
- package/dist/judge-prompt.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { AssetResultBase, GenerateDeps } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* A 2D backdrop for side-scrolling and top-down games.
|
|
5
|
+
*
|
|
6
|
+
* ── Why this is a sibling of `skybox` and not a flag on it ───────────────────────────────────
|
|
7
|
+
*
|
|
8
|
+
* Both call the same image endpoint at the same 2048x1024 and write the same field
|
|
9
|
+
* (`worldProfileData.skyboxUrl`), so the machinery is identical. What differs is the PROMPT, and
|
|
10
|
+
* it differs completely: a skybox must wrap seamlessly around a sphere with matching left and
|
|
11
|
+
* right edges and its landmarks pushed above the horizon, while a backdrop wants layered depth and
|
|
12
|
+
* a clear ground line and is only ever seen head-on. Asking one prompt to serve both produces an
|
|
13
|
+
* image that is bad at each — a 2D scene with a visible seam, or a panorama with everything
|
|
14
|
+
* bunched at the bottom.
|
|
15
|
+
*
|
|
16
|
+
* The 2048x1024 is not incidental either: the engine maps `skyboxUrl` onto a sphere in every genre
|
|
17
|
+
* (`SkyboxMaterialHelper` builds a SphereGeometry), so a backdrop authored at any other aspect
|
|
18
|
+
* would arrive stretched. 2:1 is the equirectangular ratio, which is what makes one field able to
|
|
19
|
+
* carry both kinds of image.
|
|
20
|
+
*/
|
|
21
|
+
export declare const backgroundParamsSchema: z.ZodObject<{
|
|
22
|
+
description: z.ZodString;
|
|
23
|
+
referenceImageUrl: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, "strict", z.ZodTypeAny, {
|
|
25
|
+
description: string;
|
|
26
|
+
referenceImageUrl?: string | undefined;
|
|
27
|
+
}, {
|
|
28
|
+
description: string;
|
|
29
|
+
referenceImageUrl?: string | undefined;
|
|
30
|
+
}>;
|
|
31
|
+
export type BackgroundParams = z.input<typeof backgroundParamsSchema>;
|
|
32
|
+
export type BackgroundResult = AssetResultBase & {
|
|
33
|
+
url?: string;
|
|
34
|
+
billable?: boolean;
|
|
35
|
+
};
|
|
36
|
+
export declare function generateBackground(params: BackgroundParams, deps: GenerateDeps): Promise<BackgroundResult>;
|
|
37
|
+
//# sourceMappingURL=background.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"background.d.ts","sourceRoot":"","sources":["../../src/generators/background.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIjE;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;EAIxB,CAAC;AAEZ,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,MAAM,MAAM,gBAAgB,GAAG,eAAe,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AAsBtF,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,YAAY,GACjB,OAAO,CAAC,gBAAgB,CAAC,CAmD3B"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { fail, ok } from '../result.js';
|
|
3
|
+
import { formatZodIssues } from '../validation.js';
|
|
4
|
+
/**
|
|
5
|
+
* A 2D backdrop for side-scrolling and top-down games.
|
|
6
|
+
*
|
|
7
|
+
* ── Why this is a sibling of `skybox` and not a flag on it ───────────────────────────────────
|
|
8
|
+
*
|
|
9
|
+
* Both call the same image endpoint at the same 2048x1024 and write the same field
|
|
10
|
+
* (`worldProfileData.skyboxUrl`), so the machinery is identical. What differs is the PROMPT, and
|
|
11
|
+
* it differs completely: a skybox must wrap seamlessly around a sphere with matching left and
|
|
12
|
+
* right edges and its landmarks pushed above the horizon, while a backdrop wants layered depth and
|
|
13
|
+
* a clear ground line and is only ever seen head-on. Asking one prompt to serve both produces an
|
|
14
|
+
* image that is bad at each — a 2D scene with a visible seam, or a panorama with everything
|
|
15
|
+
* bunched at the bottom.
|
|
16
|
+
*
|
|
17
|
+
* The 2048x1024 is not incidental either: the engine maps `skyboxUrl` onto a sphere in every genre
|
|
18
|
+
* (`SkyboxMaterialHelper` builds a SphereGeometry), so a backdrop authored at any other aspect
|
|
19
|
+
* would arrive stretched. 2:1 is the equirectangular ratio, which is what makes one field able to
|
|
20
|
+
* carry both kinds of image.
|
|
21
|
+
*/
|
|
22
|
+
export const backgroundParamsSchema = z.object({
|
|
23
|
+
description: z.string().min(1).describe('Description of the background scene to generate'),
|
|
24
|
+
referenceImageUrl: z.string().optional()
|
|
25
|
+
.describe('Style/composition reference forwarded to the image model'),
|
|
26
|
+
}).strict();
|
|
27
|
+
/** Same as the skybox: the engine sphere-maps this field, so 2:1 is the only ratio that fits. */
|
|
28
|
+
const BACKGROUND_WIDTH = 2048;
|
|
29
|
+
const BACKGROUND_HEIGHT = 1024;
|
|
30
|
+
const ENDPOINT = '/ai/v1/generate-image-as-webp-url';
|
|
31
|
+
/** Mirrors the agent lane's `background-image-generator`, so both lanes ask for the same picture. */
|
|
32
|
+
function buildPrompt(sceneDescription) {
|
|
33
|
+
return `Create a flat 2D game background illustration for a side-scrolling or top-down 2D game.
|
|
34
|
+
The scene description is: ${sceneDescription}.
|
|
35
|
+
Style: stylized game art with clear shapes, vibrant colors, and good contrast between foreground and background layers.
|
|
36
|
+
The image should work as a static backdrop behind 2D game objects and characters.
|
|
37
|
+
Include depth through layered elements (distant mountains/buildings, mid-ground features, ground/floor).
|
|
38
|
+
Ensure the image has a clear horizon or ground line.
|
|
39
|
+
Do NOT include any game characters, UI elements, or text.`;
|
|
40
|
+
}
|
|
41
|
+
export async function generateBackground(params, deps) {
|
|
42
|
+
const { forger, logger, onProgress } = deps;
|
|
43
|
+
const parsed = backgroundParamsSchema.safeParse(params);
|
|
44
|
+
if (!parsed.success) {
|
|
45
|
+
logger.warn({ err: parsed.error }, '[background] Invalid parameters');
|
|
46
|
+
return fail(formatZodIssues(parsed.error));
|
|
47
|
+
}
|
|
48
|
+
const input = parsed.data;
|
|
49
|
+
if (!forger.hasCredentials()) {
|
|
50
|
+
logger.error('[background] Missing Asset Forger credentials');
|
|
51
|
+
return fail(forger.getMissingCredentialsMessage());
|
|
52
|
+
}
|
|
53
|
+
onProgress(`Generating background: ${input.description}`);
|
|
54
|
+
logger.info(`[background] Starting generation for: "${input.description}"${input.referenceImageUrl ? ' (with reference image)' : ''}`);
|
|
55
|
+
try {
|
|
56
|
+
const response = await forger.post(ENDPOINT, {
|
|
57
|
+
prompt: buildPrompt(input.description),
|
|
58
|
+
height: BACKGROUND_HEIGHT,
|
|
59
|
+
width: BACKGROUND_WIDTH,
|
|
60
|
+
numImages: 1,
|
|
61
|
+
guidanceScale: 1.0,
|
|
62
|
+
...(input.referenceImageUrl ? { referenceImageUrl: input.referenceImageUrl } : {}),
|
|
63
|
+
}, 'background');
|
|
64
|
+
const url = response.imageUrl;
|
|
65
|
+
if (!url) {
|
|
66
|
+
// Billable: the Forger accepted and ran the job, and was paid for it, whatever it answered.
|
|
67
|
+
return { ...fail('Asset Forger returned no image URL'), billable: true };
|
|
68
|
+
}
|
|
69
|
+
logger.info(`[background] Successfully generated background image URL: ${url}`);
|
|
70
|
+
return ok(`Background image generated: ${url}`,
|
|
71
|
+
// The same field a skybox writes — see the file header for why one field carries both.
|
|
72
|
+
[{ type: 'set', path: ['skyboxUrl'], value: url }], { url, billable: true });
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
const message = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
76
|
+
logger.error({ err: error }, '[background] Error during background generation');
|
|
77
|
+
return fail(message);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=background.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"background.js","sourceRoot":"","sources":["../../src/generators/background.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,iDAAiD,CAAC;IAC1F,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;SACrC,QAAQ,CAAC,0DAA0D,CAAC;CACxE,CAAC,CAAC,MAAM,EAAE,CAAC;AAUZ,iGAAiG;AACjG,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAC9B,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAC/B,MAAM,QAAQ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,aAAa,EAAE,GAAG;YAClB,GAAG,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,KAAK,CAAC,iBAAiB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACnF,EACD,YAAY,CACb,CAAC;QAEF,MAAM,GAAG,GAAG,QAAQ,CAAC,QAAQ,CAAC;QAC9B,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,4FAA4F;YAC5F,OAAO,EAAE,GAAG,IAAI,CAAC,oCAAoC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;QAC3E,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,6DAA6D,GAAG,EAAE,CAAC,CAAC;QAEhF,OAAO,EAAE,CACP,+BAA+B,GAAG,EAAE;QACpC,uFAAuF;QACvF,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,EAClD,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CACxB,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC;QAClF,MAAM,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,iDAAiD,CAAC,CAAC;QAChF,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { AssetResultBase, GenerateDeps } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* A custom voxel block type: one tileable texture, registered under a name the rest of the game
|
|
5
|
+
* refers to (`create-voxel-asset`'s `blockType`, `groundConfig.surfaceBlockType`, building code).
|
|
6
|
+
*/
|
|
7
|
+
export declare const blockTypeParamsSchema: z.ZodObject<{
|
|
8
|
+
name: z.ZodString;
|
|
9
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
10
|
+
description: z.ZodString;
|
|
11
|
+
sideDescription: z.ZodOptional<z.ZodString>;
|
|
12
|
+
referenceImageUrl: z.ZodOptional<z.ZodString>;
|
|
13
|
+
}, "strict", z.ZodTypeAny, {
|
|
14
|
+
description: string;
|
|
15
|
+
name: string;
|
|
16
|
+
referenceImageUrl?: string | undefined;
|
|
17
|
+
displayName?: string | undefined;
|
|
18
|
+
sideDescription?: string | undefined;
|
|
19
|
+
}, {
|
|
20
|
+
description: string;
|
|
21
|
+
name: string;
|
|
22
|
+
referenceImageUrl?: string | undefined;
|
|
23
|
+
displayName?: string | undefined;
|
|
24
|
+
sideDescription?: string | undefined;
|
|
25
|
+
}>;
|
|
26
|
+
export type BlockTypeParams = z.input<typeof blockTypeParamsSchema>;
|
|
27
|
+
export type BlockTypeResult = AssetResultBase & {
|
|
28
|
+
blockTypeName?: string;
|
|
29
|
+
textureUrl?: string;
|
|
30
|
+
sideTextureUrl?: string;
|
|
31
|
+
billable?: boolean;
|
|
32
|
+
};
|
|
33
|
+
export declare function generateBlockType(params: BlockTypeParams, deps: GenerateDeps): Promise<BlockTypeResult>;
|
|
34
|
+
//# sourceMappingURL=block-type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"block-type.d.ts","sourceRoot":"","sources":["../../src/generators/block-type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIjE;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;EAWvB,CAAC;AAEZ,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG;IAC9C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAmEF,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,eAAe,EACvB,IAAI,EAAE,YAAY,GACjB,OAAO,CAAC,eAAe,CAAC,CA+G1B"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { fail, ok } from '../result.js';
|
|
3
|
+
import { formatZodIssues } from '../validation.js';
|
|
4
|
+
/**
|
|
5
|
+
* A custom voxel block type: one tileable texture, registered under a name the rest of the game
|
|
6
|
+
* refers to (`create-voxel-asset`'s `blockType`, `groundConfig.surfaceBlockType`, building code).
|
|
7
|
+
*/
|
|
8
|
+
export const blockTypeParamsSchema = z.object({
|
|
9
|
+
name: z.string().min(1)
|
|
10
|
+
.regex(/^[a-z][a-z0-9_]*$/, 'Name must be lowercase snake_case, starting with a letter')
|
|
11
|
+
.describe('Stable block-type id, lowercase snake_case (e.g. mossy_brick)'),
|
|
12
|
+
displayName: z.string().min(1).optional()
|
|
13
|
+
.describe('Human-readable label; derived from name when omitted'),
|
|
14
|
+
description: z.string().min(5).describe('What the block texture depicts'),
|
|
15
|
+
sideDescription: z.string().min(5).optional()
|
|
16
|
+
.describe('When given, the side faces get their own texture generated from this description'),
|
|
17
|
+
referenceImageUrl: z.string().optional()
|
|
18
|
+
.describe('Style/composition reference forwarded to the image model'),
|
|
19
|
+
}).strict();
|
|
20
|
+
const TEXTURE_PIXELS = 256;
|
|
21
|
+
const ENDPOINT = '/ai/v1/generate-image-as-webp-url';
|
|
22
|
+
/**
|
|
23
|
+
* The resample target the engine stores per block, NOT the size asked of the model.
|
|
24
|
+
*
|
|
25
|
+
* `BlockRegistry` reads `spec.textureSize || 64`, so omitting this or writing `0` silently
|
|
26
|
+
* quadruples the resolution of a texture whose prompt explicitly says "displayed at 16x16".
|
|
27
|
+
* Written as a literal, matching the agent lane.
|
|
28
|
+
*/
|
|
29
|
+
const TEXTURE_SIZE = 16;
|
|
30
|
+
/**
|
|
31
|
+
* Built-in Voxel block names and their aliases, from game-play-agent's `block-types.ts`.
|
|
32
|
+
*
|
|
33
|
+
* Duplicated rather than imported: asset-core is a leaf package that cannot depend on the agent,
|
|
34
|
+
* and this list is frozen in practice — the engine pins the built-in ids these names resolve to
|
|
35
|
+
* (`customBlockIdRange.test.ts`), so a name leaving the list would be an engine change.
|
|
36
|
+
* A custom block may not shadow one: `BlockRegistry` matches names case-insensitively and keeps
|
|
37
|
+
* the FIRST registration, so the built-in would win and the paid-for texture would vanish.
|
|
38
|
+
*/
|
|
39
|
+
const BUILTIN_BLOCK_NAMES = new Set([
|
|
40
|
+
'asphalt', 'dirt', 'foliage', 'grass', 'ice', 'lava', 'leaves',
|
|
41
|
+
'marble', 'road', 'rock', 'sand', 'stone', 'trunk', 'water', 'wood',
|
|
42
|
+
]);
|
|
43
|
+
/** Lifted from the agent lane's `block-texture-generator`, so both lanes ask for the same texture. */
|
|
44
|
+
function buildPrompt(description) {
|
|
45
|
+
return `Create a seamless tileable pixel art texture for a Minecraft-style voxel game block.
|
|
46
|
+
The texture should depict: ${description}.
|
|
47
|
+
CRITICAL REQUIREMENTS:
|
|
48
|
+
- Seamless tiling in all directions (edges must match perfectly)
|
|
49
|
+
- Pixel art style with large chunky pixels, NOT photorealistic
|
|
50
|
+
- Use only a few flat colors with minimal gradients
|
|
51
|
+
- Simple pattern with low detail — this will be displayed at 16x16 pixels
|
|
52
|
+
- Fill the entire image with the texture, no borders or margins
|
|
53
|
+
- No text, labels, or watermarks
|
|
54
|
+
- Flat lighting, minimal shading`;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* One texture request. The top and side calls differ only in their description and in whether a
|
|
58
|
+
* reference image styles them, so the size and sampling settings are written once — the two
|
|
59
|
+
* drifting apart would give one face of a block a different look for no stated reason.
|
|
60
|
+
*/
|
|
61
|
+
function textureRequest(description, referenceImageUrl) {
|
|
62
|
+
return {
|
|
63
|
+
prompt: buildPrompt(description),
|
|
64
|
+
height: TEXTURE_PIXELS,
|
|
65
|
+
width: TEXTURE_PIXELS,
|
|
66
|
+
numImages: 1,
|
|
67
|
+
guidanceScale: 1.0,
|
|
68
|
+
...(referenceImageUrl ? { referenceImageUrl } : {}),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
/** `mossy_brick` -> `Mossy Brick`, matching the agent lane's derivation exactly. */
|
|
72
|
+
function deriveDisplayName(name) {
|
|
73
|
+
return name.replace(/_/g, ' ').replace(/\b\w/g, (character) => character.toUpperCase());
|
|
74
|
+
}
|
|
75
|
+
export async function generateBlockType(params, deps) {
|
|
76
|
+
const { forger, logger, onProgress } = deps;
|
|
77
|
+
const parsed = blockTypeParamsSchema.safeParse(params);
|
|
78
|
+
if (!parsed.success) {
|
|
79
|
+
logger.warn({ err: parsed.error }, '[block-type] Invalid parameters');
|
|
80
|
+
return fail(formatZodIssues(parsed.error));
|
|
81
|
+
}
|
|
82
|
+
const input = parsed.data;
|
|
83
|
+
// Before the credentials check, and well before any spend: a shadowed name cannot be rescued
|
|
84
|
+
// later, because the engine would keep the built-in and drop this block on load.
|
|
85
|
+
if (BUILTIN_BLOCK_NAMES.has(input.name.toLowerCase())) {
|
|
86
|
+
logger.warn(`[block-type] Refusing built-in name "${input.name}"`);
|
|
87
|
+
return fail(`Block type "${input.name}" is a built-in type and cannot be redefined. Pick a unique name.`);
|
|
88
|
+
}
|
|
89
|
+
if (!forger.hasCredentials()) {
|
|
90
|
+
logger.error('[block-type] Missing Asset Forger credentials');
|
|
91
|
+
return fail(forger.getMissingCredentialsMessage());
|
|
92
|
+
}
|
|
93
|
+
const displayName = input.displayName ?? deriveDisplayName(input.name);
|
|
94
|
+
onProgress(`Generating block texture: ${input.description}`);
|
|
95
|
+
logger.info(`[block-type] Starting generation for "${input.name}": "${input.description}"${input.referenceImageUrl ? ' (with reference image)' : ''}`);
|
|
96
|
+
let textureUrl;
|
|
97
|
+
try {
|
|
98
|
+
const response = await forger.post(ENDPOINT, textureRequest(input.description, input.referenceImageUrl), 'block-type');
|
|
99
|
+
if (!response.imageUrl) {
|
|
100
|
+
// Billable: the Forger ran the job and was paid for it, whatever it answered.
|
|
101
|
+
return { ...fail('Asset Forger returned no block texture URL'), billable: true };
|
|
102
|
+
}
|
|
103
|
+
textureUrl = response.imageUrl;
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
const message = error instanceof Error ? error.message : 'Unknown error occurred';
|
|
107
|
+
logger.error({ err: error }, '[block-type] Error during block texture generation');
|
|
108
|
+
return fail(message);
|
|
109
|
+
}
|
|
110
|
+
// The side texture is a bonus, not a precondition: a failure here leaves a perfectly usable
|
|
111
|
+
// block whose top texture covers every face, which is what the agent lane does too. Turning it
|
|
112
|
+
// into a hard failure would throw away a texture the creator has already paid for.
|
|
113
|
+
// No reference image on this call — the side faces follow `sideDescription` alone.
|
|
114
|
+
let sideTextureUrl = null;
|
|
115
|
+
if (input.sideDescription !== undefined) {
|
|
116
|
+
onProgress(`Generating side texture: ${input.sideDescription}`);
|
|
117
|
+
try {
|
|
118
|
+
const sideResponse = await forger.post(ENDPOINT, textureRequest(input.sideDescription), 'block-type');
|
|
119
|
+
if (sideResponse.imageUrl) {
|
|
120
|
+
sideTextureUrl = sideResponse.imageUrl;
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
logger.warn(`[block-type] Side texture came back empty for "${input.name}"; using the top texture on all faces`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
logger.warn({ err: error }, `[block-type] Side texture generation failed for "${input.name}"; using the top texture on all faces`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
logger.info(`[block-type] Registered "${input.name}" with texture ${textureUrl}`);
|
|
131
|
+
return ok(`Block type "${input.name}" generated: ${textureUrl}`, [{
|
|
132
|
+
// `upsertRoot` with a two-segment path, NOT the `push` the agent lane uses.
|
|
133
|
+
//
|
|
134
|
+
// The agent tool can afford `push` because it reads the game's world.json first and returns
|
|
135
|
+
// early when the name is already there. This generator runs on the SERVER and cannot see the
|
|
136
|
+
// creator's local file, so a `push` would append a second entry with the same name — and
|
|
137
|
+
// `BlockRegistry` keeps the FIRST case-insensitive match and discards the rest, silently
|
|
138
|
+
// throwing away the texture just paid for. Upserting on `name` makes a re-run REPLACE, which
|
|
139
|
+
// is also what makes "regenerate this block until I like it" work.
|
|
140
|
+
//
|
|
141
|
+
// Two segments rather than a `worldProfileData`-scoped `upsert` kind: `WorldPatch` is
|
|
142
|
+
// published and already installed out in the world, and an older CLI receiving an unknown
|
|
143
|
+
// patch type falls through to writing `value` at the document ROOT — clobbering the array
|
|
144
|
+
// with a single object, without an error. `upsertRoot` is understood by every applier that
|
|
145
|
+
// exists, and both walk the two segments correctly.
|
|
146
|
+
type: 'upsertRoot',
|
|
147
|
+
path: ['worldProfileData', 'customBlockTypes'],
|
|
148
|
+
matchKeys: ['name'],
|
|
149
|
+
value: {
|
|
150
|
+
name: input.name,
|
|
151
|
+
displayName,
|
|
152
|
+
description: input.description,
|
|
153
|
+
textureUrl,
|
|
154
|
+
// null, not undefined: it survives JSON and reads as "top texture on every face".
|
|
155
|
+
sideTextureUrl,
|
|
156
|
+
textureSize: TEXTURE_SIZE,
|
|
157
|
+
createdAt: new Date().toISOString(),
|
|
158
|
+
},
|
|
159
|
+
}], {
|
|
160
|
+
blockTypeName: input.name,
|
|
161
|
+
textureUrl,
|
|
162
|
+
...(sideTextureUrl ? { sideTextureUrl } : {}),
|
|
163
|
+
billable: true,
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
//# sourceMappingURL=block-type.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"block-type.js","sourceRoot":"","sources":["../../src/generators/block-type.ts"],"names":[],"mappings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,EAAE;YACF,sFAAsF;YACtF,0FAA0F;YAC1F,0FAA0F;YAC1F,2FAA2F;YAC3F,oDAAoD;YACpD,IAAI,EAAE,YAAY;YAClB,IAAI,EAAE,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;YAC9C,SAAS,EAAE,CAAC,MAAM,CAAC;YACnB,KAAK,EAAE;gBACL,IAAI,EAAE,KAAK,CAAC,IAAI;gBAChB,WAAW;gBACX,WAAW,EAAE,KAAK,CAAC,WAAW;gBAC9B,UAAU;gBACV,kFAAkF;gBAClF,cAAc;gBACd,WAAW,EAAE,YAAY;gBACzB,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;aACpC;SACF,CAAC,EACF;QACE,aAAa,EAAE,KAAK,CAAC,IAAI;QACzB,UAAU;QACV,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7C,QAAQ,EAAE,IAAI;KACf,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -7,14 +7,14 @@ export declare const characterParamsSchema: z.ZodObject<{
|
|
|
7
7
|
headScale: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
8
8
|
assetId: z.ZodOptional<z.ZodString>;
|
|
9
9
|
}, "strict", z.ZodTypeAny, {
|
|
10
|
-
prompt: string;
|
|
11
10
|
name: string;
|
|
11
|
+
prompt: string;
|
|
12
12
|
applyToPlayer: boolean;
|
|
13
13
|
headScale: number;
|
|
14
14
|
assetId?: string | undefined;
|
|
15
15
|
}, {
|
|
16
|
-
prompt: string;
|
|
17
16
|
name: string;
|
|
17
|
+
prompt: string;
|
|
18
18
|
assetId?: string | undefined;
|
|
19
19
|
applyToPlayer?: boolean | undefined;
|
|
20
20
|
headScale?: number | undefined;
|
|
@@ -8,19 +8,19 @@ export declare const imageAssetParamsSchema: z.ZodObject<{
|
|
|
8
8
|
referenceImageUrl: z.ZodOptional<z.ZodString>;
|
|
9
9
|
assetId: z.ZodOptional<z.ZodString>;
|
|
10
10
|
}, "strict", z.ZodTypeAny, {
|
|
11
|
-
prompt: string;
|
|
12
11
|
name: string;
|
|
13
|
-
|
|
12
|
+
prompt: string;
|
|
14
13
|
height: number;
|
|
14
|
+
width: number;
|
|
15
15
|
referenceImageUrl?: string | undefined;
|
|
16
16
|
assetId?: string | undefined;
|
|
17
17
|
}, {
|
|
18
|
-
prompt: string;
|
|
19
18
|
name: string;
|
|
19
|
+
prompt: string;
|
|
20
20
|
referenceImageUrl?: string | undefined;
|
|
21
|
-
assetId?: string | undefined;
|
|
22
|
-
width?: number | undefined;
|
|
23
21
|
height?: number | undefined;
|
|
22
|
+
width?: number | undefined;
|
|
23
|
+
assetId?: string | undefined;
|
|
24
24
|
}>;
|
|
25
25
|
/**
|
|
26
26
|
* The schema's INPUT type — callers may omit the defaulted dimensions. The
|
|
@@ -42,10 +42,10 @@ export declare const propVoxelParamsSchema: z.ZodObject<{
|
|
|
42
42
|
grid: z.ZodDefault<z.ZodOptional<z.ZodUnion<[z.ZodLiteral<0>, z.ZodLiteral<32>, z.ZodLiteral<64>, z.ZodLiteral<128>, z.ZodLiteral<256>, z.ZodLiteral<512>]>>>;
|
|
43
43
|
}, "strict", z.ZodTypeAny, {
|
|
44
44
|
prompt: string;
|
|
45
|
-
grid: 0 | 64 | 32 |
|
|
45
|
+
grid: 0 | 64 | 32 | 256 | 512 | 128;
|
|
46
46
|
}, {
|
|
47
47
|
prompt: string;
|
|
48
|
-
grid?: 0 | 64 | 32 |
|
|
48
|
+
grid?: 0 | 64 | 32 | 256 | 512 | 128 | undefined;
|
|
49
49
|
}>;
|
|
50
50
|
export type PropVoxelParams = z.input<typeof propVoxelParamsSchema>;
|
|
51
51
|
export type PropVoxelResult = AssetResultBase & {
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,10 @@ export { AssetForgerClient } from './forger-client.js';
|
|
|
5
5
|
export type { AssetForgerCredentials } from './forger-client.js';
|
|
6
6
|
export { generateSkybox, skyboxParamsSchema } from './generators/skybox.js';
|
|
7
7
|
export type { SkyboxParams, SkyboxResult } from './generators/skybox.js';
|
|
8
|
+
export { generateBackground, backgroundParamsSchema } from './generators/background.js';
|
|
9
|
+
export type { BackgroundParams, BackgroundResult } from './generators/background.js';
|
|
10
|
+
export { generateBlockType, blockTypeParamsSchema } from './generators/block-type.js';
|
|
11
|
+
export type { BlockTypeParams, BlockTypeResult } from './generators/block-type.js';
|
|
8
12
|
export { generateSoundEffect, soundEffectParamsSchema } from './generators/sound-effect.js';
|
|
9
13
|
export type { SoundEffectParams, SoundEffectResult } from './generators/sound-effect.js';
|
|
10
14
|
export { generateImageAsset, imageAssetParamsSchema } from './generators/image.js';
|
|
@@ -21,7 +25,7 @@ export { fetchContentLength } from './http.js';
|
|
|
21
25
|
export { PIXAR_VOXEL_STYLE, MAX_COVER_DESIGN_CHARS, buildCoverArtPrompt } from './cover-prompt.js';
|
|
22
26
|
export { JUDGE_DIMENSIONS, judgeScorecardSchema } from './judge-scorecard.js';
|
|
23
27
|
export type { JudgeDimension, JudgeScorecard } from './judge-scorecard.js';
|
|
24
|
-
export { JUDGE_GENRE_HINTS, JUDGE_RUBRIC, MAX_JUDGE_DESIGN_CHARS, MAX_JUDGE_SCENE_FACTS_CHARS, MAX_JUDGE_VERIFY_CHARS, buildJudgeRubric, } from './judge-prompt.js';
|
|
28
|
+
export { JUDGE_GENRE_HINTS, JUDGE_MOBILE_HINT, JUDGE_RUBRIC, MAX_JUDGE_DESIGN_CHARS, MAX_JUDGE_SCENE_FACTS_CHARS, MAX_JUDGE_VERIFY_CHARS, buildJudgeRubric, } from './judge-prompt.js';
|
|
25
29
|
export type { JudgeRubricInput } from './judge-prompt.js';
|
|
26
30
|
export { TERMINAL_FAILURE_CODES, TERMINAL_FAILURE_VERSION, buildTerminalFailure, isTerminalFailureCode, legacyErrorTypeFor, parseTerminalFailure, } from './terminal-failure.js';
|
|
27
31
|
export type { BuildTerminalFailureInput, LegacyErrorType, TerminalFailure, TerminalFailureCode, TerminalFailureDetail, } from './terminal-failure.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,UAAU,EACV,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,UAAU,GACX,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAC5F,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACnF,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACrF,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACtE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,cA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EACL,sBAAsB,EACtB,qBAAqB,EACrB,2BAA2B,EAC3B,gCAAgC,EAChC,gCAAgC,EAChC,qBAAqB,GACtB,MAAM,2BAA2B,CAAC;AACnC,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACnG,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC9E,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,YAAY,EACZ,sBAAsB,EACtB,2BAA2B,EAC3B,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAM1D,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACxB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EACV,yBAAyB,EACzB,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,uBAAuB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,8 @@ export { buildUpsertPredicate, isUpsertRootPatch, validateWorldPatch } from './w
|
|
|
2
2
|
export { fail, ok } from './result.js';
|
|
3
3
|
export { AssetForgerClient } from './forger-client.js';
|
|
4
4
|
export { generateSkybox, skyboxParamsSchema } from './generators/skybox.js';
|
|
5
|
+
export { generateBackground, backgroundParamsSchema } from './generators/background.js';
|
|
6
|
+
export { generateBlockType, blockTypeParamsSchema } from './generators/block-type.js';
|
|
5
7
|
export { generateSoundEffect, soundEffectParamsSchema } from './generators/sound-effect.js';
|
|
6
8
|
export { generateImageAsset, imageAssetParamsSchema } from './generators/image.js';
|
|
7
9
|
export { generateCharacter, characterParamsSchema } from './generators/character.js';
|
|
@@ -11,7 +13,7 @@ export { generateAnimationAsset, animationParamsSchema, getConfiguredAnimationMo
|
|
|
11
13
|
export { fetchContentLength } from './http.js';
|
|
12
14
|
export { PIXAR_VOXEL_STYLE, MAX_COVER_DESIGN_CHARS, buildCoverArtPrompt } from './cover-prompt.js';
|
|
13
15
|
export { JUDGE_DIMENSIONS, judgeScorecardSchema } from './judge-scorecard.js';
|
|
14
|
-
export { JUDGE_GENRE_HINTS, JUDGE_RUBRIC, MAX_JUDGE_DESIGN_CHARS, MAX_JUDGE_SCENE_FACTS_CHARS, MAX_JUDGE_VERIFY_CHARS, buildJudgeRubric, } from './judge-prompt.js';
|
|
16
|
+
export { JUDGE_GENRE_HINTS, JUDGE_MOBILE_HINT, JUDGE_RUBRIC, MAX_JUDGE_DESIGN_CHARS, MAX_JUDGE_SCENE_FACTS_CHARS, MAX_JUDGE_VERIFY_CHARS, buildJudgeRubric, } from './judge-prompt.js';
|
|
15
17
|
// The agent↔client terminal-failure contract. Also published as the
|
|
16
18
|
// `@bitmagic/asset-core/terminal-failure` subpath: this barrel eagerly pulls in
|
|
17
19
|
// the generators (and therefore zod, the forger client, and node http helpers),
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5E,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,M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const MAX_JUDGE_SCENE_FACTS_CHARS = 2500;
|
|
|
21
21
|
* not gameplay.
|
|
22
22
|
*/
|
|
23
23
|
export declare const JUDGE_RUBRIC = "Score each dimension from 1 to 10:\n\n- visual-quality: Does the frame look like a finished game? 3 = flat default\n materials, untextured primitives, harsh unshadowed lighting. 8 = cohesive\n palette, deliberate lighting, materials and shapes that read as one art style.\n- readability: Could a new player tell from this frame alone what to do and\n where to go? 3 = player, goals and hazards blend into the background. 8 = the\n player character, the route and the interactive elements pop at a glance.\n- design-fidelity: Does the frame match the game the design document describes?\n 3 = generic scene that could be any game. 8 = the described setting, mood and\n core mechanic are recognizably on screen.\n- polish: 3 = placeholder blocks, floating or intersecting props, empty default\n skybox, raw default HUD. 8 = grounded objects, dressed edges of the world,\n HUD that belongs to this game.";
|
|
24
|
+
/**
|
|
25
|
+
* What changes when the frame is a phone screenshot rather than a desktop one.
|
|
26
|
+
*
|
|
27
|
+
* It adds no dimension — the scorecard schema is fixed (judge-scorecard.ts) and a fifth score
|
|
28
|
+
* would not survive the wire contract. What it does is re-point the EXISTING dimensions at a
|
|
29
|
+
* screen held in a hand: `readability` becomes "can a thumb reach this and can an eye read it at
|
|
30
|
+
* this size", and `visual-quality`/`polish` become "what detail actually survives here".
|
|
31
|
+
*
|
|
32
|
+
* The last paragraph is the load-bearing one. Without it a vision model reliably reports the
|
|
33
|
+
* touch controls themselves as clutter and the missing key hints as a defect, which is exactly
|
|
34
|
+
* backwards — those controls are the mobile build working.
|
|
35
|
+
*/
|
|
36
|
+
export declare const JUDGE_MOBILE_HINT = "This frame is a PHONE screen, captured at the phone's own\nresolution with the game's touch controls live on top of it. Judge it as something held in one or\ntwo hands \u2014 the same dimensions, read differently:\n\n- readability: are the touch controls (joystick, action buttons) actually visible against the\n scene, and big enough to hit with a thumb? Is the HUD legible at THIS size, not merely present?\n Is anything the player must read or press sitting where a hand covers it, or jammed into the\n very edge of the screen?\n- visual-quality and polish: grade the detail that survives at this resolution. Detail too small\n to make out here is not detail the player gets.\n- Judge the framing this aspect ratio gives: does the camera show enough of the world ahead of\n the player to actually play, or is the important part cropped away?\n\nDo not penalise missing desktop affordances \u2014 key hints, mouse or crosshair cues and hover states\nbelong to the other platform. Do not report the touch controls themselves as clutter unless they\ncover something the player needs to see.";
|
|
24
37
|
/**
|
|
25
38
|
* Genre-specific bullets, keyed loosely on the engine's mechanic recipe names
|
|
26
39
|
* (mechanic-platformer.md and friends). Deliberately short: these steer the
|
|
@@ -33,6 +46,11 @@ export interface JudgeRubricInput {
|
|
|
33
46
|
designText: string;
|
|
34
47
|
/** Optional genre key; unknown keys are ignored. */
|
|
35
48
|
genre?: string;
|
|
49
|
+
/**
|
|
50
|
+
* Which platform's frame is being judged. 'mobile' adds JUDGE_MOBILE_HINT; anything else, and
|
|
51
|
+
* absence, compose exactly the rubric that was composed before this existed.
|
|
52
|
+
*/
|
|
53
|
+
platform?: 'desktop' | 'mobile';
|
|
36
54
|
/** One-paragraph verify summary: run state plus a console tail. */
|
|
37
55
|
verifySummary?: string;
|
|
38
56
|
/**
|
|
@@ -49,5 +67,5 @@ export interface JudgeRubricInput {
|
|
|
49
67
|
* the text part alongside the screenshot(s); the server prepends its fixed
|
|
50
68
|
* judging instructions and appends the JSON output directive.
|
|
51
69
|
*/
|
|
52
|
-
export declare function buildJudgeRubric({ designText, genre, verifySummary, sceneFacts }: JudgeRubricInput): string;
|
|
70
|
+
export declare function buildJudgeRubric({ designText, genre, platform, verifySummary, sceneFacts, }: JudgeRubricInput): string;
|
|
53
71
|
//# sourceMappingURL=judge-prompt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"judge-prompt.d.ts","sourceRoot":"","sources":["../src/judge-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,yEAAyE;AACzE,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAE3C,4EAA4E;AAC5E,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAE3C,yDAAyD;AACzD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ACrB;AAOD;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,UAAU,EACV,KAAK,EACL,QAAQ,EACR,aAAa,EACb,UAAU,GACX,EAAE,gBAAgB,GAAG,MAAM,CAuC3B"}
|
package/dist/judge-prompt.js
CHANGED
|
@@ -35,6 +35,34 @@ export const JUDGE_RUBRIC = `Score each dimension from 1 to 10:
|
|
|
35
35
|
- polish: 3 = placeholder blocks, floating or intersecting props, empty default
|
|
36
36
|
skybox, raw default HUD. 8 = grounded objects, dressed edges of the world,
|
|
37
37
|
HUD that belongs to this game.`;
|
|
38
|
+
/**
|
|
39
|
+
* What changes when the frame is a phone screenshot rather than a desktop one.
|
|
40
|
+
*
|
|
41
|
+
* It adds no dimension — the scorecard schema is fixed (judge-scorecard.ts) and a fifth score
|
|
42
|
+
* would not survive the wire contract. What it does is re-point the EXISTING dimensions at a
|
|
43
|
+
* screen held in a hand: `readability` becomes "can a thumb reach this and can an eye read it at
|
|
44
|
+
* this size", and `visual-quality`/`polish` become "what detail actually survives here".
|
|
45
|
+
*
|
|
46
|
+
* The last paragraph is the load-bearing one. Without it a vision model reliably reports the
|
|
47
|
+
* touch controls themselves as clutter and the missing key hints as a defect, which is exactly
|
|
48
|
+
* backwards — those controls are the mobile build working.
|
|
49
|
+
*/
|
|
50
|
+
export const JUDGE_MOBILE_HINT = `This frame is a PHONE screen, captured at the phone's own
|
|
51
|
+
resolution with the game's touch controls live on top of it. Judge it as something held in one or
|
|
52
|
+
two hands — the same dimensions, read differently:
|
|
53
|
+
|
|
54
|
+
- readability: are the touch controls (joystick, action buttons) actually visible against the
|
|
55
|
+
scene, and big enough to hit with a thumb? Is the HUD legible at THIS size, not merely present?
|
|
56
|
+
Is anything the player must read or press sitting where a hand covers it, or jammed into the
|
|
57
|
+
very edge of the screen?
|
|
58
|
+
- visual-quality and polish: grade the detail that survives at this resolution. Detail too small
|
|
59
|
+
to make out here is not detail the player gets.
|
|
60
|
+
- Judge the framing this aspect ratio gives: does the camera show enough of the world ahead of
|
|
61
|
+
the player to actually play, or is the important part cropped away?
|
|
62
|
+
|
|
63
|
+
Do not penalise missing desktop affordances — key hints, mouse or crosshair cues and hover states
|
|
64
|
+
belong to the other platform. Do not report the touch controls themselves as clutter unless they
|
|
65
|
+
cover something the player needs to see.`;
|
|
38
66
|
/**
|
|
39
67
|
* Genre-specific bullets, keyed loosely on the engine's mechanic recipe names
|
|
40
68
|
* (mechanic-platformer.md and friends). Deliberately short: these steer the
|
|
@@ -70,8 +98,12 @@ function excerpt(text, maxChars) {
|
|
|
70
98
|
* the text part alongside the screenshot(s); the server prepends its fixed
|
|
71
99
|
* judging instructions and appends the JSON output directive.
|
|
72
100
|
*/
|
|
73
|
-
export function buildJudgeRubric({ designText, genre, verifySummary, sceneFacts }) {
|
|
101
|
+
export function buildJudgeRubric({ designText, genre, platform, verifySummary, sceneFacts, }) {
|
|
74
102
|
const sections = [JUDGE_RUBRIC];
|
|
103
|
+
// Immediately after the rubric it modifies, and before the genre hints: a small model weights
|
|
104
|
+
// early context most, and "this is a phone" changes how every bullet above should be read.
|
|
105
|
+
if (platform === 'mobile')
|
|
106
|
+
sections.push(JUDGE_MOBILE_HINT);
|
|
75
107
|
const genreKey = genre?.trim().toLowerCase() ?? '';
|
|
76
108
|
const genreHints = JUDGE_GENRE_HINTS[genreKey];
|
|
77
109
|
if (genreHints) {
|
package/dist/judge-prompt.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"judge-prompt.js","sourceRoot":"","sources":["../src/judge-prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,yEAAyE;AACzE,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAE3C,4EAA4E;AAC5E,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC;AAE3C,yDAAyD;AACzD,MAAM,CAAC,MAAM,2BAA2B,G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