Files
IntoHole/AGENTS.md
T
Yanchen 39ff1fd7b4 feat: 建立关卡工坊并整理项目目录
- 加入 Godot 基础试玩、画风展示和通孔验证场景
- 支持自由放球、多层叠放、墙壁、锥口球洞及固定 +5 m/s 定向加速方块
- 保存 Blender 源资产、模型导出、资源制作脚本和关卡编辑存档逻辑
- 按七类目录归档工程,集中 zsh 启动入口并补充 AGENTS.md 文件索引
- 同步设计规则、依赖锁定、验证报告和目录迁移记录

验证:目录迁移后的资源导入与四个场景加载通过;本次提交前检查暂存内容,未重复运行整套物理测试。
2026-11-16 11:12:21 +08:00

104 lines
7.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# IntoHole 文件索引与工作约定
本文件是仓库导航入口。先查所属目录与具体设计文档,再修改内容。不要在根目录重新创建零散脚本、模型、测试输出或 `docs/`、`reference/`、`validation/` 等并行目录。
## 顶层目录
| 目录 | 职责与入口 |
| --- | --- |
| [godot_engine](godot_engine/README.md) | Godot 工程配置、共享适配代码、导入缓存和可选引擎程序。唯一工程入口为 [project.godot](godot_engine/project.godot)。 |
| [references](references/README.md) | 项目已确认规则与外部参考,按 `design/`、`games/`、`mechanics/` 分开。 |
| [assets](assets/README.md) | 游戏资产及制作代码,按 **资源类型 / 资源名** 隔离。 |
| [playtest](playtest/README.md) | 所有非正式实验场景、示例布局、检查与截图脚本、历史产物。 |
| [levels](levels/README.md) | 正式游戏关卡;当前无已发布正式关卡。 |
| [designer](designer/README.md) | 工坊、编辑器逻辑和未发布草稿。 |
| [scripts](scripts/README.md) | 启动、执行、维护脚本;新增入口优先 bash/zsh。 |
根目录保留 README.md、AGENTS.md、.gitignore 与现有 uv 配置。`.venv/`、`.python-version`、`pyproject.toml`、`uv.lock` 未经明确要求不要迁移或调整;`.git/` 是版本元数据。
## 常用入口
```sh
./scripts/workshop.zsh
./scripts/showcase.zsh
./scripts/underpass.zsh
./scripts/playtest.zsh
```
四个 `.command` 双击快捷方式也在 `scripts/`,仅转调对应 zsh 文件。复杂调度在 [studio.py](scripts/python/studio.py) 和 [baseline.py](scripts/python/baseline.py),它们是开发工具,不是游戏主体。
## Godot 工程
- [godot_engine/project.godot](godot_engine/project.godot) 默认启动关卡工坊。
- `godot_engine/assets`、`designer`、`playtest`、`levels` 是指向同名顶层目录的相对符号链接,非第二份文件。`res://assets/...` 等资源路径通过这些链接访问唯一资源;复制仓库时保留链接。
- 共享资产加载适配在 [runtime/asset_library.gd](godot_engine/runtime/asset_library.gd)。资源自身行为和制作代码随资源放入 `assets/`。
- `.uid` 与 `.import` 跟随对应脚本和模型。移动后同步资源路径、目录配置、构建输出和文档链接,并做必要导入。
- `godot_engine/.godot/` 是自动缓存。资产 `source/` 与 `playtest/artifacts/` 中的 `.gdignore` 避免导入制作源文件和历史输出。
- 使用系统引擎或 `godot_engine/bin/`;不要未经要求复制引擎程序。
## 资产索引
每个资源采用 `assets/<资源类型>/<资源名>/`:
```text
assets/blocks/directional_boost/
model.glb
model.glb.import
behavior.gd
source/
model.blend
build.py
.gdignore
```
| 类型 | 资源 |
| --- | --- |
| [chutes](assets/chutes) | `straight`、`turn_cw`、`turn_ccw`、`gentle`、`steep`、`y_merge`。 |
| [balls](assets/balls) | `iron_ball`,物理行为在 [physics.gd](assets/balls/iron_ball/physics.gd)。 |
| [blocks](assets/blocks) | `wall`、`directional_boost`。 |
| [goals](assets/goals) | `goal_hole`。 |
| [collections](assets/collections) | `baseline` 与 `storybook` 两个资源集合,保存目录配置、共享制作代码和整套源文件。 |
当前模型直接放在资源目录,早期模型变体在相同资源的 `baseline/`。每个资源的 `source/build.py` 是制作入口,复用 [集合制作代码](assets/collections/storybook/source/build.py),只导出目标资源。所有实际制作代码均在 `assets/`;[asset.zsh](scripts/asset.zsh) 只负责执行。
```sh
./scripts/asset.zsh directional_boost
./scripts/asset.zsh all
./scripts/asset.zsh baseline
```
几何、尺寸、外观由 Blender 资产负责。当前资源目录为 [catalog.json](assets/collections/storybook/catalog.json),物理配置为 [physics.json](assets/collections/storybook/physics.json),实体分类为 [entities.json](assets/collections/storybook/entities.json)。
来源快照在 `assets/collections/storybook/source/snapshot/`,是生成输入而非缓存。快照原始路径和旧校验值属于历史证据,不作为现用资源路径批量重写。参数化重建会重新生成相应源文件,保留手工编辑成果后再决定是否运行生成器。
## 场景、关卡与规则索引
- 工坊:[workshop.tscn](designer/scenes/workshop.tscn)。编辑编排:[studio.gd](designer/scripts/studio.gd);摆放:[placement.gd](designer/scripts/placement.gd);存档:[level_data.gd](designer/scripts/level_data.gd)。
- 工坊默认空白,保存到 [designer/drafts](designer/drafts)。内置示例从 `playtest/` 读取,保存时写入草稿副本,不直接覆盖实验原件。
- 展示:[showcase.tscn](playtest/showcase/scenes/showcase.tscn);通孔:[underpass.tscn](playtest/underpass/scenes/underpass.tscn);早期试玩:[main.tscn](playtest/baseline/scenes/main.tscn)。
- `levels/` 仅用于明确发布的正式关卡。不要把试跑成功、示例或工坊草稿自动当作正式关卡。
- [blocks.md](references/design/blocks.md) 是方块完整规则的唯一维护文档,保留“滑槽 / 实体”结构;[physics_system.md](references/design/physics_system.md) 管理物理和小球数据;[game_reference.md](references/design/game_reference.md) 管理整体玩法及参考方向。
- 外部游戏资料在 `references/games/`,机械笔记在 `references/mechanics/`。区分资料中的建议、用户指令与已确认规则。
- 定向加速方块每次固定增加 **5 m/s**,工坊与运行中均不可调;旧存档的 `speedGain` 不得覆盖该规则。
## 验证与迁移记录
- 检查脚本在 `playtest/checks/`,早期专项在 `playtest/baseline/checks/`,截图脚本在 `playtest/captures/`。
- `playtest/artifacts/baseline/`、`styled/`、`reorganization/` 分别收纳早期产物、当前画风实验产物及迁移记录。历史报告中的旧路径是当时证据,移动文件不代表重新运行了实验。
- [迁移清单](playtest/artifacts/reorganization/files.json) 保存旧路径、新路径及迁移前 SHA-256;[路径映射](playtest/artifacts/reorganization/path_map.json) 用于追溯。
- 用户不希望为小改动重复跑全套物理实验。验证应匹配改动:目录调整主要检查路径、语法、导入和入口加载;仅在确实涉及相应行为时运行必要专项。
- 保留未提交工作、用户关卡与源资产,不因目录混乱直接删除,不自动提交或批量暂存。讨论提案与已确认规则分开维护。
<!-- context7 -->
## 当前文档查询
Use `ctx7` to fetch current documentation when the user asks about a library, framework, SDK, API, CLI tool or cloud service, including syntax, configuration, migration, library-specific debugging, setup and CLI usage. Do not use it for refactoring, business logic, code review or general programming concepts.
1. Resolve first: `npx ctx7@latest library <name> "<user's full question>"`; use the official library name.
2. Choose the best valid `/org/project` ID by relevance, reputation and coverage; use a returned version ID when appropriate.
3. Fetch: `npx ctx7@latest docs <libraryId> "<user's full question>"`.
4. Answer using the fetched documentation.
Call `library` first unless the user supplied an ID. Run at most three commands per question. Never include credentials. Run Context7 outside the default sandbox; on DNS/network errors retry outside the sandbox. On quota errors, inform the user and suggest `npx ctx7@latest login` or `CONTEXT7_API_KEY`; do not silently fall back to remembered API details.
<!-- context7 -->