DSH-Galgame-Generator: Turning Script Documents and Assets into Playable Galgame Web Pages

Preface

DSH’s plugin ecosystem emphasizes “everything is a plugin,” and the community directory is an independent site with no official affiliation to DeepSeek / High-Flyer.

For agent developers, one relatively specific need is: there is already a Markdown script document in the workspace, along with some character portraits, background images, music, or animation assets, and you want to turn it into a visual novel page that can be opened directly in the browser. Manual implementation usually requires handling script parsing, option branching, variable conditions, portrait switching, BGM playback, save/load, and a frontend player.

dsh-galgame-generator connects this workflow into the DSH Web GUI: place assets in a conventional directory, let the assistant invoke model tools, and it generates a self-contained .galgame.html webpage.

What This Is

  • Plugin name: dsh-galgame-generator
  • Maintainer: baisama-cloud
  • License: MIT
  • GitHub repository: https://github.com/baisama-cloud/dsh-galgame-generator

One-sentence positioning: provide a script document + portrait/background/music assets, and you get a playable visual novel (Galgame) webpage.

It is a DSH web-side plugin. The documentation lists it as targeting the web client platform, injecting:

  • @deepseek-ai/dsh-client-runtime
  • @deepseek-ai/dsh-client-ui-slots

It also configures a bundle patch:

./cordis.patch.yml

Runtime environment requirements:

Node.js >= 18.18

Core Features

Generated Artifact

The plugin’s primary output is a self-contained standalone webpage:

<title>.galgame.html

This webpage can be opened and played directly in the browser, with portraits, backgrounds, and music all embedded. After generation, it can be shared with others without depending on the original workspace.

After installation and refreshing the DSH Web GUI page, the following appears at the bottom of the sidebar:

🎮 Galgame

It can be played directly within the DSH Web GUI interface.

Script Parsing

The plugin supports parsing the following from scripts:

  • Characters
  • Backgrounds
  • Dialogue lines
  • Narration
  • Option branches
  • Jumps
  • Endings
  • Variables
  • if conditional branches

In other words, the script document doesn’t need to be pure dialogue; it can also include branches, variable checks, and multiple endings.

Portraits and Expressions

Portraits follow the current speaker. When narration appears, the portrait fades out.

Explicit portrait control is supported:

[show name]
[hide name]

The transition uses a 0.35s fade in/out.

If the same character has multiple portrait or expression variants, they can be switched in the script:

[expression name expression_name]

Expression states are saved with save data.

Background Music

Background music control is supported:

[bgm music.mp3]
[bgm off]
[bgm stop]
[bgm music.mp3 0.5]

The last syntax is used to control volume.

Animations and CG

Opening animations, ending animations, and CG illustration animations are supported:

[op]
[ed]
[cg]

CG assets are placed in the img_cg/ directory. Verified formats supported by img_cg/ include:

gif
svg
mp4
webm
avi

Save System and Player

The generated player supports:

  • Typewriter effect
  • Auto-play
  • Fast-forward
  • History log
  • Ending screen

Saves use browser localStorage. Nine save slots are provided by default, which can also be adjusted via a configuration item in the script:

[save N]

The slot count ranges from 1 to 20, with a default of 9.

Model Tools

The plugin provides two model tools:

galgame_scan
galgame_build
  • galgame_scan: Scans script documents and assets in the workspace.
  • galgame_build: Parses the script document and generates the Galgame webpage.

Installation and Activation

Installation follows the same approach as DSH web profile plugins. The README install example uses pnpm pack to generate a tarball and then adds it to the web profile.

Here are the installation steps:

  1. Execute the pack command in the plugin repository directory:
pnpm pack
  1. Copy the generated .tgz file to your DSH web profile. For example, you can place it at:
~/.dsh/profiles/web
  1. Add the dependency under the web profile. Replace the path and filename below with the actual file you generated:
cd ~/.dsh/profiles/web
pnpm add /path/to/dsh-galgame-generator-<actual_generated_tgz_filename>
  1. Restart the running dsh web service, then refresh the browser page.

After refreshing, the following should appear at the bottom of the sidebar:

🎮 Galgame

After installation, the plugin also automatically writes an agent preset named:

Galgame Generation Mode

You can select it from the preset chip when starting a new session, or set it as the default under Agent Presets in Settings.

This preset is based on a full copy of the included standard preset, with an added generation guidance persona. If customization is needed, you can edit:

