Unreal Source Explained (USE) is an Unreal source code analysis, based on profilers.
For more infomation, see the repo in github.
- Overview
- Initialization
- Loop
- Memory Management
- Thread Management
- Blueprint Visual Scripting
- Rendering
- Gameplay
Every game is running frame by frame. Inside one frame, several submodules are called sequentially. This routine is known as Game Loop.
Inside FEngineLoop::Tick()
(link), there are many hardcoded submodules' ticks get called sequetially. This following image is the tick overview, however, it's sorted by the CPU Time, not the calling order.
Calling order is important, it's one of the reasons that lead to one-frame-off bugs.
The general rule is: if statusa is depended by statusb, then statusa should gets updated earlier than statusb inside one frame.
This seems to be easy, but if there are lots of status, and the dependecies are complicated, it needs lots of effort to achieve correct status update order.
But luckily, lots status dependecy don't care correct update order at all because their one-frame-off usually dont't result in visually noticeable motion. For other crucial status (e.g., camera, character), they still demands correct update order.
So, here is some important call extractions from FEngineLoop::Tick()
, sorted by the calling order:
- broadcast the frame begin event(link):
FCoreDelegates::OnBeginFrame
(link); - update the time stamp, max tick rate of this frame(link):
UEngine::UpdateTimeAndHandleMaxTickRate()
(link) - get the input data from the OS(link) :
FIOSApplication::PollGameDeviceState()
(link); - update the world of objects!(link):
UGameEngine::Tick()
(link), this is the most important call among others; - process slate operations accumulated in the world ticks(link):
FEngineLoop::ProcessLocalPlayerSlateOperations()
(link); - rearrange and paint the UI(link):
FSlateApplication::Tick()
(link); - custom registered tick is called(link):
FTicker::Tick()
(link) - broadcast the frame end event(link):
FCoreDelegates::OnEndFrame
(link)