GAMES104 Modern Game Engine - Engine Architecture Layers

Words: 502

Remember the “5+1” layer model and the two driving beasts.


LayerEnglishKeywordsTypical responsibilitiesExample code Xiaoming would write for “making the character move”
⑤Tool LayerEditor, productivityLevel/Material/Blueprint/Particle/Sound… all DCC import and visual editingUse Level Editor to drag the robot into the scene, adjust the camera and animation State Machine
④Function LayerVisible, animatable, playableRendering (Render), Animation, Physics, AI/Scripting, UI (HUD)TickLogic: read input → update Skeletal Animation; TickRender: submit DrawCall
③Resource LayerAssets = efficient data + relationshipsConvert different asset types into efficient required formats 1. .max/.psd → engine Asset (DDS textures, compressed Mesh); 2. Manage GUID, Handle, lifecycle, lazy loading, GCWrite Composite Asset: make “Robot.asset” point to Mesh/Texture/Anim
②Core LayerSwiss Army knifeMath library (SIMD), containers (fragmentation-free), memory pool, thread/task system, RTTI/ReflectionProvide Vec3/Quat math, efficient Queue, memory allocator for upper layers to call
①Platform LayerWrite once, run everywhereEncapsulate OS, file paths, CPU/GPU differences, RHI (DX/Metal/Vulkan abstraction), input devicesImplement RHI::CreateBuffer(): PC uses DX12, Mac uses Metal

Avoid logic where lower layers call upward into upper layers in reverse, which would cause a messy structure.


The two “mythical beasts” — the game main loop One Tick every 16.67ms (60 FPS):

  • TickLogic:
    • Read input → AI decision → Skeletal Animation update → physics collision → memory GC → …
    • (Whether you can see it or not, the world state has advanced)
  • TickRender:
    • Cull based on latest state → generate CommandBuffer → GPU execution → present frame
    • (Presentation only; does not affect real physics/logic) → Logic and rendering are strictly separated, facilitating multithreading, replay recording, and network synchronization.

Resource → Asset lifecycle (key)

Raw files (Resource)
↓ Import/Convert (offline)
Engine assets (Asset):

  • Compact data, GPU-friendly (e.g., DDS textures)
  • Carry GUIDs; renaming/moving does not lose references
  • Composite Asset describes associations (Mesh+Mat+Anim)
    ↓
    Runtime Handle system + Asset Manager:
  • Lazy loading, Reference Counting, asynchronous unloading
  • Avoid “stutter” and “memory blow-up” during Level switching

Evolution of multithreading and the Job system

Single-threaded → Logic/Render two threads → function-module threads (Physics/Animation) → fully Job-based (Task Graph)
Key: identify dependencies (Dependency), build a DAG, and split tasks into atomic Jobs to keep all cores fed.


Three golden rules of memory (Core Layer design mantra)

  1. Keep data together (Array-of-Struct → Struct-of-Array)
  2. Sequential access (Cache-line friendly)
  3. Batch reads/writes/frees (reduce malloc/free; use a Pool)

Easily overlooked pitfalls in the Platform Layer

  • File path separators, case sensitivity, encoding
  • Different CPU architectures (x86/ARM, big.LITTLE cores, SPU)
  • Graphics API differences → RHI abstraction
  • Input devices (keyboard/mouse, gamepad, steering wheel, Kinect…)

Tool Layer = productivity

  • In-house: Level Editor, Material Editor, Blueprint…
  • DCC chain: Max/Maya/PS/Houdini → Export Plugin → Asset Conditioning Pipeline → engine
  • There is still no absolute standard for a unified data format (FBX→USD?); most engines build their own.

Engine = ⑤ Tool ④ Function ③ Resource ② Core ① Platform; Tick drives the layered stack, the lower, the steadier; the higher, the livelier.

Video link: Engine Architecture Layers | GAMES104 - Modern Game Engine: From Beginner to Practice

This post contains some AI-assisted content, reviewed and edited by the author before publishing.
This post is licensed under CC BY-NC-SA 4.0. If it helped, or if you have anything to say, the comment box below is open.
Page views —
Unique visitors —

Loading...