~/.dsh/.agent-presets/galgame/

If you don’t select this preset, you can still manually call the tools in any session:

galgame_scan
galgame_build

Manual calls require passing the absolute path of the script document.

Typical Usage

Preparing Assets

Assets are placed in conventional locations at the workspace root.

Asset Type Directory or Location Example
Script document Any .md / .txt in the workspace root Summer Memories.md
Character portraits img_human/ img_human/mei.png
Background images img_bg/ img_bg/classroom.png
Background music audio/ audio/bgm.mp3
Opening/ending animations, CG illustrations img_cg/ img_cg/opening.gif, img_cg/cg1.gif, img_cg/ending.mp4

Supported asset formats:

Images: png / jpg / jpeg / webp / gif / svg
Music: mp3 / ogg / wav / m4a / mp4 / flac

Using Generation Mode

  1. Place the script document and assets according to the directory conventions above.

  2. When starting a new session, select from the preset chip:

Galgame Generation Mode
  1. Tell the assistant:
Generate
  1. The assistant first executes:
galgame_scan

to scan the workspace and locate the script document, portraits, backgrounds, music, and CG assets.

  1. Then it executes:
galgame_build

to generate the game based on the script. The output is written back to the workspace and synced to memory for the 🎮 Galgame player to load.

  1. After generation completes, open the generated:
<title>.galgame.html

to play.

Manually Calling Tools

If you’re not in a dedicated preset session, you can still have the assistant manually call the tools in any session. For example, provide the absolute path of the script document:

Please call galgame_scan and galgame_build. The absolute path of the script document is /path/to/Summer_Memories.md

The tools will generate the webpage based on the script and workspace assets.

Self-Check

The repository provides a self-check command:

node scripts/check.mjs

This command performs syntax, manifest, and bundle contract self-checks.

Script Syntax Quick Reference

Below are script patterns verified in the documentation.

Pattern Meaning
Name: dialogue Character dialogue, automatically displays the character’s portrait
(narration) or plain text line Narration, portrait fades out
[bg background_name] Switch background
[show name] Explicitly show and lock portrait
[hide name] Explicitly hide portrait
[expression name expression_name] Switch character expression or portrait variant
[bgm music.mp3] Play background music
[bgm off] Stop background music
[bgm stop] Stop background music
[bgm music.mp3 0.5] Play with volume control
[variable name = value] Variable assignment
[variable name + 1] Variable increment/decrement
[if variable >= 2][else][endif] Conditional branch
[choice] + - text → label Branch option
### label_name Jump point
[jump label] Jump
[op] Opening animation
[ed] Ending animation
[cg] CG illustration animation
[end ending_name] End the game
[save N] Set the number of save slots, range 1 to 20

Use Cases and Notes

Suitable for the following scenarios:

  • You are already using agent sessions in the DSH Web GUI.
  • You already have a .md or .txt script document.
  • You have character portraits, background images, music, or CG assets.
  • You want to generate a self-contained webpage for local opening or distribution.
  • You want the model to directly scan the workspace and invoke tools for generation, rather than manually building a visual novel frontend.

Usage notes:

  • The plugin runs with the permissions of the current dsh process and can access workspace assets readable by that process. Before installation, review the source code, dependencies, license, and the actual generated webpage output.
  • Asset directories need to follow the conventions; otherwise, galgame_scan may fail to correctly locate the script and assets.
  • Saves are stored in browser localStorage and may not be shared across different browsers or devices.
  • The generated .galgame.html is a self-contained webpage, but the assets within it come from files you provided in the workspace; verify asset licensing before distribution.
  • The tarball filename in the README install example may not match the current version; use the filename generated by pnpm pack during actual installation.
  • The documentation shows both pnpm pack and scripts.pack in package.json set to npm pack; these two may have packaging differences. It is recommended to rely on the actual execution result in the repository and the generated .tgz file.
  • Verified documentation does not include star counts, categories, or directory page URLs, so this article does not state these as established facts.

Conclusion

The value of dsh-galgame-generator is fairly focused: convert a script document, portraits, backgrounds, music, and CG assets into a .galgame.html file that can be opened directly in the browser. It provides two model tools, galgame_scan and galgame_build, and can be played through the 🎮 Galgame sidebar button in the DSH Web GUI.

GitHub repository:

https://github.com/baisama-cloud/dsh-galgame-generator

The verified documentation does not provide a community directory page URL.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye