Time for a little sneak peek of the #UE5 #UI optimization notes I'm writing. Optimizing UI and Slate is often challenging as people aren't always aware of what's expensive within this system. We're hoping to illuminate that a bit! Here's a🧵 with some of the bigger stuff.
First off, avoid Canvas Panels whenever you can. Slate groups draw calls by LayerID. Whereas other containers condense the number of draw calls by consolidating child elements' LayerIDs, Canvas Panels increment them, so they use MULTIPLE draw calls. This makes them CPU intensive.
The reason Canvas Panels do this is to support rendering child elements on top of each other if need be. To be clear, Canvas Panels are great for highly detailed layouts or instances where you need complex Z-ordering. It's totally permissible to use them as, say, the root of a UI
The thing to avoid is using Canvas Panels for every single widget in your project, including individual buttons, text boxes, or other commonly re-used sub-elements. This is what explodes your CPU use in your UI. Instead, use vertical and horizontal boxes, size boxes, and others.
Next, get to know Invalidation! This system caches UI elements so they don't have to be re-drawn every frame. Slate falls back on this cached data until something changes about them, thus flagging them as Invalidated, and only then does it redraw them.
You've got several options for using the Invalidation system: Invalidation Box Widgets, Global Invalidation, and Retainer Panels.
Invalidation Boxes cache their child elements until they're Invalidated. Global Invalidation applies Invalidation across the entire UI, and can be activated by setting Slate.EnableGlobalInvalidation to True.
The thing to be cautious of is weighing how often elements change. Invalidation works really well for widgets that don't change often, freeing up CPU for elements that just don't need to repaint, but if you have a widget changing every frame, it will eat up extra memory.
To help in these instances, any widget can be flagged with an Is Volatile boolean in its properties. Volatile widgets still skip the layout calculation if not needed, but they aren't cached. This way you can apply Invalidation broadly, but tailor how individual widgets benefit.
Retainer Panels flatten all their child elements into a single texture before drawing, which saves draw calls. There's a balance to be struck between saving draw calls and texture memory/CPU use, but there's a lot of cases where clusters of UI elements can benefit from this.
Next: DO NOT BIND PARAMETERS. While this is tempting as a quick way to automatically update a UI based on a variable, it's expensive, because the widget has to poll the binding every frame.
Instead, go the other direction with Event-driven updates. IE: create events or functions that you feed information into, then have it update the field accordingly. Or, use Delegates/Event Dispatchers to respond to changes in gameplay as needed.
This way, changes happen ONLY when they need to. What's more, if you want the UI to, say, animate in response to a change (IE the player takes damage, and you want part of the health bar to turn yellow before it drains), this will make that more feasible.
Finally, speaking of animations, there is a hierarchy of expense for different methods of moving or animating UI. You might be a little surprised at what's advisable versus how you think you're expected to do things.
LEAST EXPENSIVE: Materials! If it's something like a scrolling background, a glow effect, or some other looping element you can restrict to a Material, then Materials are preferable. This incurs no CPU cost, as it's handled by the GPU.
INEXPENSIVE: Programmatically tweening objects in Blueprint/CPP. Animations in the UMG animation editor have an initialization cost. If you move elements w/ code, you circumvent that. This is preferable for small, very frequently-used animations like a button highlight response.
EXPENSIVE: The UMG animation editor! The actual act of moving objects around or changing their properties shouldn't be any more expensive than programmatically changing them, but the Sequencer object has to initialize when an animation starts. For complex/bespoke anims, use this.
Big big caveat with the UMG animation editor is that it can trigger layout invalidation when used within the Invalidation system, which will add extra expense for non-volatile widgets, so be judicious about how often you depend on it.
Bottom line is the more frequently something has to animate, the more you should think about making it a programmatic tween or animated material instead of using the UMG animation editor.
That covers probably the broadest points from the upcoming guide, which will have additional details. Hopefully this is of help!

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Mike Prinke 🇺🇦

Mike Prinke 🇺🇦 Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @Mike_Prinke

Apr 11
Went on a #Pathfinder2e and #StarfinderRPG book binge. It turns out Paizo has been very busy since I initially got these. Sooooo much new stuff to see!
So they have mechs now
The mech rules are pretty clever, managing to take into account even the possibility of playing a Power Rangers Megazord.

For reference, that'd be a Colossal frame with five operators, which means it gets like five actions every turn.
Read 16 tweets
Apr 9
The short version is that I work on documentation on the Unreal Engine docs site at docs.unrealengine.com. I write stuff mainly in platform support, pipeline tools, and programming.

There are a lot of ways that this job is surprisingly not so simple! 🧵
Imagine writing the manual for a feature that has not been released yet. You cannot google the answer, and there's no Stack Overflow post demystifying it. 100% of the knowledge about that feature is internal to the company, and you need to find it.
Here's probably the biggest case of that I've experienced. The Valley of the Ancient sample showcased a lot of key UE5 features for Early Access. But, even the docs for each individual feature were still in-progress. And some tools were still not final!

docs.unrealengine.com/5.0/en-US/vall…
Read 12 tweets
Apr 8
#SonicMovie2 is a BIZARRE ride. Like right when you think it’s going to become rational for a minute there’s all these left turns into chaos. This movie is surely made by goblins.
I do not know how to describe what I just watched. There is this insane clash of like three different kinds of movie happening. It’s all following the same, reasonably cohesive plot, but you just never know which style of movie it’s going to veer into on the way to the goal.
SPOILERS below.
Read 16 tweets
Jun 14, 2021
Thread time again.

I will both answer the question the OP is asking, and explain why the point of view expressed in the article is … frustrating.

JRPGs don’t really need fixing as much as people think, but it’s a very common point of view from game devs to want to change them.
To lots of people, the appeal of the genre is from a handful of examples and the surface-level traits the genre brings to the table: novel-like storytelling, with detailed worldbuilding and clean exploration. Interesting places and characters with a full plot wrapped around them.
Simply put: Many people who want to tell stories with games want to make something with a world as detailed and characters as appealing as their favorite JRPG. These hallmarks are universally appealing.

The gameplay is a lot more divisive among designers for a few reasons.
Read 33 tweets
Jun 13, 2021
As an extremely career-driven person, I cannot possibly overstate the level of maliciousness in this person’s advice. She is deeply out of touch with the realities of the current job climate, and adopting these kinds of habits will ruin your life long-term.
If you give your boss your weekends with blind enthusiasm, they will begin to schedule around the assumption you will always do it. I spent years filling a role as an “indispensable” programmer, and many of the folks I worked with would ping me on Slack after 11 PM on a Sunday.
It’s THEIR job to make sure projects are scheduled well enough that you don’t need to do overtime, not your job to compensate for their management or acquiesce to their lack of boundaries.
Read 5 tweets
Jun 11, 2021
Thread time.

I’ve worked on several Kickstarter-backed projects, and Doc’s take here is accurate. KS is far from an ideal way to build a video game budget.

I won’t reveal specific information about projects, but I’ll fill you in on some budgeting realities. 1/
To give a ballpark figure on what games cost, think $10,000 per person per month. That’s not necessarily everybody’s salary, but rather an average estimate of their pay plus running costs, like software licenses, office space, etc. 2/
Most of a video game’s cost is man-hours. Material costs are lightweight relative to other kinds of entertainment, but people must constantly do work for any ground to get made. Everything you see is manually built and tested by someone. 3/
Read 32 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(