返回资讯中心
外部精选
软件工程
#开发者实时流

Game DNA 发布 101 个游戏功能模块,供 AI 编程智能体集成

来源标题:Show HN: Game DNA – 101 game features for coding agents, tested on unseen games

Game DNA 上线了 101 个可玩游戏元素库,涵盖打击特效、战斗系统、光照、菜单和 3D 场景,用户可先试玩再复制提示词交给 AI 编程智能体加入自己的浏览器游戏。每个元素都有独立页面,可调参数预览效果,项目已在 GitHub 开源并支持在未见过的游戏上测试。

Hacker News 最新lucemia512026/11/25 · 今天22 分钟阅读

以下正文由 AI 翻译自 Hacker News 最新(原文版权归原站所有),可能存在偏差,重要内容请以原文为准。

为用 AI 编码代理构建的游戏而生

Game DNA 是一个包含 101 个可玩游戏元素的库:打击特效、战斗系统、灯光、菜单、3D 场景。玩一个元素,复制它的提示词,你的编码代理就会把它加进你的浏览器游戏里。

试玩 demo查看全部 101 个元素在 GitHub 上查看

现代伤害数字:击打弧线飞出,暴击弹跳,连击汇成一个总数。试玩

观看 30 秒导览

试玩

01 一个可以玩的 demo

每个元素都在独立页面上运行。按按钮、调设置,在拿走之前先感受一下实际效果。

# Add modern damage numbers to my game
Add the game element below to MY existing game, which you have not seen. It is a finished module file given with this prompt:
- `damage-pop.js` (one global, `GameDNA_DamagePop`), API reference `damage-pop.README.md`
README example names are placeholders.
## Shared premises
1. **Include each module file verbatim; never edit it.** Load it with its own `<script src>` before the game's script, or paste it unchanged into its own `<script>` tag. If a module seems to need a change, adapt my game around it and tell me.
2. **Resolution:** keep my game's native resolution and integer scaling as they are. Call module draw functions on my 2D context inside the same transform as my sprites (one module pixel = one game pixel), and keep my game's own image-smoothing setting (off for pixel art, on for smooth or HD games; never switch it).
3. **Time:** drive every module from one fixed 60 Hz step (1000 / 60 ms). If my loop uses variable delta time, accumulate it and run whole steps (at most 250 ms per frame).
4. **Coordinates:** native screen pixels (world minus camera) unless a section says tiles.

02 可以复制的提示词

大白话写成,面向一个你的代理从未见过的游戏。把它粘贴进 Claude Code、Codex、Cursor 或任何编码代理。

const pops = GameDNA_DamagePop.create({ getAnchor });
pops.spawn('imp', 47, 'crit');

03 你的代理接入的模块

难的部分已经写好并测试过了。你的代理把它接到你游戏自己的事件上,所以你的代码还是你的。

把鼠标悬停在卡片上,看它动起来。附加组件可以放进任何游戏;起步游戏是基于某个系统构建的完整小游戏,随时可以扩展。

把元素放进购物篮,它就会生成一段提示词,按正确顺序把它们全部加进去。从一个套件开始:

COMBO.md · 224 行

# Add WebGL post-process pipeline, Dynamic 2D lights & soft shadows, Bloom & glow, Colour grading LUT and Camera director to my game
Add the 5 game elements below to MY existing game, which you have not seen. Each is a finished module file given with this prompt:
- `webgl-post.js` (one global, `GameDNA_Post`), API reference `webgl-post.README.md`
- `dynamic-lights.js` (one global, `GameDNA_Lights`), API reference `dynamic-lights.README.md`
- `bloom-glow.js` (one global, `GameDNA_Bloom`), API reference `bloom-glow.README.md`
- `color-grade-lut.js` (one global, `GameDNA_ColorGrade`), API reference `color-grade-lut.README.md`
- `camera-director.js` (one global, `GameDNA_Camera`), API reference `camera-director.README.md`
README example names are placeholders.
## Shared premises
1. **Include each module file verbatim; never edit it.** Load it with its own `<script src>` before the game's script, or paste it unchanged into its own `<script>` tag. If a module seems to need a change, adapt my game around it and tell me.
2. **Resolution:** keep my game's native resolution and integer scaling as they are. Call module draw functions on my 2D context inside the same transform as my sprites (one module pixel = one game pixel), and keep my game's own image-smoothing setting (off for pixel art, on for smooth or HD games; never switch it).
5 elements → 1 prompt

购物篮会检查它们是否兼容,排好顺序,然后生成一段提示词外加一个模块文件的 zip 包。

在购物篮中打开复制提示词

在分支地图上攀爬,与会亮出意图的敌人进行卡牌战斗,抽取手绘升级卡,并用 toast 通知把这一切播报出来。

COMBO.md · 262 行

# Add Branching run map, Card battle with intents, Upgrade draft (pick 1 of 3), Card illustrations and Toasts & unlock pop-ups to my game
Add the 5 game elements below to MY existing game, which you have not seen. Each is a finished module file given with this prompt:
- `run-map.js` (one global, `GameDNA_RunMap`), API reference `run-map.README.md`
- `card-battle.js` (one global, `GameDNA_CardBattle`), API reference `card-battle.README.md`
- `upgrade-draft.js` (one global, `GameDNA_UpgradeDraft`), API reference `upgrade-draft.README.md`
- `card-art.js` (one global, `GameDNA_CardArt`), API reference `card-art.README.md`
- `toasts.js` (one global, `GameDNA_Toasts`), API reference `toasts.README.md`
README example names are placeholders.
## Where it goes in my game (my choice; follow it exactly)
- **Branching run map:** The run map wraps the game's existing play: battle = one of my normal fights, elite = a tougher fight, boss = my final fight.
- **Upgrade draft (pick 1 of 3):** Open the upgrade draft exactly: at every level-up, instead of the fixed stat bonus.
5 elements → 1 prompt

购物篮会检查它们是否兼容,排好顺序,然后生成一段提示词外加一个模块文件的 zip 包。

在购物篮中打开复制提示词

槽条填满,窗口打开,火花四溅,被击败者消散而去。

COMBO.md · 104 行

# Add Bevelled window + pointer cursor, Hit sparks & spell bursts, Bouncing damage numbers and Dissolve-out defeat to the Ruin Skirmish starter
`index.html` is a complete game built on the Active-time gauge battle element; build on it. `index.README.md` documents its extension points. Add:
- `window-cursor.js` (one global, `GameDNA_WindowCursor`), API in `window-cursor.README.md`
- `hit-sparks.js` (one global, `GameDNA_HitSparks`), API in `hit-sparks.README.md`
- `damage-numbers.js` (one global, `GameDNA_DamageNumbers

(原文较长,此处译出前 6000 字,完整内容请点「打开原文」。)

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →