Programming

2025
One of the largest performance overheads in Unreal is the need for actors and primitive components to draw something in a world. Today I want to show you a way to bypass these abstractions entirely and manually draw primitives to the world with minimal overhead.
Runtime polymorphism via virtual functions is the traditional way to achieve dynamic dispatch in C++, but it comes with overhead: vtable lookups, cache misses, and heap allocations. With C++20, we can leverage std::variant and concepts to create compile-time polymorphism that sidesteps virtual dispatch entirely.
A Virtual Table (or V-Table) is an essential concept in C++ for implementing polymorphism. It’s a data structure used to support dynamic dispatch for virtual functions. When you define a class with virtual functions, the compiler generates a V-Table for that class to keep track of the addresses of those virtual functions. At runtime, the V-Table is used to decide which function to call based on the type of the object, allowing polymorphism to work correctly.
2024
Lambdas, or anonymous functions, in Unreal Engine can be very useful for writing concise and flexible code. However, they come with certain dangers, particularly when dealing with the lifetime of objects and capturing variables by reference. Here’s why: