Files
ai_game/README.md

149 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.

# 星域故事汇
一款 AI 驱动的互动短剧微信小游戏,支持 AI 创作、UGC 内容发布,将超休闲游戏的极简操作与互动叙事的强代入感相结合。
## 项目结构
```
ai_game/
├── client/ # 微信小游戏客户端
│ ├── js/
│ │ ├── data/ # 数据管理
│ │ │ ├── StoryManager.js # 故事数据
│ │ │ ├── UserManager.js # 用户数据
│ │ │ └── AudioManager.js # 音频管理
│ │ ├── scenes/ # 场景模块
│ │ │ ├── HomeScene.js # 首页(推荐/关注/最新/排行)
│ │ │ ├── StoryScene.js # 故事播放
│ │ │ ├── EndingScene.js # 结局页
│ │ │ ├── ProfileScene.js # 个人中心(作品/草稿/收藏)
│ │ │ ├── ChapterScene.js # 章节选择
│ │ │ ├── AICreateScene.js # AI创作中心
│ │ │ └── SceneManager.js # 场景管理
│ │ ├── utils/
│ │ └── main.js
│ ├── game.js
│ └── game.json
├── server/ # Node.js 后端服务
│ ├── routes/
│ │ ├── story.js # 故事接口
│ │ └── user.js # 用户接口
│ ├── models/
│ │ ├── story.js # 故事模型
│ │ └── user.js # 用户模型
│ ├── config/
│ ├── sql/
│ │ ├── schema.sql # 基础表结构
│ │ └── schema_v2.sql # 完整表结构含AI/UGC
│ └── app.js
├── docs/
│ └── AI创作系统设计.md
└── README.md
```
## 技术栈
| 层级 | 技术 |
|------|------|
| 客户端 | 原生微信小游戏 Canvas 2D |
| 服务端 | Node.js + Express |
| 数据库 | MySQL 8.0 |
| AI服务 | OpenAI / Claude API |
## 快速开始
### 1. 启动后端
```bash
cd server
npm install
cp .env.example .env # 配置数据库
npm start
```
### 2. 导入客户端
1. 微信开发者工具 → 导入项目 → 选择 `client` 目录
2. 填入 AppID
3. 编译运行
## 核心功能
### 故事游玩
- 沉浸式视觉小说界面
- 打字机效果文字展示
- 多分支选择剧情
- 多结局达成系统
### AI 创作中心
- AI 改写结局
- AI 续写剧情
- AI 完整创作新故事
- 配额管理(免费/付费)
### UGC 生态
- 用户发布原创故事
- 作品审核机制
- 创作者数据统计
- 收益分成系统
### 个人中心
- 我的作品管理
- 草稿箱
- 收藏/游玩记录
- 创作者统计
## API 接口
### 故事相关
| 接口 | 方法 | 说明 |
|------|------|------|
| `/api/stories` | GET | 故事列表 |
| `/api/stories/:id` | GET | 故事详情 |
| `/api/stories/:id/rewrite` | POST | AI改写结局 |
| `/api/stories/:id/continue` | POST | AI续写 |
| `/api/stories/ai-create` | POST | AI完整创作 |
### 用户相关
| 接口 | 方法 | 说明 |
|------|------|------|
| `/api/user/login` | POST | 用户登录 |
| `/api/user/progress` | GET/POST | 游玩进度 |
| `/api/user/collections` | GET | 收藏列表 |
| `/api/user/my-works` | GET | 我的作品 |
| `/api/user/drafts` | GET | 草稿箱 |
| `/api/user/ai-quota` | GET | AI配额 |
| `/api/user/recent-played` | GET | 最近游玩 |
## 数据库
完整表结构见 `server/sql/schema_v2.sql`,包含:
- 用户体系users, user_stats, user_follows
- 故事内容stories, story_nodes, story_choices
- AI生成ai_generations, ai_prompt_templates
- 用户行为user_progress, user_endings, user_collections
- 经济体系user_ai_quota, coin_transactions
- 审核运营content_reviews, reports
## 开发进度
- [x] 核心游玩模块
- [x] 故事播放场景
- [x] 结局展示系统
- [x] 章节选择功能
- [x] AI创作中心UI
- [x] 首页UGC布局
- [x] 个人中心创作者功能
- [x] 后端API完善
- [ ] AI服务对接
- [ ] 审核系统
- [ ] 支付系统
- [ ] 社交分享
## License
MIT