笔记:[Game Engine Architecture 游戏引擎架构 - 作业部落 Cmd Markdown 编辑阅读器](https://zybuluo.com/gnat-xj/note/620658)
# Game Engine Architecture 游戏引擎架构
## 第一部分:基础
### 1 导论
```
* 典型游戏团队的结构
* 游戏是什么
* 游戏引擎是什么
* 不同游戏类型中的引擎差异
* 游戏引擎概观
* 运行时引擎架构
* 工具及资产管道
```
游戏是一种软实时(soft real-time)互动(interactive)基于代理(agent-based)计算模拟(computer simulation)型计算机应用。
- 街机游戏(arcade game)
- 任天堂的 8 位红白机(Famicom)
- id software 的 id 发音如 kid 的 id,来自 id(本我),ego(自我)与 superego(超我)
- runtime programmer(做游戏)
- tool programmer(做做游戏的辅助工具)
- generalist(通才)
- lead engineer(首席工程师)
- technical director,TD(技术总监)
- chief technical officer(CTO)
- motion capture actor(动画捕捉演员)
- voice actor(配音演员)
- game designer
- first-party developer(第一方开发商),例如顽皮狗是索尼的第一方开发商
- Monopoly(游戏:大富翁)
- massively multiplayer online games,MMOG(大型多人在线游戏)
- interactively temporal simulation(互动时间性模拟)
- interactively real-time simulation(互动实时模拟)
- soft real-time system,不实时只是效果差点,无大碍
- hard real-time system,不实时会导致重大事故,如核电站的控制棒(control rod)系统
- force feedback(力反馈)
- FPS,first person shooter,第一人称射击游戏
- heads-up display(平视显示器)
- hovercraft(气垫船)
- 主角的能力(ability)以及运动模式(locomotion mode)
- non-player character,NPC(非玩家角色)
- Tekken(游戏:铁拳)
- subsurface scattering,SSS(次表面散射)
- brawler,beat 'em up(痛殴他们)
- hash and slash(切和斩)
- oblique top-down view(斜面俯视)
- height field terrian(高度场地形)
- persistent word(持久世界)
- god game(上帝模拟游戏)
- Castle Wolfenstein 3D,1992,德军总部,第一个 FPS 游戏
- 虚幻引擎是强大的原型制作(prototyping)工具和商业游戏平台
- preeptive multitasking(抢占式多任务)
- collision detection(碰撞检测)
- rigid body dynamics(刚体力学)
- low-level renderer(低阶渲染器)
- message pump(消息泵(beng))
- back-face culling(背面剔除)
- frustum cull(平截头体剔除)
- potentially visible set,PVS(潜在可见集)
- 场景图(scene graph)
- decal system(贴花系统)
- full-screen post effect(全屏后期处理效果)
- high dynamic range,HDR(高动态范围)
- bloom(敷霜效果)
- bleech bypass(略过漂白)
- full-motion video,FMV(全动视频)
- in-game cinematics,IGC(游戏内置电影)
- print statement / log 的 verbosity level
- force(力) and torque(力矩)
- skeletal annimation(骨骼动画)
- morph target animation(变形目标动画)
- ragdoll(布娃娃)
- game asset,`/æsɛt/`(游戏资产)
- asset conditioning pipeline(资产调节管道)
- digital content creation,DCC(数字内容创作)
### 2 专业工具
```
* 版本控制
* 微软 Visal Studio
* 剖析工具
* 内存泄露和损坏检测
* 其他工具
```
- translation unit(翻译单元)
- `cl /c foo.cpp /Fo foo.obj /Wall /Od /Zi`,`Od` 关掉优化,`/Zi` 产生调试信息
- F11 step into,F10 step over
- VS wathing window:`,d` 十进制,`,x` 十六进制,`,6`,六个元素
- conditional breakpoint(条件断点)
- Pareto principle(帕累托法则),也叫 80-20 rule,计算机中更常见的是 90-10 rule
- unobtrosive(不唐突)
- hex editor
- three-way merge tool
- difference/diff tool
### 3 游戏软件的工程基础
```
* 重温 C++ 及最佳实践
* C/C++ 的数据、代码及内存
* 捕捉及处理错误
```
- 只容许从一个单继承层次结构中多重继承一些简单且无父的类,这些类称为嵌入类(mix-in class)
- 尾数(mantissa),指数(exponent),IEEE 浮点数:$(-1)^{s}cdot (1+m)cdot 2^{e-127}$,`|S|-E(8)-|-M(23)-|`,M 的基底是 1/2, 1/4, 1/8, ...
- SIMD,single instruction multiple data(单指令多数据)
### 4 游戏所需的三维数学
```
* 在二维中解决三维问题
* 点和矢量
* 矩阵
* 四元数
* 比较各种旋转表达方式
* 其他数学对象
* 硬件加速的 SIMD 运算
* 产生随机数
```
- cartesian coordinate system(笛卡尔坐标系)
- cylindrical coordinate system(圆柱坐标系)
- sphericial coordinate system(球坐标系)
- RH,right-handed,LH, left-handed,利手(handedness)对叉积有影响(视觉化一个叉积时,右手坐标系用右手法则,左手坐标系用左手法则)
- right hand rule(右手法则)
- position vector/radius vector
- $otimes$ Hadamard product
- Pythagorean theorem(勾股定理),`/paɪˌθæɡəˈriən/`
- reciprocal(倒数)
- 叉积定义了 positive rotation(正旋)方向
- linear interpolation(线性插值),这个运算常被称作 LERP
- weighted average
- model space / object space / local space
- camera space / view space
- ellipsoid 椭球
- normed division algebra(赋范可除代数)
- 四元数:$q=[q_V q_S]=[vec acdot sin{frac{theta}{2}} cos{frac{theta}{2}}]$
- LERP → SLEPR (spherical linear interpolation)
- gimbal lock(万向节死锁)
- SQT(scale,quaternion,translation)
- point-normal form(点法式)
- AABB(axis-aligend bounding box),$[x_{min}, x_{max}, y_{min}, y_{max}, z_{min}, z_{max}]$
- OOB(oriented bounding box)
- frustum(平截头体)
- multimedia extension,MMX,多媒体扩展
- streaming SIMD extensions,SSE(单指令多数据流扩展)
- 随机数(random number)
- 线性同余产生器(linear congruential generator,LCG)
- 梅森旋转(mersenne twiter,MT)
- 所有之母及 Xorshift(mother of all pseudo-random number generator)
## 第二部分:低阶引擎系统
### 5 游戏支持系统
```
* 子系统的启动和终止
* 内存管理
* 容器
* 字符串
* 引擎配置
```
- 蛮力方法总优于其他方法
- memory access pattern(内存访问模式)
- write-thgouth cache(透写式缓存)
- write-back / copy-back(回写)
### 6 资源及文件系统
```
* 文件系统
* 资源管理器
```
- Modern C++ Design,Loki
- intrusive list(侵入式链表)
- 多字节字符集(multibyte character set,MBCS)
- UTF-16,wide character set(WCS)
- per-use option(个别用户选项)
- volume specifer(卷指示符),path separator(路径分割符)
- current working directory,present working directory
### 7 游戏循环及实习模拟
```
* 渲染循环
* 游戏循环
* 游戏循环的架构风格
* 抽象时间线
* 测量及处理时间
* 多处理器的游戏循环
* 网络多人游戏循环
```
- rectangle invalidation(矩阵失效)
- render loop,game loop
- abstract timeline,real timeline,game timeline
- oscilloscope(示波器)
- frame time,time delta / delta time,frame period
- perceived speed
- frame-rate spike
- frame-rate governing
- vertical blanking interval(垂直消隐区间)
- 1/300s 位时间单位(原理和 60 进制一样)
- 多人架构对于游戏主循环的结构有深远影响
### 8 人体接口设备(HID)
```
* 各种人体学接口设备
* 人体学接口设备的接口技术
* 输入类型
* 输出类型
* 游戏引擎的人体学接口设备系统
* 人体学接口设备使用实践
```
- light emitting diode,LED(发光二极管),`['daɪod]`
- 震动反馈(rumble)
- button-mapping table(按钮映射表)
- dead zone
- moving average
- grapple(扑捉技)
### 9 调试及开发工具
```
* 日志及跟踪
* 调试用的绘图功能
* 游戏内置菜单
* 游戏内置主控台
* 调试用摄像机和游戏暂停
* 作弊
* 屏幕截图和录像
* 游戏内置性能剖析
* 游戏内置的内存统计和泄露检测
```
- printf 调试法
- playtest 关卡(qia),游戏测试关卡
- sprint(快速跑)
- in-game menu
- invincible(不死)
- in-game profiling tool
## 第三部分:图形及动画
### 10 渲染引擎
```
* 采用深度缓冲的三角形光栅化基础
* 渲染管道
* 高级光照及全局光照
* 视觉效果和覆盖层
* 延伸阅读
```
- visual property(视觉特性)
- sloving the rendering equation(求解渲染方程),也叫着色方程(shading equation)
- light transport model
- opaque(不透明)
- transparent(透明)
- translucent(半透明)
- piecewise linear approximation(分段线性逼近)
- tessellation(镶嵌)
- 三角化(triangulation)
- level-of-detail,LOD(层次结构)
- dynamic tessellation
- progressive mesh
- winding order(缠绕顺序)
- cache coherency(缓存一致性)
- model-to-world matrix(模型至世界矩阵)
- diffuse(漫反射)
- specular(镜面反射)
- absorb(吸收),反射(reflect),折射(refract),衍射(diffract)
- subsurface scattering,SSS
- anisotropic(各向异性)
- color model,color channel,color format
- bits per pixel,BPP
- RGB888,RGB565
- paletted format
- per-vertex dynamic lighting
- Gourand shading(高氏着色器)
- 各种贴图
- texure map(纹理贴图)
- emmisive texture map(放射光贴图)
- diffuse map(漫反射贴图)
- albedo map(反照率贴图)
- normal map(法线贴图)
- gloss map(光泽贴图)
- environment map(环境贴图)
- light map(光照贴图)
- texture addressing mode(纹理寻址模式)
- wrap mode(缠绕)
- mirror mode(镜像)
- clamp mode(截取)
- border color mode(边缘颜色)
- texel density(纹素密度)
- mipmapping(多级渐远纹理)
- trilinear filtering(三线性过滤)来混合采样生成新一 level 的 texture map
- Cornell box(康奈尔盒子)
- local illumination model(局部光照模型)
- global illumination model
- ray tracing(光纤追踪)
- radiosity(辐射度算法)
- Phong 氏光照模型,Phone reflection model:$$I = k_AA + sum_i{[k_D(Ncdot L_i)+k_S(R_icdot V)^alpha]C_i}$$
- $k_A$ 环境光因子
- $k_D$ 漫反射因子
- $k_S$ 镜面反射因子
- $C_i$ 光源颜色及强度 $C_i = [C_{R_i} C_{G_i} C_{B_i}]$
- Blinn-Phone 反射模型
- BRDF(bidirectional reflection distrubtion function)
- ambient light(环境光)
- directional light(平行光)
- point light(点光)
- 全向光(omni-directional light)
- spot light(聚光)
- emmisive texture map(放射光贴图)
- umbra,`['ʌmbrə]`(本影),penumbra,`[pɪ'nʌmbrə]`(半影)
- perspective foreshortening(透视收缩)
- homogeneous clip space(齐次裁剪空间),通常左手坐标系
- aspect ratio
- 屏幕空间
- triple buffering(三缓冲法)
- depth buffer(深度缓冲),也称 z-buffer(z 缓冲)
- stencil buffer(模板缓冲)
- full-screen antialiasing,FSAA(全屏幕抗锯齿)
- multisample antialiasing,MSAA(多重采样抗锯齿)
- z-fighting
- w-buffer(w 缓冲)
- Unreal Engine 3(虚幻引擎 3)
- visibility determination(可见性判断)
- quadrant(象限)
- binary space partitioning(二元空间分割)
- constructive solid geometry(构造实体几何)
- image-based lighting(基于图像的光照)
- normal map(法线贴图)
- height map(高度贴图):parallax mapping(视差贴图法),浮雕贴图(relief mapping)
- spherical environment map
- cubic environment map
- 方位角(azimuthal angle)
- 天顶(zenith)
- high dynamic range,HDR,可以无失真地同时保留亮区和暗区的细节
- tone mapping(色调映射)
- silhouette edge(阴影体积)
- shadow map(阴影贴图)
- shadow volume(阴影体积)
- ambient occlusion(环境遮挡)
- contact shadow(接触阴影)
- caustics(焦散)
- geometry buffer(几何缓冲,G-buffer)
- sky dome(天空穹顶),sky box(天空盒)
- cathode ray tube,CRT(阴极射线管)
- depth-of-field blur(景深模糊)
- vignette(晕影)
Normal map(法线贴图),[Advances in Real-Time Rendering in 3D Graphics and Games - SIGGRAPH 2010](http://advances.realtimerendering.com/s2010/) 下 CryENGINE 3: Reaching the Speed of Light 介绍了其编码。
### 11 动画系统
```
* 角色动画的类型
* 骨骼
* 姿势
* 动画片段
* 蒙皮及生成矩阵调色板
* 动画混合
* 后期处理
* 压缩技术
* 动画系统架构
* 动画管道
* 动作状态机
* 动画控制器
```
- cel animation(赛璐璐动画)
- sprite animation(精灵动画)
- rigid hierarchical animation(刚性层阶式动画)
- pelvis(盆骨)
- torso(躯体)
- upper arm(上臂/胳臂(bei))
- lower arm(下臂/手臂)
- upper leg(大腿)
- lower leg(小腿)
- hand(手)
- feet(脚部)
- head(头部)
- morph target animation(变形目标动画)
- facial animation(面部动画)
- skinned animation(蒙皮动画)
- pivotal movement(轴转移动)
- targeted movement(靶向移动)
- one-dimentional LERP blending(一维线性插值混合)
- $P_{LERP} = alpha P_0 + beta P_1 + (1-alpha -beta)P_2$
- delaunay triangulation(Delaunay 三角分割)
- partial-skeleton blending(骨骼分部混合)
- blend mask(混合遮罩)
- inverse kinematics,IK(逆运动学)
- forward kinematics,FK(正向运动学)
- end effector(末端受动器)
- action state machine(动作状态机)
- animation state machine(动画状态机)
### 12 碰撞及刚体力学
```
* 你想在x游戏中加入物理吗
* 碰撞/物理中间件
* 碰撞检测系统
* 刚体动力学
* 整合物理引擎至游戏
* 展望:高级物理功能
```
- je ne sais quoi(难以言喻的特质)
- trigger volume(触发体积)
- buoyancy(水面模拟及浮力)
- collision representation(碰撞表达形式)
- gameplay representation(游戏性表达形式)
- visual representation(视觉表达形式)
- convex(凸),non-convex / concave(凹)
- collision primitive(碰撞原型)
- capsule(胶囊体)
- swept sphere(扫掠球体)
- cuboid(长方体)
- discrete oriented polytope,DOP(离散定向多胞体),k-DOP 是任意 k 个平面所构成的形状
- arbitrary convex volume(任意凸体积)
- polygon soul,poly soup(多边形汤),多用于静态表面建模,如地形和建筑
- compound shape(复合形状)
- analytical geometry(解析几何)
- separating axis theorem(分离轴定理)
- polytope(多胞形)
- CJK
- Christer Ericson 的 SIGGRAPH [演示 PPT](http://realtimecollisiondetection.net/pubs/SIGGRAPH04_Ericson_the_GJK_algorithm.ppt)
- Casey Muratori [Implementing GJK — 2006](https://mollyrocket.com/849)
- Minkowski difference(闵可夫斯基差)
- simplex(单纯体)
- bullet through paper,tunneling(隧穿)
- continuous collision detection,CCD(连续碰撞检测)
- time of impact(冲击时间)
- broad phase,midphase,narrow phase
- sweep and prune(扫掠裁剪)
- rigid body dynamics 教参:[Rigid Body Dynamics - Chris Hecker's Website](http://chrishecker.com/Rigid_Body_Dynamics)
- MKS 单位系统,m:meter,k:kilogram,s:second
- center of mass,CM/COM(质心)
- centroid(几何中心)
- linear momentum(线性动量)
- stiffness(刚度)
- mechnical viscous damper(减震器)
- angular dynamics(旋转动力学)
- moment of inertia(转动惯量)
- [Gaffer on Games | Game Physics](http://gafferongames.com/game-physics/)
- David Baraff: [An Introduction to Physically Based Modeling](http://www.cs.cmu.edu/~baraff/sigcourse/notesd1.pdf)
- inertia tensor(惯性张量)
- product of inertia(惯量积)
- Newton's law of restitution for instanteous collisions with no friction(无摩擦力下瞬时碰撞的牛顿恢复定律)
- coefficient of restitution(恢复系数)
- perfectly elastic(完全弹性)
- perfectly plastic(完全塑性)
- point-to-point constraint(点对点约束)
- stiff spring constraint(刚性弹簧约束)
- hinge constraint(铰链约束)
- prismatic constraint(滑移铰约束)
- pulley(滑轮)
- procedural animation(程序式动画)
- contraint solver(约束求解程序)
## 第四部分:游戏性
### 13 游戏性系统简介
```
* 剖析游戏世界
* 实现动态元素:游戏对象
* 数据驱动游戏引擎
* 游戏世界编辑器
```
- world chunk(world chunk)
- level(关卡)
- map(地图)
- state(舞台)
- area(地区)
- cut-scene(过场动画)
- in-game cinematics
- noninteractive sequence,NIS(非交互连续镜头)
- full-motion video,FMV
- game object(GO,游戏对象),entity,agent,actor
- particle emitter(粒子发射器)
- spline(样条)
### 14 运行时系统性基础系统
```
* 游戏性基础系统的组件
* 各种运行时对象模型架构
* 世界组块的数据格式
* 游戏世界的加载和串流
* 对象引用与世界查询
* 实时更新游戏对象
* 时间与消息泵
* 脚本
* 高层次的游戏流程
```
- load-and-stay-resident,LSR(载入并驻留)
- imperative(命令式)语言
- declarative(声明式)语言
- functional(函数式)语言
- procedural(过程式)与 object-oriented(面向对象)语言
- reflective(反射式)语言
## 总结
### 15 还有更多内容吗
```
* 一些未谈及的引擎系统
* 游戏性系统
```
- 音频再次牺牲……(据说本书第二版有)
游戏引擎架构 - 一点笔记
《游戏引擎架构》热门书评
-
走向进阶的共鸣 ---深入理解工业级的《游戏引擎架构》
26有用 0无用 秦春林 2014-06-19
这两年,我阅读了大量关于游戏开发相关的博客,文章及书籍,从理论到实践;也不断通过各种互联网工具查阅实际开发中的一些技术细节和思路;经常与同行进行不同程度的交流和探讨。我体会到,对于某个领域,最重要的是要理解该领域的系统性的知识和原理,要明白它用来解决什么问题,解决问题的思路是什么,这样你才能去高效地...
-
转载:davidgu 目前为止游戏引擎方面最值得重视的一本好书
20有用 0无用 Milo 2014-03-12
游戏引擎方面的书籍历来都埋没在大堆的书中,不为人重视。大家长期来重点关注的,都是渲染领域。近年来这些现象有所改善,Game Programming Gems作为综合的Gems类书籍,有不少篇幅涉及了这一领域,近年来更有Engine Gems系列的书涉及这一领域。然而Gems类的书籍,毕竟没有办法系统...
-
一本学习3D游戏引擎的好书
14有用 1无用 Snow 2014-02-27
因为前几年工作当中接触过一些计算机图形方面的基础内容,所以平时闲暇之余对于游戏开发也就有些好奇。年前听说Milo Yip翻译的新书《游戏引擎架构》要上市了,所以就有心想买来一读,满足一下好奇心。除此之外,出于敬仰译者在对待技术方面的严谨态度,除了拜读以外,也希望能够收藏此书。上上周的周末,拿到了此书...
-
这是我读过翻译水平最高的著作,没有之一。
8有用 0无用 Yosemite 2014-02-28
这是我读过翻译水平最高的著作,没有之一。说句实在话这书要是给某个高校老师拉几个研究生几个月就能翻完,但以译者如此深厚的功底,却译了足足三年半!可见他对待这件事有多么认真!但我常想,Milo Yip能有这么高的水平,也许正是因为他的严谨和认真吧。作为计算机和软件专业的学生,即使今后不做游戏方向,哪怕仅...
-
非常不错的一本书
4有用 1无用 Yuki 2010-01-18
这本书算是游戏引擎方面最好的一本书了.非常清楚和详细讲解了游戏引擎的架构,而且包含大量丰富的细节.仔细读的话很有收获.亮点:1.讲解现代游戏引擎架构,非常新的实例.包括作者自己公司的引擎和商业引擎例如Unreal的实例.2.清楚的讲解实现细节.代码少而思想多.往往一段话就可以让你了解某个部分的实现....
书名: 游戏引擎架构
作者: [美] Jason Gregory
出版社: 电子工业出版社
原作名: Game Engine Architecture
译者: 叶劲峰
出版年: 2014-1
页数: 800
定价: 128.00元
装帧: 平装
ISBN: 9787121222887