0
点赞
收藏
分享

微信扫一扫

【Games104-2】Layerad Architecture of Game Engine

天悦哥 2022-03-31 阅读 74
游戏引擎

A Glance of Game Engine Layers

工具层 Tool Layer
功能层 Function Layer
资源层 Resource Layer
核心层 Core Layer
平台层 Platform Layer
第三方库 3rd Party Libraries

Resource Layer

offline Resource Importing

resource->access 资源-》资产

  • Unify file access by defining a meta asset file format
  • Assets are faster to access by importing preprocess
  • Build a composite asset file to refer to all resources
  • GUID is an extra protection of reference
  • 统一导入资源格式 使用更高效的格式
  • 使用预处理更高效导入 ie.合并贴图
  • 建立资源间链接
  • 设置全局编号保护引用正确(防止资源路径变化

Runtime Resource Management

handle system
使用过程中的加载吧,没太懂,后面会具体介绍

Manage Asset Life Cycle

  • Different resources have different life cycles
  • Limited memory requires release of loaded resources when possible
  • Garbage collection and deferred loading is critical features
  • 生命周期控制的重要性
  • 内存释放不到位造成卡顿
  • 垃圾回收和延迟导入对流畅性至关重要

Function Layer

Key–Ticks

以帧率循环执行的函数 分为逻辑和渲染

  • Fetch animation frame of character
  • Drive the skeleton(骨架)and skin of character
  • Render process all rendering jobs in an iteration of render tick for each frame
  • Heavy-duty Hotchpotch(杂烩)
  • Multi-Threading(Job sys)
void tickMain(float delta_time)
{
	while(!exit_flay)
	{
		tickLogic(delta_time);
		tickRender(delta_time);
	}
}

void tickLogic(float delta_time)
{
	tickCamera(delta_time);
	tickMotor(delta_time);
	tickController(delta_time);
	/*...*/
}
void tickRender(float delta_time)
{
	tickRenderCamera();
	rendering();
	postprocess();
	/*...*/
}

Core Layer

提供高效的底层工具

  • Math Library
  • Data Structure and Containers
  • Memory Management
    -Polymorphic Memory Resource PMR 多态内存资源
    -Reduce cache miss
    -Put data together
    -Access data in order
    -Allocate and de-allocate as a block
    集中存放,按顺序获取,成组提取擦除

Platform Layer

Render Hardware Interface(RHI)适应不同硬件平台的着色器转换工具

Tool Layer

allow Anyone to create game
Asset Conditioning Pipeline(把其他平台工具应用到游戏引擎的管线(?)输入输出功能)

引擎分层作用

decoupling (解耦)and reducing complexity
Response for Evolving Demands
越底层越稳定,高层依赖于底层,不需要了解底层实现原理,高层更新频繁。

Conclusion

  • Engine is designed with a layered architecture
  • Lower levels are more stable and upper levels are more customizable
  • Virtual world is composed by a set of clocks-ticks
举报

相关推荐

0 条评论