[Notes] Blueprint in depth - WXGopher/GameDevGems GitHub Wiki
Adapted from "Blueprint in depth": https://www.youtube.com/watch?v=j6mskTgL7kU
Introduction
Blueprint features
BP features
- inheritance
- framework class
- components
- child actors
- library
- interfaces
- data table/curves/data assets
Performance
A classical (and bad and complicated) example:
Keep everything as simple as possible but have enough complexity.
Here is a remark on the performance of BP:
Performance is mainly cost in between BP nodes (not within BP nodes themselves). This only happens in execution (not itself, say, embedding content)
So do not abuse
- quick loops
- get a large number of actors/classes
- ticking (most common)
More on ticking:
Ticking does not always mean event ticking, it also happens in Anim BP or even in UMG. Here are something you can do to mitigate ticking impacts:
- You can set whether BP ticks by default in engine settings, or you can set if a BP ticks and its ticking frequency in its setting (or in some BP nodes, like
Set Actor Tick Interval
) - You can also use other events or even a timer to replace an event ticking.
- You can separate physics and rendering and use a timer for physics (if possible)
- You can dispatch some computations to material (on GPU)
BP is currently always executed single-threaded.
BP executes in a difference speed under different scenario (PIE, dev play, shipping play), like this experiment:
Meanwhile native (C++) is blazingly fast (would be the x-axis if shown on the diagram above).
BP majorly impact memory consumption and loading times. It is regard as content while loading.
C++ are loaded on project boot but contents are loaded on an as-needed basis. Unless that content is loaded with C++ classes that reference it (loaded on boot).
Any form of referencing (including casts) between BP and another BP or content will load it.
So avoid loading a BP that references a loooot of other BPs or content, instead split those off into child BP classes, in a word:
and an example:
Compilation
Quick remarks on compilation:
There IS limitation on BP compilation:
To speed up compilation:
- use less nodes
- use less cast (cast is a reference and will include another class). You can also use tag to function as a type check usually handled by cast
- function reduces compiling time significantly
- computational expensive job should be moved to C++
Misc.
Ideally in larger projects, most classes should at all times be made in C++ but extended in BP.