跳到正文
Skillpedia
网站与界面(前端)7.2k · #13355

build-game-inventory

它能做什么

这个技能指导智能体构建游戏的物品和装备系统。适合需要拾取、穿戴和交换每次都正常工作、且不丢失或复制物品的游戏开发者。

适用场景

  • ✓游戏需要物品、战利品、堆叠或装备栏的时候。
  • ✓拖动、交换或穿戴物品时绝不能丢失物品的时候。
  • ✓已保存的游戏需要在不同版本之间安全迁移背包数据的时候。

技能链接

https://github.com/MengTo/Skills/blob/main/agent-skills/game-development/build-game-inventory/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/MengTo/Skills/blob/main/agent-skills/game-development/build-game-inventory/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“请为我的游戏添加一个带有装备栏和拖放交换功能的背包,并确保没有任何物品丢失。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会保持一份有类型的物品列表,在改变任何内容之前检查每一次移动,并且每次更改只提交一次。它会保存有效的结果,并测试物品丢失、背包已满和重复操作等情况。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Build Game Inventory

Use one typed, serializable item source of truth and make every transfer atomic.

Define the item contract

Model stable IDs, item definitions, ownership, stack limits, equipment compatibility, effects, rarity, presentation data, and migration version separately. Runtime UI must reference definitions by ID rather than duplicate stats or descriptions.

Implement transfers as transactions

For pickup, equip, unequip, swap, drag/drop, consume, and sell:

  1. Validate source ownership and destination legality.
  2. Compute the entire next inventory/equipment state.
  3. Commit once or reject without changing either side.
  4. Persist only after the committed state is valid.

Never remove an item before confirming a legal destination. Preserve item identity across a swap and prevent duplicate effect registration.

Build usable UI

Expose slot compatibility, equipped state, quantity, tooltip facts, and failure feedback. Support keyboard and touch alternatives to drag-only interactions. Keep focus behavior, dialogs, and tooltips accessible.

Test loss boundaries

Cover invalid destinations, full inventory, duplicate pickup, equip swap, mid-action swap, save/load, schema migration, reset/new game, tooltip updates, and repeated dispatch. Validate that total owned item identity is conserved except for explicit consumption or reward rules.

常见问题

如果某次移动不被允许怎么办?

技能规定拒绝该移动,且不改变任何一侧,因此不会丢失任何物品。

拖放是移动物品的唯一方式吗?

不是。技能要求同时提供键盘和触屏的替代方式。

存档如何处理?

已保存的背包数据带有版本号,技能涵盖将旧存档迁移的方法。

详情

作者的原始描述

Build or repair game inventory, loot, equipment, tooltips, drag-and-drop, persistence, and progression systems. Use for item schemas, pickup flows, stack rules, equipment slots, atomic swaps, save migration, and no-loss regression testing.

repo: MengTo/Skills

热度

GitHub 星标
7.2k
排名
#13355
许可证
MIT
更新时间
2026/11/1

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能