学习路径Learning path · 第 2 阶段Stage 2
提示词的结构
Structuring the prompt
一句话:AI 写不出能跑的游戏,多半不是因为它不会,而是因为你没说清要什么。
In one line: AI usually fails to produce a runnable game not because it cannot code, but because you did not say what you wanted.
三样必须给的
| 要给 | 为什么 | 例子 |
|---|---|---|
| 输入 → 行为映射 | 不给会得到「按 WASD 移动」这种废话 | 「左键跳跃,Shift 冲刺,R 重开」 |
| 具体数值 | 不给会得到一堆 TODO | 「跳跃初速 -420,重力 980」 |
| ⚠ 明确的「不要做什么」 | 不给会得到一个塞满所有系统的巨文件 | 「这一版不要敌人、不要 UI、不要动画」 |
⚠ 第三条最容易漏,而且影响最大。
Three things you must give
| Give | Why | Example |
|---|---|---|
| An input → behaviour mapping | Without it you get filler like "move with WASD" | "Left click jumps, Shift dashes, R restarts" |
| Actual numbers | Without them you get a pile of TODOs | "Jump velocity -420, gravity 980" |
| ⚠ An explicit "do not do X" | Without it you get one giant file containing every system imaginable | "This version: no enemies, no UI, no animation" |
⚠ The third is the easiest to forget, and it has the largest effect.
⚠ 一个真实的失败模式
你说:「做一个平台跳跃游戏」
AI 会给你:玩家、敌人、关卡、UI、动画、存档、音效、暂停菜单 —— 全部都有,全部没做深。
然后你在调试器里花三天找「为什么角色会掉出屏幕」。
你得到的不是少功能,而是一堆半成品。
⚠ A real failure mode
You say: "make a platformer".
AI gives you: player, enemies, levels, UI, animation, saves, sound effects, pause menu — all present, none finished.
Then you spend three days in a debugger looking for why the character falls off the screen.
What you get is not fewer features — it is a pile of half-finished ones.
更好的写法
```
写 Godot GDScript,一个最小可玩的原型:
- 玩家:CharacterBody2D,左右移动 + 跳跃
- 数值:重力 980,跳跃初速 -420,coyote time 100ms
- 地面用 StaticBody2D,碰撞层设 layer 1 / mask 1
- ⚠ 不要:敌人、UI、动画、存档、音效 —— 这次只做移动与跳跃
```
⚠ 注意最后一行。它省下的时间比它占用的字数多得多。
A better prompt
```
Write Godot GDScript for a minimal playable prototype:
- Player: CharacterBody2D with left/right movement and jumping
- Numbers: gravity 980, jump velocity -420, coyote time 100 ms
- Ground uses StaticBody2D, collision layer 1 / mask 1
- ⚠ Do not: enemies, UI, animation, saves, sound effects — this round is movement and jumping only
```
⚠ Note the last line. It saves far more time than the words it costs.
迭代的节奏
⚠ 不要一次要全部。正确的顺序:
1. 第一次:只做移动 → 跑起来
2. 第二次:加跳跃 → 跑起来
3. 第三次:加相机跟随 → 跑起来
4. 第四次:才加视觉
⚠ 每一轮都应该是「能跑的东西」,不是「一部分代码」。
The rhythm of iteration
⚠ Do not ask for everything at once. The right order:
1. First round: movement only → it runs
2. Second: add jumping → it runs
3. Third: add camera follow → it runs
4. Fourth: only then add visuals
⚠ Each round should produce "something that runs", not "part of the code".