Efficient way to do 1000s of healthbars. Possible to use Instanced Static Meshs?

I think 1000s of widget components would be way too inefficient.

Anyone have any experience in this? I was curious if I could use ISMs with material parameters, but I wouldn’t know how to make a static mesh behave like a HUD element. Is this possible?

I’ve managed to get the health bar ISMs moving with the unit and I’ve also successfully gotten the health bar to billboard, it doesnt look or act nice. but what I really need is to make it behave like a HUD using a fixed size and screen space.

Any suggestions would be helpful.

Seems like a pretty round about way to do it, utilizing static meshes to behave like a widget.

I don’t exactly have a solution for you on this, but I recently came across a good article that may be helpful in solving the problem; or at least, giving some context to how it might be done to ensure good performance. Link is below to the article (including a good video showcasing group object logic to optimize memory in the CPU in Unreal), but point no. 4 sticks out on this:

Hopefully this is at least a little helpful… If I were you, I’d attempt it using widget components and test it to see the efficacy performance wise, before attempting to build work arounds. You may be able to optimize widget components enough to work.

1 Like

Thanks for the info. I agree

Oh, I’ve already tested it. The units in my project are instanced static meshs with vertex animations. It is way too expensive to attached 1000s of widget components to them and move them on tick along with each instance. I may get creative and find another way to show unit health. Like changing the color or adding blood using dynamic materials.

Using per instance data could actually be a good way of representing a simple health bar on your thousands of characters. You can read the per instance data on the material assigned to the health bar to show how much they have.
Another thing most games do is only show the health bar on damaged entities. Which both manages the visual clutter and the performance cost of too many health bars.

I’m not sure how much this will improve performance, but you can try drawing all widgets on the HUD, setting their position via Project World Location to Widget Position.

In this case, you can use the Invalidation Box to improve the rendering of many of them (in theory).