Skip to content

Latest commit

 

History

History
479 lines (384 loc) · 10.3 KB

AVG_CREATION_STANDARD.md

File metadata and controls

479 lines (384 loc) · 10.3 KB

AVG Maker 互动游戏创作规范 v1.0

📋 目录

  1. 项目结构规范
  2. Ink脚本扩展标签
  3. 资源命名规范
  4. 预览系统规范
  5. 最佳实践示例

🗂 项目结构规范

标准项目目录结构

my-avg-game/
├── 📄 main.ink              # 主游戏入口文件
├── 📄 chapter_*.ink         # 章节文件(可选)
├── 📄 endings.ink           # 结局文件(可选)
├── 📄 characters.ink        # 角色定义文件(可选)
├── 📄 config.json           # 游戏配置文件
│
├── 📁 assets/               # 资源文件夹
│   ├── 📁 images/          # 图片资源
│   │   ├── 📁 scenes/      # 场景背景图
│   │   ├── 📁 characters/  # 角色立绘
│   │   ├── 📁 items/       # 物品图片
│   │   └── 📁 ui/          # UI元素图片
│   │
│   ├── 📁 audio/           # 音频资源
│   │   ├── 📁 bgm/         # 背景音乐
│   │   ├── 📁 sfx/         # 音效
│   │   └── 📁 voice/       # 角色配音
│   │
│   ├── 📁 video/           # 视频资源
│   │   ├── 📁 cutscenes/   # 过场动画
│   │   └── 📁 effects/     # 特效视频
│   │
│   └── 📁 plugins/         # H5小游戏插件
│       ├── 📁 minigame_1/
│       └── 📁 minigame_2/
│
├── 📁 modules/             # Ink模块文件
│   ├── 📄 dialogue.ink     # 对话系统
│   ├── 📄 inventory.ink    # 物品系统
│   └── 📄 mechanics.ink    # 游戏机制
│
├── 📁 saves/               # 存档文件夹
└── 📁 exports/             # 导出文件夹

文件组织原则

  • 入口文件: 根目录的.ink文件作为游戏入口点
  • 模块化: 使用INCLUDE引入子模块,保持代码整洁
  • 资源就近: 相关资源按类型和用途分类存放
  • 版本控制友好: 避免二进制文件冲突,使用清晰的命名

🏷 Ink脚本扩展标签

1. 场景控制标签

// 设置场景背景
~ scene("assets/images/scenes/classroom_day.jpg")
~ scene("classroom_day", "fade", 1.5)  // 使用预定义ID,淡入效果,1.5秒

// 场景转换效果
~ transition("fade|slide|zoom|blur", duration)

// 天气效果
~ weather("rain|snow|fog|sunny")

2. 角色与立绘标签

// 显示角色立绘
~ character("alice", "assets/images/characters/alice_happy.png", "left")
~ character("alice", "happy", "center", "fade", 0.5)

// 角色表情切换
~ expression("alice", "sad|angry|surprised|thinking")

// 角色位置
~ position("alice", "left|center|right|x:100,y:200")

// 角色退场
~ hide("alice", "fade", 0.5)

3. 音频控制标签

// 背景音乐
~ bgm("assets/audio/bgm/main_theme.mp3")
~ bgm("main_theme", volume: 0.7, loop: true)
~ stopBgm(fadeOut: 2.0)

// 音效
~ sfx("assets/audio/sfx/door_knock.mp3")
~ sfx("door_knock", volume: 0.8)

// 角色语音
~ voice("alice", "assets/audio/voice/alice_001.mp3")
~ voice("alice_line_001")  // 使用预定义ID

4. 视觉效果标签

// 屏幕震动
~ shake(intensity: 5, duration: 0.5)

// 闪烁效果
~ flash("white", duration: 0.2)

// 滤镜效果
~ filter("grayscale|sepia|blur|brightness:1.5")

// 粒子效果
~ particles("snow|rain|leaves|sparkles")

5. UI控制标签

// 显示/隐藏UI
~ showUI("dialogue|choices|inventory|status")
~ hideUI("all")

// 自定义UI面板
~ panel("character_info", "assets/ui/character_panel.html")

// 通知提示
~ notify("获得物品: 神秘钥匙", type: "success", duration: 3)

6. 小游戏集成标签

// 启动H5小游戏
~ minigame("puzzle_lock", "assets/plugins/puzzle_lock/index.html")

// 传递参数给小游戏
~ minigame("card_battle", params: {difficulty: "hard", reward: "key_item"})

// 根据小游戏结果分支
* [完成拼图] -> puzzle_success
* [放弃拼图] -> puzzle_failed

7. 摄像机控制标签

// 镜头缩放
~ camera("zoom", scale: 1.5, x: 400, y: 300, duration: 2)

// 镜头平移
~ camera("pan", x: 100, y: 0, duration: 3)

// 镜头重置
~ camera("reset", duration: 1)

8. 数据持久化标签

// 自动存档点
~ autosave()

// 标记存档点
~ checkpoint("chapter_1_end")

// 成就解锁
~ achievement("first_ending")

📝 资源命名规范

图片命名

场景: scene_[场景名]_[状态].jpg
     scene_classroom_day.jpg
     scene_classroom_night.jpg

立绘: char_[角色名]_[表情]_[服装].png
     char_alice_happy_school.png
     char_alice_sad_casual.png

物品: item_[物品名].png
     item_key_golden.png

UI:  ui_[元素名].png
     ui_button_start.png

音频命名

BGM:   bgm_[场景/情绪]_[编号].mp3
       bgm_main_theme_01.mp3
       bgm_battle_02.mp3

音效:  sfx_[动作]_[编号].mp3
       sfx_door_open_01.mp3
       sfx_footstep_02.mp3

