npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@zhin.js/plugin-dungeon-expedition

v1.0.20

Published

Zhin.js multiplayer deterministic dungeon expedition

Readme

@zhin.js/plugin-dungeon-expedition

多人、可恢复、确定性回放的 Zhin.js 地牢远征游戏。这个插件既是可玩的 1-4 人回合游戏,也是 @zhin.js/game-kit 的稳定性验收样本。

安装

pnpm add @zhin.js/plugin-dungeon-expedition

将插件加入 Zhin 配置后,可通过 /地牢地牢/dungeon 进入。

游戏流程

创建队伍 -> 队员加入并准备 -> 三层探索
         -> 随机事件 / 普通战斗 / 守层者
         -> 胜利、失败或队长结束

常用指令:

地牢 开始
地牢 加入
地牢 准备
地牢 出发
地牢 探索
地牢 攻击
地牢 防御
地牢 药水
地牢 状态
地牢 结束

支持原生按钮和数字文本 fallback。每个按钮携带 Session revision,点击旧 界面不会覆盖新回合,而会返回最新状态。

稳定性设计

  • VersionedSessionService 串行化同一 Session 的本地并发操作。
  • 持久化 revision 提供乐观并发检查。
  • 持久化 processed_actions 抵御 Adapter 重复投递。
  • rng_state 保存确定性随机状态,进程重启后可继续同一随机序列。
  • schema_version 为后续存档迁移保留稳定边界。
  • 所有规则在纯 engine.ts 中执行,不依赖 IM、数据库或系统时间。
  • defineGamePlugin 统一数据库、超时、事件、战绩与 HMR 生命周期。

开发

pnpm --filter @zhin.js/plugin-dungeon-expedition build
pnpm --filter @zhin.js/plugin-dungeon-expedition test

核心文件:

  • src/engine.ts:纯领域状态机。
  • src/session-service.ts:版本化持久化和跨游戏冲突检查。
  • src/game-flow.ts:消息身份、频道和旧 revision 处理。
  • src/view.ts:结构化状态与操作键盘。
  • commands/middlewares/:约定式能力入口。