跳到正文
AYi· @AYi_AInotes · X·· 3 小时前精选AI 评分74
AI 导读

工程师 Lauren 公开 4 天开发游戏的工程复盘,合并约 1150 个 PR,游戏跑在 X 帖子内,包体约 124 KB gzipped,目标是在中端手机上以 60 fps 运行 500 个敌人。

推荐理由

原文拆解了把 Bug 沉淀为 Lint 规则、TLA+ 验证、热路径约束等具体做法,可迁移到自己的 AI 辅助编程流程。

正文

硅谷开发女神土豆姐 Lauren 最新公开的这篇开发工程复盘,我觉得是目前 AI 辅助编程最硬核的范本,没有之一,
土豆女神一个人、4 天时间、合并约 1150 个 PR,做出一款直接跑在 X 帖子内、包体仅 124KB、千元机稳跑 60 帧且带 500 个同屏怪物的完整游戏,叫tibo dog,

很多人以为用 AI 写代码就是随便给几句 Prompt 然后撞大运,结果往往是代码越来越乱、Bug 越修越多。

但这位顶级女神工程师展示了完全相反的姿态:
不是放任 AI 自由发挥,而是用极其严苛的工程铁律把 AI 治得服服帖帖。

拆解她写进仓库里的 6 条残暴工程规则,
每一条都在重新定义人机协作的上限:

1️⃣ 把每一个 Bug 变成 Lint 静态规则:每在代码里踩到一个坑,第一反应不是单点修复,而是让 Bot 写一条 Lint 规则把这种写法彻底封死,全项目永不再犯。

2️⃣ 严禁用代码注释来解释逻辑:通过 Lint 规则强制禁止写注释。如果一段代码需要解释,唯一允许的解法是换一个更好的变量名,或者补一个单元测试。

3️⃣ 用热路径命名规约锁死内存垃圾:每帧运行的高频代码全部以 .hot.ts 为后缀,Lint 规则死死卡住:该文件内严禁任何对象字面量、闭包和 new 操作,主循环几乎产生零内存垃圾,从根源上消灭 GC 掉帧。

4️⃣ 引入 TLA+ 形式化验证找状态机漏洞:对剧情过场与核心系统状态机做严格的形式化数学证明,在运行前把逻辑死锁全部排空。

5️⃣ 零音频文件与纯代码实时芯片合成:没有加载任何外部 MP3 或音频包,所有音乐和音效全由浏览器自研的 Game Boy 风格芯片实时合成,背景音乐甚至能在不同地形之间无缝平滑变奏。

6️⃣ 全确定性输入重放防作弊与无头 Bot 调平衡:游戏运行完全确定,服务器通过重放玩家的输入流判定高分是否作弊;同时用无头 AI Bot 自动通宵挂机跑关卡,根据存活率自动调节数值难度。

最狠的一条真相是: 你把工程规则写得越死,AI 交付出来的质量就越炸裂。

也许AI 不会淘汰程序员,但懂得用严格工程规范驱动 AI 的顶级工程师,正在把自己变成一整个拥有大厂产能的独立工作室。

引用lauren@poteto
trivia: • started working on the game as a side project 4 days ago, landing ~1,150 PRs • every time i found an issue in the code i asked bot to make a lint rule against it • used TLA+ heavily to find bugs in the game's various state machines: the story, cutscenes, the game's systems. there are many formal verification skills, one for each major system • i put context into the filepaths: code that runs every frame or every tick gets a .hot.ts extension, and a lint rule bans allocating in it (no object literals, closures, new, etc.), so the game loop creates almost no garbage and GC doesn't cause stutters • game engine is mostly custom. three.js draws the 3D scene, but the simulation, post-processing and audio are all ours • the simulation is fully deterministic, so every run replays exactly from its inputs. when you post a high score, the server replays your whole run to check it isn't cheated • we generate dynamic og:images for every run based on your final stats, and it's all localized too! the game supports 10 languages • my favorite feature: the music seamlessly transitions into different music for the various biomes, continuing the previous melody • no audio files. all the music and sound effects are synthesized live in the browser by a custom Game Boy-style chip (two pulse voices, a wave voice, noise) plus a synthwave layer. the songs are written as text in code • all the pixel art is code. every sprite is a file drawn with one shared palette and packed into a sprite atlas at build time • it runs inside an X post, from the 245px card up to full screen. the bar is 60 fps with 500 enemies on a mid-range phone • the build fails if the first download goes over budget. it's about 124 KB gzipped right now • bots play the game headless to tune each difficulty against target survival rates • comments are banned by a lint rule. if code needs explaining, the fix is a better name or a test
在 X 查看被引用的帖子

来源:AYi · x.com