语音:  voice_[角色]_[章节]_[行号].mp3
       voice_alice_ch01_001.mp3

配置文件示例 (config.json)

{
  "game": {
    "title": "我的AVG游戏",
    "version": "1.0.0",
    "author": "游戏作者",
    "description": "一个精彩的互动故事"
  },
  "display": {
    "width": 1920,
    "height": 1080,
    "mode": "16:9",
    "ui_scale": 1.0
  },
  "audio": {
    "master_volume": 1.0,
    "bgm_volume": 0.7,
    "sfx_volume": 0.8,
    "voice_volume": 0.9
  },
  "resources": {
    "preload": [
      "assets/images/scenes/scene_intro.jpg",
      "assets/audio/bgm/bgm_main_theme.mp3"
    ],
    "lazy_load": true
  },
  "localization": {
    "default": "zh-CN",
    "available": ["zh-CN", "en-US", "ja-JP"]
  }
}

🎮 预览系统规范

预览模式分级

1. 文本模式 (基础)

  • 纯文本对话和选择
  • 变量状态显示
  • 基础流程测试

2. 视觉模式 (标准)

  • 场景背景显示
  • 角色立绘展示
  • 基础转场效果
  • UI界面预览

3. 完整模式 (高级)

  • 音频播放
  • 视频播放
  • 粒子效果
  • H5小游戏
  • 完整特效

资源加载策略

// 预览器资源加载配置
{
  "preview": {
    "mode": "visual",  // text | visual | full
    "resource_loading": {
      "images": {
        "quality": "medium",  // low | medium | high
        "lazy": true,
        "cache": true
      },
      "audio": {
        "enabled": false,  // 预览时可选择性禁用
        "preload": false
      },
      "plugins": {
        "enabled": true,
        "sandbox": true  // 安全沙箱模式
      }
    },
    "performance": {
      "max_texture_size": 2048,
      "animation_fps": 30,
      "auto_quality": true
    }
  }
}

🎯 最佳实践示例

典型场景脚本示例

=== chapter_1_intro ===
// 场景设置
~ scene("classroom_morning")
~ bgm("school_theme", volume: 0.6)
~ weather("sunny")

// 角色入场
~ character("alice", "neutral", "left", "fade", 1)
~ character("bob", "happy", "right", "slide", 0.8)

// 对话
Alice: 早上好!今天的天气真不错。
~ voice("alice_ch1_001")
~ expression("alice", "happy")

Bob: 是啊,特别适合学习新知识。
~ voice("bob_ch1_001")

// 选择分支
+ [赞同] -> agree_with_bob
+ [开玩笑] -> make_joke
+ [保持沉默] -> stay_silent

=== agree_with_bob ===
~ expression("alice", "smile")
Alice: 你说得对,我们开始吧!
~ achievement("positive_start")
-> continue_story

=== make_joke ===
~ expression("bob", "surprised")
~ sfx("laugh")
Bob: 哈哈,你真幽默!
-> continue_story

=== stay_silent ===
~ expression("bob", "confused")
...
~ notify("你选择了保持沉默", type: "info")
-> continue_story

小游戏集成示例

=== puzzle_door ===
你来到了一扇神秘的门前,门上有一个复杂的拼图锁。

~ scene("door_puzzle")
~ bgm("mystery_theme")

+ [尝试解开拼图]
    ~ minigame("sliding_puzzle", params: {difficulty: "medium", timeLimit: 300})
    
    // 小游戏结果处理
    {minigame_result:
    - "success":
        ~ sfx("unlock")
        ~ notify("拼图解开了!", type: "success")
        ~ VAR has_key = true
        -> enter_room
    - "failed":
        ~ sfx("error")
        需要更多时间思考...
        -> puzzle_door
    - "abandoned":
        也许稍后再试...
        -> hallway
    }

+ [暂时离开]
    -> hallway

情感系统示例

// 在 characters.ink 中定义
VAR alice_affection = 0
VAR bob_trust = 0

=== function change_relationship(character, amount)
{character:
- "alice": 
    ~ alice_affection = alice_affection + amount
    ~ notify("Alice 好感度 {amount > 0: +|}{amount}", type: "{amount > 0: success|warning}")
- "bob":
    ~ bob_trust = bob_trust + amount
    ~ notify("Bob 信任度 {amount > 0: +|}{amount}", type: "{amount > 0: success|warning}")
}

// 使用示例
选择了帮助Alice
~ change_relationship("alice", 10)
~ expression("alice", "happy")

📊 性能优化建议

资源优化

  1. 图片:

    • 场景图: 1920x1080, JPEG, 质量85%
    • 立绘: PNG with alpha, 适当尺寸
    • 使用WebP格式(如果支持)
  2. 音频:

    • BGM: MP3/OGG, 128kbps
    • SFX: MP3/OGG, 96kbps
    • Voice: MP3, 96-128kbps
  3. 预加载策略:

    • 关键资源预加载
    • 按章节懒加载
    • 使用资源池复用

脚本优化

  1. 模块化管理,避免单文件过大
  2. 使用函数减少重复代码
  3. 合理使用变量,避免过多全局变量
  4. 使用线程(thread)处理并行逻辑

🚀 发布准备

检查清单

  • 所有资源路径正确
  • 音频文件格式兼容
  • 图片尺寸优化
  • 存档系统测试
  • 多语言文本准备
  • 成就系统配置
  • 小游戏集成测试
  • 性能测试通过

导出配置

{
  "export": {
    "platform": ["web", "desktop"],
    "optimization": {
      "minify": true,
      "compress_images": true,
      "bundle_resources": true
    },
    "web": {
      "responsive": true,
      "pwa": true,
      "offline": true
    }
  }
}

📚 参考资源


本规范持续更新中,欢迎社区贡献和反馈