Files
XinLanDiary/CLAUDE.md
Cafw e5dd12cfa7 feat: initial commit of XinLanDiary v0.0.6 dev
首次提交莘澜日记项目源码,包含第一章剧情脚本、UI 界面、角色素材及游戏配置。
排除了编译产物(.rpyc)、运行时存档、缓存及敏感密钥文件。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-25 23:01:11 +08:00

101 lines
4.0 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.
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
**莘澜日记 (XinLanDiary)** 是一款使用 Ren'Py 引擎开发的中文视觉小说游戏,当前版本 dev0.0.6,由 RYT Studio 制作。游戏以校园为背景,通过多角色关系数值追踪和多视角叙事推动剧情。
## 开发环境与运行
本项目没有传统的构建脚本。开发和构建均通过 **Ren'Py SDK** 完成:
```bash
# 在开发模式下运行游戏(需要安装 Ren'Py SDK
/path/to/renpy.sh /Users/lipeng/Documents/projects/XinLanDiary-b2-dev
# 检查脚本语法错误Ren'Py 会在启动时自动编译 .rpy 文件)
# 错误日志位于game/traceback.txt 和 log.txt
```
构建多平台发行版需通过 Ren'Py 启动器 GUI 操作,配置见 `project.json``android.json`
## 已知语法错误(需要修复)
- `game/Chapters/Chapter1.rpy:31` — 引用了未定义的变换 `move_to_bottomleft`
- `game/screens.rpy:318` — 按钮定义中存在非法中文标点符号(`。`
## 项目架构
### 核心文件
| 文件 | 作用 |
|------|------|
| `game/script.rpy` | 入口点角色定义、变换效果、start 标签跳转 |
| `game/options.rpy` | 游戏配置:版本、音频、转场、存档目录 |
| `game/screens.rpy` | UI/屏幕布局1622行 |
| `game/gui.rpy` | GUI 样式配置,分辨率 1920x1080 |
| `game/Chapters/Chapter1.rpy` | 第一章剧情脚本 |
| `剧情/Chapter1.txt` | 剧情草稿(中文原稿) |
### 角色系统
所有角色在 `game/script.rpy` 中定义。每个角色有专属颜色、发言速度和独立的关系数值字典。
**主要角色速查表**
| 变量名 | 全名 | 颜色 | 独特数值 |
|--------|------|------|----------|
| `me` | 任懿涛(主角) | #71b4e4 | selfAcceptance, humorSense, studyStress (0-10) |
| `xingyu` | 陈星宇 | #cff3ff | affection, cooperation, helpfulness (0-100) |
| `lhy` | 刘泓予 | #ffc052 | affection, trust, empathy (0-100) |
| `lzx` | 李泽瑄 | #631e2c | infoOpenness (0-10),神秘角色 |
| `xiaowei` | 林晓薇 | #f4a7b9 | affection, synergy, interactionFrequency网络ID薇风拂晓 |
| `yutong` | 苏雨桐 | #69cae7 | affection, attention, academicSupport |
| `yh` | 颜涵 | #d4b8e0 | affection, understanding, support |
| `xwhy` | 徐卫浩宇 | #9dffdb | affection, reliance, helpfulness |
**数值定义模式**
```python
default {char}_stats = {
"{stat_name}": 0, # 说明
}
```
### 场景与标签规范
- 场景入口:`label Chapter{#}_Scene{#}:`
- 背景命名:`bg_{地点}_{光照}_{特殊}`(如 `bg_classroom_morning`
- 角色素材:`{缩写}_{状态}`(如 `ryt_normal`, `lhy_embarrassed`
- 网络身份后缀:`_w`(如 `xiaowei_w`, `me_w`
### 核心叙事机制
- **多视角切换**:第三场景从主角视角切换至苏雨桐、林晓薇视角
- **关系数值驱动分支**:玩家选择同时影响多个角色的多项数值
- **隐藏数值**`h_` 前缀(如 `h_academicSupport`)用于更精细的关系追踪
- **剧情内社交媒体**:包含论坛帖子和私信场景
### 变换效果Transforms
`script.rpy` 中定义的常用变换:
- `shake_rotate` — 抖动旋转动画0.5秒)
- `slide_right(distance, duration)` — 向右滑动
- `zoom_to_upper_right` — 镜头缩放并移向右上角
- `c1s2_ryt_pos`, `c1s4_ryt_pos` — 特定场景角色定位
## 多平台构建配置
- **macOS**`project.json`当前激活force_recompile=true
- **Android**`android.json`(横屏锁定,包名 `com.rytstudio.xinlandiary`,堆内存 3GB
- **Web/其他**:通过 Ren'Py launcher 配置
## 错误排查
运行时错误日志:
- `game/log.txt` — 运行日志
- `game/traceback.txt` — 崩溃堆栈
- `game/errors.txt` — 编译错误
Ren'Py 在启动时自动将 `.rpy` 编译为 `.rpyc`,语法错误会阻止游戏启动并写入上述日志。