Introduction

DSH Web GUI supports feature extensions through plugins. The Dice Battle plugin integrates a collection of dice games into the DSH interface, running in the center-column iframe. It allows you to play games without leaving the current interface.

Plugin Overview

Dice Battle is a Web GUI plugin that includes six classic dice game modes. The plugin is maintained by zmm863-commits and is open-sourced under the MIT license. It provides a sidebar entry point in DSH, and clicking it opens the game panel in the center column.

Core Features

  • Game List: Includes Liar’s Dice, Guess Red Dots, Guess Red/Blue, Guess Big/Small, Guess Odd/Even, and Guess Straight.
  • Runtime Mode: Supports single-player mode versus AI.
  • Technical Integration: Sidebar menu item + center-column iframe loading.
  • UI Language: Supports bilingual display (zh/en).
  • Online Capability: Integrates PeerJS WebRTC logic, with code support for online matches (currently MP_DISABLED=true).

Installation and Enablement

Install the plugin using the official command:

dsh plugin --profile web add dsh-dice-game

After installation, restart dsh web, find and click 🎲 Dice Battle in the sidebar to start the game.

Technical Details and Notes

  • Sandbox Isolation: The game is loaded as an iframe using an opaque-origin sandbox without allow-same-origin. The game document is fully isolated from the DSH GUI and cannot read the DOM, cookies, or localStorage.
  • Build Requirements: The build script build.mjs wraps the client code (lib/client.js) into the window.__ModuleLoader__.load format, which is required for DSH client module loading.
  • Current Status: Online functionality (MP_DISABLED = true) is temporarily disabled, and the plugin currently supports only single-player versus AI. The game is intended for casual entertainment only and does not involve real money or gambling.
  • Access Path: Game resources are hosted under the /dice-game/ route.

References