[GH-ISSUE #3321] [Issue]: Game Mode NPC portraits image generation does not use description: 3.0+1.0 This time with actual useful information #1800

Closed
opened 2026-10-21 05:42:50 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @JurijPietrowicz on GitHub (Jul 6, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3321

Originally assigned to: @SpicyMarinara on GitHub.

Summary

NPC portrait prompts for Game Mode are being compacted too aggressively by the shared image prompt compiler. Important canonical NPC identity details such as species, fur/hair color, clothing, and carried objects are dropped, while generic boilerplate fragments like body plan and silhouette survive.

Expected behavior

NPC portrait generation should preserve the GM-created canonical visual description, especially identity-critical details such as species/body type, fur/hair/skin color, garments, accessories, tails/ears/horns/wings, and carried props.

For example, this description:

A silver-furred fox-woman in a persimmon kimono whose laughter tinkles like teacups; she speaks in warm riddles and insists Tanaka stay mortal, though the debt-scroll tucked in her sleeve already claims three of his tomorrows.

should produce a prompt that still contains something like:

female fox-woman, silver fur, persimmon kimono, debt-scroll tucked in sleeve, Soft watercolor ukiyo-e fantasy, portrait, upper body, centered composition

A robust fix should also pass the entire unaltered canonical description alongside the distilled tags, so downstream image models still receive the full subject identity even when tag extraction misses a detail.

Actual behavior

The compiled provider prompt loses nearly all useful NPC-specific visual identity and keeps mostly generic tags:

female, Soft watercolor ukiyo-e fantasy, and silhouette, one face, body plan, upper body, portrait, centered composition, one portrait

Negative prompt:

text, watermark, logo, signature, low quality, blurry, UI, speech bubble, split screen, panel, collage, contact sheet, grid, four portraits, multiple portraits, duplicated face, extra head, extra person, bad anatomy

The issue appears in the portrait compacting path:

  • packages/shared/src/utils/image-prompt-compiler.ts
    • compileImagePrompt(...) starts the provider prompt pipeline: line 29
    • compactVisualPrompt is enabled for portrait, avatar, and sprite unless profile base style is z_image_turbo: lines 46-48
    • deriveTaggedSourceCues(...) only extracts gender/human/age cues, not species or clothing: lines 414-425
    • distillTaggedPromptSource(...) distills source prompt text before splitting: lines 356-412
    • distillVisualPhrases(...) has a narrow visual vocabulary and misses fox-woman, silver-furred, kimono, sleeve, etc.: lines 531-570
    • shouldKeepTaggedSourceFragment(...) rejects fragments containing words like debt, which can discard visually relevant props such as debt-scroll: lines 591-605
    • hasVisualCue(...) does not include common non-human/fantasy/clothing cues like fox, kitsune, fur, kimono, tail, etc.: lines 608-612

Related Game Mode prompt construction:

  • packages/server/src/services/game/game-asset-generation.ts

    • buildNpcAppearanceLine(...) creates the canonical appearance line: lines 359-374
    • npcPortraitVariables(...) detects explicit non-human cues and adds non-human preservation instructions: lines 376-389
    • buildNpcPortraitProviderPrompt(...) builds the raw prompt, optionally runs dynamic prompt generation, then compiles it: lines 460-481
    • compileGameImagePrompt(...) calls the shared compileImagePrompt(...): lines 488-518
    • Debug logging prints the compiled provider prompt, not the raw template: lines 562-573
  • packages/server/src/routes/game.routes.ts

    • resolveNpcPortraitAppearance(...) merges canonical NPC description, request description, present-character appearance/outfit/mood, and notes: lines 3886-3910
    • /game/generate-assets/preview builds the compiled review prompt: lines 10671-10705
    • /game/generate-assets calls generateNpcPortrait(...): lines 11090-11119
    • Image style profiles are loaded and passed into portrait generation: lines 10824-10828
  • packages/server/src/services/prompt-overrides/registry/game-assets.ts

    • GAME_NPC_PORTRAIT default prompt builder: lines 32-71

Steps to reproduce

  1. Create a Game Mode session with generated NPC portraits enabled and any style profile except z-image-turbo.
  2. Nudge the model to generate NPCs with distinct features like: kitsune, lizard people, etc.
  3. Trigger NPC portrait generation, or enable “Expose image prompts before sending” and inspect the previewed portrait prompt.

Environment

  • Marinara Engine version: 2.1.0
  • Install type: source
  • OS + version: Fedora 44
  • Browser or app shell: Firefox 152.0

Logs, screenshots, or video

Observed compiled positive prompt:

female, Soft watercolor ukiyo-e fantasy, and silhouette, one face, body plan, upper body, portrait, centered composition, one portrait

Observed negative prompt:

text, watermark, logo, signature, low quality, blurry, UI, speech bubble, split screen, panel, collage, contact sheet, grid, four portraits, multiple portraits, duplicated face, extra head, extra person, bad anatomy

The raw NPC description contains silver-furred fox-woman, persimmon kimono, and debt-scroll tucked in her sleeve, but these are absent from the final provider prompt.

Additional context

Suggested fix:

  1. Pass the full unaltered canonical NPC description along with the distilled tags.
  2. Expand portrait cue extraction in distillVisualPhrases(...) / hasVisualCue(...) to recognize non-human and fantasy avatar cues: fox, kitsune, fur, furred, tail, ears, horns, wings, kimono, sleeve, scroll, etc.

Temporary workaround: select the z-image-turbo style profile because the normal portrait compacting path is where the identity loss occurs. However, it creates another issue as the prompt then doesn't fit in the 1400-character limit.

Template check

  • I DID NOT read this template and provide the requested details.
Originally created by @JurijPietrowicz on GitHub (Jul 6, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/3321 Originally assigned to: @SpicyMarinara on GitHub. ## Summary NPC portrait prompts for Game Mode are being compacted too aggressively by the shared image prompt compiler. Important canonical NPC identity details such as species, fur/hair color, clothing, and carried objects are dropped, while generic boilerplate fragments like `body plan` and `silhouette` survive. ## Expected behavior NPC portrait generation should preserve the GM-created canonical visual description, especially identity-critical details such as species/body type, fur/hair/skin color, garments, accessories, tails/ears/horns/wings, and carried props. For example, this description: ```text A silver-furred fox-woman in a persimmon kimono whose laughter tinkles like teacups; she speaks in warm riddles and insists Tanaka stay mortal, though the debt-scroll tucked in her sleeve already claims three of his tomorrows. ``` should produce a prompt that still contains something like: ```text female fox-woman, silver fur, persimmon kimono, debt-scroll tucked in sleeve, Soft watercolor ukiyo-e fantasy, portrait, upper body, centered composition ``` A robust fix should also pass the entire unaltered canonical description alongside the distilled tags, so downstream image models still receive the full subject identity even when tag extraction misses a detail. ## Actual behavior The compiled provider prompt loses nearly all useful NPC-specific visual identity and keeps mostly generic tags: ```text female, Soft watercolor ukiyo-e fantasy, and silhouette, one face, body plan, upper body, portrait, centered composition, one portrait ``` Negative prompt: ```text text, watermark, logo, signature, low quality, blurry, UI, speech bubble, split screen, panel, collage, contact sheet, grid, four portraits, multiple portraits, duplicated face, extra head, extra person, bad anatomy ``` The issue appears in the portrait compacting path: - `packages/shared/src/utils/image-prompt-compiler.ts` - `compileImagePrompt(...)` starts the provider prompt pipeline: line 29 - `compactVisualPrompt` is enabled for `portrait`, `avatar`, and `sprite` unless profile base style is `z_image_turbo`: lines 46-48 - `deriveTaggedSourceCues(...)` only extracts gender/human/age cues, not species or clothing: lines 414-425 - `distillTaggedPromptSource(...)` distills source prompt text before splitting: lines 356-412 - `distillVisualPhrases(...)` has a narrow visual vocabulary and misses `fox-woman`, `silver-furred`, `kimono`, `sleeve`, etc.: lines 531-570 - `shouldKeepTaggedSourceFragment(...)` rejects fragments containing words like `debt`, which can discard visually relevant props such as `debt-scroll`: lines 591-605 - `hasVisualCue(...)` does not include common non-human/fantasy/clothing cues like `fox`, `kitsune`, `fur`, `kimono`, `tail`, etc.: lines 608-612 Related Game Mode prompt construction: - `packages/server/src/services/game/game-asset-generation.ts` - `buildNpcAppearanceLine(...)` creates the canonical appearance line: lines 359-374 - `npcPortraitVariables(...)` detects explicit non-human cues and adds non-human preservation instructions: lines 376-389 - `buildNpcPortraitProviderPrompt(...)` builds the raw prompt, optionally runs dynamic prompt generation, then compiles it: lines 460-481 - `compileGameImagePrompt(...)` calls the shared `compileImagePrompt(...)`: lines 488-518 - Debug logging prints the compiled provider prompt, not the raw template: lines 562-573 - `packages/server/src/routes/game.routes.ts` - `resolveNpcPortraitAppearance(...)` merges canonical NPC description, request description, present-character appearance/outfit/mood, and notes: lines 3886-3910 - `/game/generate-assets/preview` builds the compiled review prompt: lines 10671-10705 - `/game/generate-assets` calls `generateNpcPortrait(...)`: lines 11090-11119 - Image style profiles are loaded and passed into portrait generation: lines 10824-10828 - `packages/server/src/services/prompt-overrides/registry/game-assets.ts` - `GAME_NPC_PORTRAIT` default prompt builder: lines 32-71 ## Steps to reproduce 1. Create a Game Mode session with generated NPC portraits enabled and any style profile except `z-image-turbo`. 2. Nudge the model to generate NPCs with distinct features like: kitsune, lizard people, etc. 3. Trigger NPC portrait generation, or enable “Expose image prompts before sending” and inspect the previewed portrait prompt. ## Environment - Marinara Engine version: 2.1.0 - Install type: source - OS + version: Fedora 44 - Browser or app shell: Firefox 152.0 ## Logs, screenshots, or video Observed compiled positive prompt: ```text female, Soft watercolor ukiyo-e fantasy, and silhouette, one face, body plan, upper body, portrait, centered composition, one portrait ``` Observed negative prompt: ```text text, watermark, logo, signature, low quality, blurry, UI, speech bubble, split screen, panel, collage, contact sheet, grid, four portraits, multiple portraits, duplicated face, extra head, extra person, bad anatomy ``` The raw NPC description contains `silver-furred fox-woman`, `persimmon kimono`, and `debt-scroll tucked in her sleeve`, but these are absent from the final provider prompt. ## Additional context Suggested fix: 1. Pass the full unaltered canonical NPC description along with the distilled tags. 2. Expand portrait cue extraction in `distillVisualPhrases(...)` / `hasVisualCue(...)` to recognize non-human and fantasy avatar cues: `fox`, `kitsune`, `fur`, `furred`, `tail`, `ears`, `horns`, `wings`, `kimono`, `sleeve`, `scroll`, etc. Temporary workaround: select the `z-image-turbo` style profile because the normal portrait compacting path is where the identity loss occurs. However, it creates another issue as the prompt then doesn't fit in the 1400-character limit. ## Template check - [ ] I DID NOT read this template and provide the requested details.
bsakaguchi 2026-10-21 05:42:50 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@SpicyMarinara commented on GitHub (Jul 7, 2026):

Codex is picking this up for the v2.1.1 issue sweep in draft PR #3331.

<!-- gh-comment-id:4902332918 --> @SpicyMarinara commented on GitHub (Jul 7, 2026): Codex is picking this up for the v2.1.1 issue sweep in draft PR #3331.
Author
Owner

@SpicyMarinara commented on GitHub (Jul 7, 2026):

Fixed in PR #3331 and merged to staging for v2.1.1. Thank you for the report.

<!-- gh-comment-id:4902883684 --> @SpicyMarinara commented on GitHub (Jul 7, 2026): Fixed in PR #3331 and merged to staging for v2.1.1. Thank you for the report.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#1800
No description provided.