game-development
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGame Development
游戏开发
Orchestrator skill that provides core principles and routes to specialized sub-skills.
Orchestrator Skill:提供核心原则并路由到专业子技能。
When to Use This Skill
何时使用此技能
You are working on a game development project. This skill teaches the PRINCIPLES of game development and directs you to the right sub-skill based on context.
你正在进行游戏开发项目。本技能讲解游戏开发的核心原则,并根据场景引导你使用合适的子技能。
Sub-Skill Routing
子技能路由
Platform Selection
平台选择
| If the game targets... | Use Sub-Skill |
|---|---|
| Web browsers (HTML5, WebGL) | |
| Mobile (iOS, Android) | |
| PC (Steam, Desktop) | |
| VR/AR headsets | |
| 如果游戏面向... | 使用子技能 |
|---|---|
| 网页浏览器(HTML5、WebGL) | |
| 移动端(iOS、Android) | |
| PC端(Steam、桌面平台) | |
| VR/AR头显 | |
Dimension Selection
维度选择
| If the game is... | Use Sub-Skill |
|---|---|
| 2D (sprites, tilemaps) | |
| 3D (meshes, shaders) | |
| 如果游戏是... | 使用子技能 |
|---|---|
| 2D(精灵图、瓦片地图) | |
| 3D(网格、着色器) | |
Specialty Areas
专业领域
| If you need... | Use Sub-Skill |
|---|---|
| GDD, balancing, player psychology | |
| Multiplayer, networking | |
| Visual style, asset pipeline, animation | |
| Sound design, music, adaptive audio | |
| 如果你需要... | 使用子技能 |
|---|---|
| GDD、平衡性设计、玩家心理学 | |
| 多人游戏、网络功能 | |
| 视觉风格、资源管线、动画 | |
| 音效设计、音乐、自适应音频 | |
Core Principles (All Platforms)
核心原则(全平台通用)
1. The Game Loop
1. Game Loop(游戏循环)
Every game, regardless of platform, follows this pattern:
INPUT → Read player actions
UPDATE → Process game logic (fixed timestep)
RENDER → Draw the frame (interpolated)Fixed Timestep Rule:
- Physics/logic: Fixed rate (e.g., 50Hz)
- Rendering: As fast as possible
- Interpolate between states for smooth visuals
无论面向哪个平台,所有游戏都遵循以下模式:
INPUT → 读取玩家操作
UPDATE → 处理游戏逻辑(固定时间步长)
RENDER → 绘制画面(插值处理)固定时间步长规则:
- 物理/逻辑:固定速率(例如50Hz)
- 渲染:尽可能快
- 对状态进行插值处理以实现流畅视觉效果
2. Pattern Selection Matrix
2. 模式选择矩阵
| Pattern | Use When | Example |
|---|---|---|
| State Machine | 3-5 discrete states | Player: Idle→Walk→Jump |
| Object Pooling | Frequent spawn/destroy | Bullets, particles |
| Observer/Events | Cross-system communication | Health→UI updates |
| ECS | Thousands of similar entities | RTS units, particles |
| Command | Undo, replay, networking | Input recording |
| Behavior Tree | Complex AI decisions | Enemy AI |
Decision Rule: Start with State Machine. Add ECS only when performance demands.
| 模式 | 适用场景 | 示例 |
|---|---|---|
| 状态机(State Machine) | 3-5种离散状态 | 玩家:Idle→Walk→Jump |
| 对象池(Object Pooling) | 需要频繁生成/销毁对象 | 子弹、粒子效果 |
| 观察者/事件模式(Observer/Events) | 跨系统通信 | 生命值变化→UI更新 |
| ECS(实体组件系统) | 存在大量相似实体 | RTS单位、粒子效果 |
| 命令模式(Command) | 撤销、回放、网络同步 | 输入记录 |
| 行为树(Behavior Tree) | 复杂AI决策 | 敌人AI |
决策规则: 从状态机开始,仅当性能要求较高时再使用ECS。
3. Input Abstraction
3. 输入抽象
Abstract input into ACTIONS, not raw keys:
"jump" → Space, Gamepad A, Touch tap
"move" → WASD, Left stick, Virtual joystickWhy: Enables multi-platform, rebindable controls.
将输入抽象为动作,而非原始按键:
"jump" → 空格键、游戏手柄A键、触摸点击
"move" → WASD键、左摇杆、虚拟摇杆优势: 支持多平台、可重新绑定的控制方式。
4. Performance Budget (60 FPS = 16.67ms)
4. 性能预算(60 FPS = 16.67毫秒)
| System | Budget |
|---|---|
| Input | 1ms |
| Physics | 3ms |
| AI | 2ms |
| Game Logic | 4ms |
| Rendering | 5ms |
| Buffer | 1.67ms |
Optimization Priority:
- Algorithm (O(n²) → O(n log n))
- Batching (reduce draw calls)
- Pooling (avoid GC spikes)
- LOD (detail by distance)
- Culling (skip invisible)
| 系统 | 预算 |
|---|---|
| 输入 | 1毫秒 |
| 物理 | 3毫秒 |
| AI | 2毫秒 |
| 游戏逻辑 | 4毫秒 |
| 渲染 | 5毫秒 |
| 缓冲 | 1.67毫秒 |
优化优先级:
- 算法优化(O(n²) → O(n log n))
- 批处理(减少绘制调用)
- 对象池(避免GC峰值)
- LOD(根据距离调整细节)
- 剔除(跳过不可见对象)
5. AI Selection by Complexity
5. 按复杂度选择AI类型
| AI Type | Complexity | Use When |
|---|---|---|
| FSM | Simple | 3-5 states, predictable behavior |
| Behavior Tree | Medium | Modular, designer-friendly |
| GOAP | High | Emergent, planning-based |
| Utility AI | High | Scoring-based decisions |
| AI类型 | 复杂度 | 适用场景 |
|---|---|---|
| FSM(有限状态机) | 简单 | 3-5种状态、可预测行为 |
| 行为树 | 中等 | 模块化、便于设计师使用 |
| GOAP(目标导向动作规划) | 高 | 涌现式、基于规划的行为 |
| 效用AI | 高 | 基于评分的决策 |
6. Collision Strategy
6. 碰撞检测策略
| Type | Best For |
|---|---|
| AABB | Rectangles, fast checks |
| Circle | Round objects, cheap |
| Spatial Hash | Many similar-sized objects |
| Quadtree | Large worlds, varying sizes |
| 类型 | 最佳适用场景 |
|---|---|
| AABB(轴对齐 bounding box) | 矩形对象、快速检测 |
| 圆形碰撞 | 圆形对象、计算成本低 |
| 空间哈希 | 大量相似尺寸的对象 |
| 四叉树 | 大型世界、对象尺寸不一 |
Anti-Patterns (Universal)
反模式(通用)
| Don't | Do |
|---|---|
| Update everything every frame | Use events, dirty flags |
| Create objects in hot loops | Object pooling |
| Cache nothing | Cache references |
| Optimize without profiling | Profile first |
| Mix input with logic | Abstract input layer |
| 不要做 | 应该做 |
|---|---|
| 每帧更新所有对象 | 使用事件、脏标记 |
| 在热循环中创建对象 | 使用对象池 |
| 不做任何缓存 | 缓存引用 |
| 未做性能分析就优化 | 先做性能分析 |
| 将输入与逻辑混合 | 抽象输入层 |
Routing Examples
路由示例
Example 1: "I want to make a browser-based 2D platformer"
示例1:“我想制作一款基于浏览器的2D平台游戏”
→ Start with for framework selection
→ Then for sprite/tilemap patterns
→ Reference for level design
game-development/web-gamesgame-development/2d-gamesgame-development/game-design→ 先使用选择框架
→ 再使用学习精灵图/瓦片地图模式
→ 参考进行关卡设计
game-development/web-gamesgame-development/2d-gamesgame-development/game-designExample 2: "Mobile puzzle game for iOS and Android"
示例2:“面向iOS和Android的移动端解谜游戏”
→ Start with for touch input and stores
→ Use for puzzle balancing
game-development/mobile-gamesgame-development/game-design→ 先使用处理触摸输入和应用商店相关事宜
→ 使用进行解谜平衡性设计
game-development/mobile-gamesgame-development/game-designExample 3: "Multiplayer VR shooter"
示例3:“多人VR射击游戏”
→ for comfort and immersion
→ for rendering
→ for networking
game-development/vr-argame-development/3d-gamesgame-development/multiplayerRemember: Great games come from iteration, not perfection. Prototype fast, then polish.
→ 使用处理舒适度与沉浸感设计
→ 使用处理渲染
→ 使用处理网络功能
game-development/vr-argame-development/3d-gamesgame-development/multiplayer记住: 优秀的游戏源于迭代,而非一蹴而就。快速制作原型,然后逐步打磨。