When optimizing TINY METAL for the Switch a technique I have started using is dithered transparency. To use dithering in Unreal Engine you can use the “DitherTemporalAA” node.
A couple years back Adrian Courreges’ graphics study of GTA V brought to my attention how dither could be useful even for modern games. In TINY METAL we use a dither based transparency for the area of movement and area of attack visuals.
The purpose of using dither instead of vanilla transparency is to eliminate pixel overdraw. You can see the net result in Unreal Engine’s per-pixel shader complexity buffer view below.
Overall this was a small but meaningful optimization. It ensures that our frame time does not jump when players begin moving units and half the screen files with movement ranges.
From experimentation dither based transparency works well for large consistent levels of transparency with animated fade-in and no movement. The fade-in being helpful because it gives TAA time to adjust. The no movement being vital because otherwise TAA smears the dither where it should not generating glitches. Attempting to use it with symbols or UI resulted in ugly 90’s era visual side-effects and I do not recommend using it.
A quick method I use for transforming a C++ standard library string to an Unreal Engine FString is to call c_str(), the base c string export helper, on a std::string. Provided the result is being implicitly convert to an FString this method will work.
std::string a = “hello”;
FString b = a.c_str();
This method is shorter and simpler than the canonical method Epic Games recommends which calls for an explicit cast. An explicit cast is only required in cases where the compiler cannot otherwise deduce that the result should be an FString.
When building an Unreal Engine 4 project from the command line the default behavior of RunUAT is to include all Unreal Editor content as well. This bloats packages but is the safest default behavior. I urge you though to build without editor content. This will ensure your packages are smaller and prevent any assets in your game from depending upon editor content by accident.
To build an Unreal Engine 4 project from the command line using RunUAT pass the “-SkipCookingEditorContent” argument in your call to RunUAT.
RunUAT.bat -SkipCookingEditorContent BuildCookRun -project=PATHTOPROJECT
In Unreal Engine 4 the C++ method for instantiating a new UObject is the NewObject<T>() constructor.
auto myObject = NewObject<MyObjectClass>();
The “Random Integer” node in Unreal Engine 4’s Blueprints system behaves exactly like “rand() % Array.Num()” would in C++. Tthis makes it perfect for selecting a random entry of a blueprints array.
The wording in the Blueprint’s tool tip words this as “Returns a uniformly distributed random number between 0 and Max – 1” which I feel is not a clear explanation of what you would use this for. Indeed the node “Random Integer in Range” sounds like it would be more appropriate for getting a random entry of an array yet because the Range’s max is treated inclusive it is inappropriate for task.