阿易拆解 Lauren 用 6 条工程规则驱动 AI 开发 tibo dog 的复盘
硅谷开发女神土豆姐 Lauren 最新公开的这篇开发工程复盘,我觉得是目前 AI 辅助编程最硬核的范本,没有之一,
阿易 AI Notes 拆解了 Lauren 公开的 AI 辅助编程复盘:她 4 天合并约 1150 个 PR,做出跑在 X 帖子内的游戏 tibo dog,包体约 124KB,中端手机 60 帧同屏 500 个敌人。文中列出 6 条工程规则,包括把每个 Bug 转成 Lint 规则、用 Lint 禁止注释、以 .hot.ts 后缀限制每帧代码分配、用 TLA+ 验证状态机、纯代码实时合成音频、确定性输入重放防作弊并用无头 Bot 调难度。作者认为工程规则写得越严格,AI 交付质量越高。
查看原帖花絮: • 4天前作为副业项目开始开发这款游戏,提交了约1,150个PR • 每当我在代码中发现一个问题,我就让机器人针对它制定一条lint规则 • 大量使用TLA+来查找游戏各个状态机中的bug:剧情、过场动画、游戏系统。有许多形式化验证技能,每个主要系统对应一个 • 我把上下文放进了文件路径中:每帧或每个tick运行的代码会加上.hot.ts扩展名,并且有一条lint规则禁止在其中分配内存(禁止对象字面量、闭包、new等),因此游戏循环几乎不产生垃圾,GC也不会导致卡顿 • 游戏引擎大部分是自研的。three.js负责绘制3D场景,但模拟、后处理和音频都是我们自己的 • 模拟是完全确定性的,因此每次运行都会根据其输入精确重放。当你提交高分时,服务器会重放你的整个运行过程以检查是否作弊 • 我们根据你的最终统计数据为每次运行生成动态og:image,而且全部本地化!游戏支持10种语言 • 我最喜欢的功能:音乐会无缝过渡到不同生物群系的不同音乐,延续之前的旋律 • 没有音频文件。所有音乐和音效都由一个自定义的Game Boy风格芯片(两个脉冲声部、一个波形声部、噪声)加上一层合成波在浏览器中实时合成。歌曲以文本形式写在代码中 • 所有像素艺术都是代码。每个精灵都是一个用共享调色板绘制的文件,并在构建时打包进精灵图集 • 它运行在X帖子内,从245px的卡片一直到全屏。目标是在中端手机上同屏500个敌人时保持60帧 • 如果首次下载超出预算,构建就会失败。 目前gzip压缩后约为124 KB • 机器人以无头模式玩游戏,根据目标存活率来调整每个难度 • 注释被lint规则禁止。如果代码需要解释,解决办法是更好的命名或一个测试
查看原文
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
正文
硅谷开发女神土豆姐 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 的顶级工程师,正在把自己变成一整个拥有大厂产能的独立工作室。