场景定位
用 Codex 把游戏 brief 先转成定义清楚的计划,再构建真实的浏览器游戏;用 imagegen 生成视觉资产,并让 Codex 在实时浏览器中测试和迭代控制、界面与玩法。
- 难度
- 中级
- 时间跨度
- 长时间运行
适合用于
- 从零构建浏览器游戏
- 需要反复测试和调优控制、视觉与部署的游戏构建
Starter Prompt
起步提示词
Use $playwright-interactive, $imagegen, and $openai-docs to plan and build a browser game in this repo.
Implement PLAN.md, and log your work under `.logs/`. 在 ChatGPT 桌面应用中尝试 介绍
构建游戏是 Codex 不只生成代码的清晰例子之一。一个真实游戏通常需要书面概念、渲染层、前端外壳、后端状态、资产生产,以及持续的视觉调优。
这个场景最适合让 Codex 先写清楚游戏到底应该做什么,然后用 Playwright interactive 在实时浏览器中测试游戏并迭代。
先从游戏计划开始
在让 Codex 搭建任何东西之前,先要求它创建一个 PLAN.md,用具体条目定义游戏。
- 玩家目标
- 主循环
- 输入和控制
- 胜利与失败状态
- 进度或难度设计
- 视觉方向
- 技术栈和托管假设
- 里程碑顺序
用 AGENTS.md 约束 Codex 行为
为了让 Codex 遵循计划、验证工作并使用正确工具,可以定义一个类似下面的 AGENTS.md。
# Game name
<Type of game>
Tech Stack:
- NextJS for frontend (hosted on Vercel)
- <insert technology> for rendering
- Fastify for backend, websockets (hosted on <hosting platform>)
- Postgres for database (hosted on <hosting platform>)
- Redis for caching and pub/sub (hosted on <hosting platform>)
- OpenAI for generative AI features
Tips:
- Use build and test commands to verify your work as soon as you complete a feature or task
- Use the PLAN.md file to guide your work when building new features
- Log your work under .logs (create new log files as you see fit) to record your thought process and decisions, and reference them when iterating on features
- Use playwright to test the visual output of your work, and iterate if it doesn't look right or fit the vibe
- Use imagegen to generate visual assets for your work, and every time you generate a collection of assets, save the prompts you used to be able to continue generating more of the same assets later (create files in .prompts)
- Use Context7 MCP to fetch <rendering framework> docs 启用需要的 skills
添加 AGENTS.md 里提到的 skills。
- Imagegen:让 Codex 按需要为游戏生成视觉资产。
- Playwright interactive:让 Codex 在实时浏览器中测试游戏。
- OpenAI docs:让 Codex 获取最新 OpenAI API 文档。
- 可选:添加 Context7 MCP server,用于获取渲染框架的最新文档。
让 Codex 工作并迭代
Codex 会基于初始计划生成游戏的第一个版本。
如果需要生成大量图像资产,第一个版本可能会花一些时间,有时甚至需要数小时。因为 Codex 可以在实时浏览器中测试作品并试玩游戏,它可以在很长时间内不需要你输入。
计划定义得越清楚,第一次迭代之后的最终输出通常越好。
当你实际试玩后,可以根据需要继续迭代:提供截图、要求调整玩法、或更新视觉资产,直到结果符合预期。