Game Dev Optimisation
I have started writing an article on techniques used for optimising game performance. These techniques are useful for any 3D application, not just games. The Gaming industry has spent decades solving how to render your game screen without lag. Everything must feel smooth.
Let’s look at the stratetgies that are implemented from a systemic point of view, regardles of coding language or framework used. These are elementary principles.
Measuring performance:
In sofwtare engineering terms, this is called profiling. We must measure what needs to be optimised.
Our target performance :
- 60 Frames per Second or 120+ FPS for Virtual reality.
- CPU/GPU frame time breakdown
- draw calls ( < 500-1000)
- triangle/pixel count,
- overdraw
- memory usage,
- GC pauses
Profiling is usually done on target device, under different loads, and pushing it for worst-case loads.
Performance Bugets
A performance budget is the amount of work or usage that you allocate to a speicifc operation.
- For example: 30% usage CPU for rendering commands.
This then tells you that if performance budget is exceeded, you must make the operators more efficient.
There are a range of situations that affect performance.
We must measure a couple of metrics to understand when bottlenecks occur, and
One must know what bottlenecks exist in different scenarios, and tackle these.
need to
I - Loading performance:
“sidecar caching”
Geometry Buffers / per model buffers
Per batch buffers
Progressively loading geometry during streaming
II - Rendering performance
BVH Treees
Merging geometry and selection from “faces that will be rendered”
Frustum Culling
“Per object frustum culling with glMultiDrawElements” -> Collapse per-mesh draws into glMultiDrawElementsIndirect