game-development

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Game 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)
game-development/web-games
Mobile (iOS, Android)
game-development/mobile-games
PC (Steam, Desktop)
game-development/pc-games
VR/AR headsets
game-development/vr-ar
如果游戏面向...使用子技能
网页浏览器(HTML5、WebGL)
game-development/web-games
移动端(iOS、Android)
game-development/mobile-games
PC端(Steam、桌面平台)
game-development/pc-games
VR/AR头显
game-development/vr-ar

Dimension Selection

维度选择

If the game is...Use Sub-Skill
2D (sprites, tilemaps)
game-development/2d-games
3D (meshes, shaders)
game-development/3d-games
如果游戏是...使用子技能
2D(精灵图、瓦片地图)
game-development/2d-games
3D(网格、着色器)
game-development/3d-games

Specialty Areas

专业领域

If you need...Use Sub-Skill
GDD, balancing, player psychology
game-development/game-design
Multiplayer, networking
game-development/multiplayer
Visual style, asset pipeline, animation
game-development/game-art
Sound design, music, adaptive audio
game-development/game-audio

如果你需要...使用子技能
GDD、平衡性设计、玩家心理学
game-development/game-design
多人游戏、网络功能
game-development/multiplayer
视觉风格、资源管线、动画
game-development/game-art
音效设计、音乐、自适应音频
game-development/game-audio

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. 模式选择矩阵

PatternUse WhenExample
State Machine3-5 discrete statesPlayer: Idle→Walk→Jump
Object PoolingFrequent spawn/destroyBullets, particles
Observer/EventsCross-system communicationHealth→UI updates
ECSThousands of similar entitiesRTS units, particles
CommandUndo, replay, networkingInput recording
Behavior TreeComplex AI decisionsEnemy 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 joystick
Why: Enables multi-platform, rebindable controls.

将输入抽象为动作,而非原始按键:
"jump"  → 空格键、游戏手柄A键、触摸点击
"move"  → WASD键、左摇杆、虚拟摇杆
优势: 支持多平台、可重新绑定的控制方式。

4. Performance Budget (60 FPS = 16.67ms)

4. 性能预算(60 FPS = 16.67毫秒)

SystemBudget
Input1ms
Physics3ms
AI2ms
Game Logic4ms
Rendering5ms
Buffer1.67ms
Optimization Priority:
  1. Algorithm (O(n²) → O(n log n))
  2. Batching (reduce draw calls)
  3. Pooling (avoid GC spikes)
  4. LOD (detail by distance)
  5. Culling (skip invisible)

系统预算
输入1毫秒
物理3毫秒
AI2毫秒
游戏逻辑4毫秒
渲染5毫秒
缓冲1.67毫秒
优化优先级:
  1. 算法优化(O(n²) → O(n log n))
  2. 批处理(减少绘制调用)
  3. 对象池(避免GC峰值)
  4. LOD(根据距离调整细节)
  5. 剔除(跳过不可见对象)

5. AI Selection by Complexity

5. 按复杂度选择AI类型

AI TypeComplexityUse When
FSMSimple3-5 states, predictable behavior
Behavior TreeMediumModular, designer-friendly
GOAPHighEmergent, planning-based
Utility AIHighScoring-based decisions

AI类型复杂度适用场景
FSM(有限状态机)简单3-5种状态、可预测行为
行为树中等模块化、便于设计师使用
GOAP(目标导向动作规划)涌现式、基于规划的行为
效用AI基于评分的决策

6. Collision Strategy

6. 碰撞检测策略

TypeBest For
AABBRectangles, fast checks
CircleRound objects, cheap
Spatial HashMany similar-sized objects
QuadtreeLarge worlds, varying sizes

类型最佳适用场景
AABB(轴对齐 bounding box)矩形对象、快速检测
圆形碰撞圆形对象、计算成本低
空间哈希大量相似尺寸的对象
四叉树大型世界、对象尺寸不一

Anti-Patterns (Universal)

反模式(通用)

Don'tDo
Update everything every frameUse events, dirty flags
Create objects in hot loopsObject pooling
Cache nothingCache references
Optimize without profilingProfile first
Mix input with logicAbstract input layer

不要做应该做
每帧更新所有对象使用事件、脏标记
在热循环中创建对象使用对象池
不做任何缓存缓存引用
未做性能分析就优化先做性能分析
将输入与逻辑混合抽象输入层

Routing Examples

路由示例

Example 1: "I want to make a browser-based 2D platformer"

示例1:“我想制作一款基于浏览器的2D平台游戏”

→ Start with
game-development/web-games
for framework selection → Then
game-development/2d-games
for sprite/tilemap patterns → Reference
game-development/game-design
for level design
→ 先使用
game-development/web-games
选择框架 → 再使用
game-development/2d-games
学习精灵图/瓦片地图模式 → 参考
game-development/game-design
进行关卡设计

Example 2: "Mobile puzzle game for iOS and Android"

示例2:“面向iOS和Android的移动端解谜游戏”

→ Start with
game-development/mobile-games
for touch input and stores → Use
game-development/game-design
for puzzle balancing
→ 先使用
game-development/mobile-games
处理触摸输入和应用商店相关事宜 → 使用
game-development/game-design
进行解谜平衡性设计

Example 3: "Multiplayer VR shooter"

示例3:“多人VR射击游戏”

game-development/vr-ar
for comfort and immersion →
game-development/3d-games
for rendering →
game-development/multiplayer
for networking

Remember: Great games come from iteration, not perfection. Prototype fast, then polish.
→ 使用
game-development/vr-ar
处理舒适度与沉浸感设计 → 使用
game-development/3d-games
处理渲染 → 使用
game-development/multiplayer
处理网络功能

记住: 优秀的游戏源于迭代,而非一蹴而就。快速制作原型,然后逐步打磨。